mshtml: Pass HTMLPluginContainer to create_plugin_host.
This commit is contained in:
parent
44bb2ba295
commit
a545fe08ad
|
@ -639,11 +639,14 @@ static IUnknown *create_activex_object(HTMLInnerWindow *window, nsIDOMHTMLElemen
|
||||||
static NPError CDECL NPP_New(NPMIMEType pluginType, NPP instance, UINT16 mode, INT16 argc, char **argn,
|
static NPError CDECL NPP_New(NPMIMEType pluginType, NPP instance, UINT16 mode, INT16 argc, char **argn,
|
||||||
char **argv, NPSavedData *saved)
|
char **argv, NPSavedData *saved)
|
||||||
{
|
{
|
||||||
|
HTMLPluginContainer *container;
|
||||||
nsIDOMHTMLElement *nselem;
|
nsIDOMHTMLElement *nselem;
|
||||||
HTMLInnerWindow *window;
|
HTMLInnerWindow *window;
|
||||||
|
HTMLDOMNode *node;
|
||||||
IUnknown *obj;
|
IUnknown *obj;
|
||||||
CLSID clsid;
|
CLSID clsid;
|
||||||
NPError err = NPERR_NO_ERROR;
|
NPError err = NPERR_NO_ERROR;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
TRACE("(%s %p %x %d %p %p %p)\n", debugstr_a(pluginType), instance, mode, argc, argn, argv, saved);
|
TRACE("(%s %p %x %d %p %p %p)\n", debugstr_a(pluginType), instance, mode, argc, argn, argv, saved);
|
||||||
|
|
||||||
|
@ -660,22 +663,32 @@ static NPError CDECL NPP_New(NPMIMEType pluginType, NPP instance, UINT16 mode, I
|
||||||
return NPERR_GENERIC_ERROR;
|
return NPERR_GENERIC_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = create_activex_object(window, nselem, &clsid);
|
hres = get_node(window->doc, (nsIDOMNode*)nselem, TRUE, &node);
|
||||||
if(obj) {
|
nsIDOMHTMLElement_Release(nselem);
|
||||||
PluginHost *host;
|
if(FAILED(hres))
|
||||||
HRESULT hres;
|
return NPERR_GENERIC_ERROR;
|
||||||
|
|
||||||
hres = create_plugin_host(window->doc, (nsIDOMElement*)nselem, obj, &clsid, &host);
|
hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_HTMLPluginContainer,
|
||||||
|
(void**)&container);
|
||||||
|
node_release(node);
|
||||||
|
if(FAILED(hres)) {
|
||||||
|
ERR("Not an object element\n");
|
||||||
|
return NPERR_GENERIC_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
obj = create_activex_object(window, container->element.nselem, &clsid);
|
||||||
|
if(obj) {
|
||||||
|
hres = create_plugin_host(window->doc, container, obj, &clsid);
|
||||||
IUnknown_Release(obj);
|
IUnknown_Release(obj);
|
||||||
if(SUCCEEDED(hres))
|
if(SUCCEEDED(hres))
|
||||||
instance->pdata = host;
|
instance->pdata = container->plugin_host;
|
||||||
else
|
else
|
||||||
err = NPERR_GENERIC_ERROR;
|
err = NPERR_GENERIC_ERROR;
|
||||||
}else {
|
}else {
|
||||||
err = NPERR_GENERIC_ERROR;
|
err = NPERR_GENERIC_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIDOMHTMLElement_Release(nselem);
|
node_release(&container->element.node);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1634,29 +1634,6 @@ static const IServiceProviderVtbl ServiceProviderVtbl = {
|
||||||
PHServiceProvider_QueryService
|
PHServiceProvider_QueryService
|
||||||
};
|
};
|
||||||
|
|
||||||
static HRESULT assoc_element(PluginHost *host, HTMLDocumentNode *doc, nsIDOMElement *nselem)
|
|
||||||
{
|
|
||||||
HTMLPluginContainer *container_elem;
|
|
||||||
HTMLDOMNode *node;
|
|
||||||
HRESULT hres;
|
|
||||||
|
|
||||||
hres = get_node(doc, (nsIDOMNode*)nselem, TRUE, &node);
|
|
||||||
if(FAILED(hres))
|
|
||||||
return hres;
|
|
||||||
|
|
||||||
hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_HTMLPluginContainer,
|
|
||||||
(void**)&container_elem);
|
|
||||||
node_release(node);
|
|
||||||
if(FAILED(hres)) {
|
|
||||||
ERR("Not an object element\n");
|
|
||||||
return hres;
|
|
||||||
}
|
|
||||||
|
|
||||||
container_elem->plugin_host = host;
|
|
||||||
host->element = container_elem;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void detach_plugin_host(PluginHost *host)
|
void detach_plugin_host(PluginHost *host)
|
||||||
{
|
{
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
@ -1717,10 +1694,11 @@ void detach_plugin_host(PluginHost *host)
|
||||||
host->doc = NULL;
|
host->doc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT create_plugin_host(HTMLDocumentNode *doc, nsIDOMElement *nselem, IUnknown *unk, const CLSID *clsid, PluginHost **ret)
|
HRESULT create_plugin_host(HTMLDocumentNode *doc, HTMLPluginContainer *container, IUnknown *unk, const CLSID *clsid)
|
||||||
{
|
{
|
||||||
PluginHost *host;
|
PluginHost *host;
|
||||||
HRESULT hres;
|
|
||||||
|
assert(!container->plugin_host);
|
||||||
|
|
||||||
host = heap_alloc_zero(sizeof(*host));
|
host = heap_alloc_zero(sizeof(*host));
|
||||||
if(!host)
|
if(!host)
|
||||||
|
@ -1737,12 +1715,6 @@ HRESULT create_plugin_host(HTMLDocumentNode *doc, nsIDOMElement *nselem, IUnknow
|
||||||
|
|
||||||
host->ref = 1;
|
host->ref = 1;
|
||||||
|
|
||||||
hres = assoc_element(host, doc, nselem);
|
|
||||||
if(FAILED(hres)) {
|
|
||||||
heap_free(host);
|
|
||||||
return hres;
|
|
||||||
}
|
|
||||||
|
|
||||||
IUnknown_AddRef(unk);
|
IUnknown_AddRef(unk);
|
||||||
host->plugin_unk = unk;
|
host->plugin_unk = unk;
|
||||||
host->clsid = *clsid;
|
host->clsid = *clsid;
|
||||||
|
@ -1750,6 +1722,7 @@ HRESULT create_plugin_host(HTMLDocumentNode *doc, nsIDOMElement *nselem, IUnknow
|
||||||
host->doc = doc;
|
host->doc = doc;
|
||||||
list_add_tail(&doc->plugin_hosts, &host->entry);
|
list_add_tail(&doc->plugin_hosts, &host->entry);
|
||||||
|
|
||||||
*ret = host;
|
container->plugin_host = host;
|
||||||
|
host->element = container;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ struct HTMLPluginContainer {
|
||||||
|
|
||||||
extern const IID IID_HTMLPluginContainer DECLSPEC_HIDDEN;
|
extern const IID IID_HTMLPluginContainer DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
HRESULT create_plugin_host(HTMLDocumentNode*,nsIDOMElement*,IUnknown*,const CLSID*,PluginHost**) DECLSPEC_HIDDEN;
|
HRESULT create_plugin_host(HTMLDocumentNode*,HTMLPluginContainer*,IUnknown*,const CLSID*) DECLSPEC_HIDDEN;
|
||||||
void update_plugin_window(PluginHost*,HWND,const RECT*) DECLSPEC_HIDDEN;
|
void update_plugin_window(PluginHost*,HWND,const RECT*) DECLSPEC_HIDDEN;
|
||||||
void detach_plugin_host(PluginHost*) DECLSPEC_HIDDEN;
|
void detach_plugin_host(PluginHost*) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue