mshtml: Pass external connection to WebBrowser host, if possible.

This commit is contained in:
Jacek Caban 2013-09-19 16:13:06 +02:00 committed by Alexandre Julliard
parent b17d139328
commit d36ffab315
3 changed files with 87 additions and 1 deletions

View File

@ -965,6 +965,7 @@ void do_ns_command(HTMLDocument*,const char*,nsICommandParams*) DECLSPEC_HIDDEN;
void update_doc(HTMLDocument*,DWORD) DECLSPEC_HIDDEN;
void update_title(HTMLDocumentObj*) DECLSPEC_HIDDEN;
void set_document_navigation(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN;

View File

@ -1625,6 +1625,89 @@ static BOOL is_supported_doc_mime(const WCHAR *mime)
return ret;
}
static IUri *get_moniker_uri(IMoniker *mon)
{
IUriContainer *uri_container;
IUri *ret = NULL;
HRESULT hres;
hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
if(SUCCEEDED(hres)) {
hres = IUriContainer_GetIUri(uri_container, &ret);
IUriContainer_Release(uri_container);
if(FAILED(hres))
return NULL;
}else {
FIXME("No IUriContainer\n");
}
return ret;
}
static void handle_extern_mime_navigation(nsChannelBSC *This)
{
IWebBrowserPriv2IE8 *webbrowser_priv;
IOleCommandTarget *cmdtrg;
HTMLDocumentObj *doc_obj;
IBindCtx *bind_ctx;
IUri *uri;
VARIANT flags;
HRESULT hres;
if(!This->bsc.window || !This->bsc.window->base.outer_window || !This->bsc.window->base.outer_window->doc_obj)
return;
doc_obj = This->bsc.window->base.outer_window->doc_obj;
hres = IOleClientSite_QueryInterface(doc_obj->client, &IID_IOleCommandTarget, (void**)&cmdtrg);
if(SUCCEEDED(hres)) {
IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 62, 0, NULL, NULL);
IOleCommandTarget_Release(cmdtrg);
}
set_document_navigation(doc_obj, FALSE);
if(!doc_obj->webbrowser) {
FIXME("unimplemented in non-webbrowser mode\n");
return;
}
uri = get_moniker_uri(This->bsc.mon);
if(!uri)
return;
hres = CreateBindCtx(0, &bind_ctx);
if(FAILED(hres)) {
IUri_Release(uri);
return;
}
V_VT(&flags) = VT_I4;
V_I4(&flags) = navHyperlink;
hres = IUnknown_QueryInterface(doc_obj->webbrowser, &IID_IWebBrowserPriv2IE8, (void**)&webbrowser_priv);
if(SUCCEEDED(hres)) {
hres = IWebBrowserPriv2IE8_NavigateWithBindCtx2(webbrowser_priv, uri, &flags, NULL, NULL, NULL, bind_ctx, NULL);
IWebBrowserPriv2IE8_Release(webbrowser_priv);
}else {
IWebBrowserPriv *webbrowser_priv_old;
VARIANT uriv;
hres = IUnknown_QueryInterface(doc_obj->webbrowser, &IID_IWebBrowserPriv, (void**)&webbrowser_priv_old);
if(SUCCEEDED(hres)) {
V_VT(&uriv) = VT_BSTR;
IUri_GetDisplayUri(uri, &V_BSTR(&uriv));
hres = IWebBrowserPriv_NavigateWithBindCtx(webbrowser_priv_old, &uriv, &flags, NULL, NULL, NULL, bind_ctx, NULL);
SysFreeString(V_BSTR(&uriv));
IWebBrowserPriv_Release(webbrowser_priv_old);
}
}
IUri_Release(uri);
}
static HRESULT nsChannelBSC_on_progress(BSCallback *bsc, ULONG status_code, LPCWSTR status_text)
{
nsChannelBSC *This = nsChannelBSC_from_BSCallback(bsc);
@ -1634,6 +1717,8 @@ static HRESULT nsChannelBSC_on_progress(BSCallback *bsc, ULONG status_code, LPCW
if(This->is_doc_channel && !is_supported_doc_mime(status_text)) {
FIXME("External MIME: %s\n", debugstr_w(status_text));
handle_extern_mime_navigation(This);
This->nschannel = NULL;
}

View File

@ -210,7 +210,7 @@ void call_docview_84(HTMLDocumentObj *doc)
FIXME("handle result\n");
}
static void set_document_navigation(HTMLDocumentObj *doc, BOOL doc_can_navigate)
void set_document_navigation(HTMLDocumentObj *doc, BOOL doc_can_navigate)
{
VARIANT var;