mshtml: Properly handle navigation in containers supporting IWebBrowserApp.
This commit is contained in:
parent
8ba6514962
commit
f86abedb40
|
@ -192,11 +192,12 @@ void set_doc_state(DocHost *This, READYSTATE doc_state)
|
|||
|
||||
static void update_ready_state(DocHost *This, READYSTATE ready_state)
|
||||
{
|
||||
if(ready_state > READYSTATE_LOADING && This->doc_state <= READYSTATE_LOADING)
|
||||
if(ready_state > READYSTATE_LOADING && This->doc_state <= READYSTATE_LOADING && !This->browser_service /* FIXME */)
|
||||
notif_complete(This, DISPID_NAVIGATECOMPLETE2);
|
||||
|
||||
if(ready_state == READYSTATE_COMPLETE && This->doc_state < READYSTATE_COMPLETE) {
|
||||
set_doc_state(This, READYSTATE_COMPLETE);
|
||||
if(!This->browser_service) /* FIXME: Not fully correct */
|
||||
notif_complete(This, DISPID_DOCUMENTCOMPLETE);
|
||||
}else {
|
||||
set_doc_state(This, ready_state);
|
||||
|
@ -844,7 +845,7 @@ static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, D
|
|||
if(ready_state == READYSTATE_COMPLETE && !This->doc_navigate)
|
||||
advise_prop_notif(This, FALSE);
|
||||
|
||||
push_ready_state_task(This, ready_state);
|
||||
update_ready_state(This, ready_state);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -787,8 +787,42 @@ static HRESULT WINAPI DocObjectService_FireDocumentComplete(
|
|||
DWORD dwFlags)
|
||||
{
|
||||
ShellBrowser *This = impl_from_IDocObjectService(iface);
|
||||
FIXME("%p %p %x\n", This, pHTMLWindow, dwFlags);
|
||||
return E_NOTIMPL;
|
||||
IHTMLPrivateWindow *priv_window;
|
||||
VARIANTARG params[2];
|
||||
DISPPARAMS dp = {params, NULL, 2, 0};
|
||||
VARIANT url_var;
|
||||
BSTR url;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("%p %p %x\n", This, pHTMLWindow, dwFlags);
|
||||
|
||||
hres = IHTMLWindow2_QueryInterface(pHTMLWindow, &IID_IHTMLPrivateWindow, (void**)&priv_window);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = IHTMLPrivateWindow_GetAddressBarUrl(priv_window, &url);
|
||||
IHTMLPrivateWindow_Release(priv_window);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
TRACE("got URL %s\n", debugstr_w(url));
|
||||
|
||||
V_VT(params) = (VT_BYREF|VT_VARIANT);
|
||||
V_BYREF(params) = &url;
|
||||
|
||||
V_VT(params+1) = VT_DISPATCH;
|
||||
V_DISPATCH(params+1) = This->doc_host->disp;
|
||||
|
||||
V_VT(&url_var) = VT_BSTR;
|
||||
V_BSTR(&url_var) = url;
|
||||
|
||||
TRACE(">>>\n");
|
||||
call_sink(This->doc_host->cps.wbe2, DISPID_DOCUMENTCOMPLETE, &dp);
|
||||
TRACE("<<<\n");
|
||||
|
||||
SysFreeString(url);
|
||||
This->doc_host->busy = VARIANT_FALSE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DocObjectService_UpdateDesktopComponent(
|
||||
|
|
|
@ -463,6 +463,7 @@ struct HTMLDocumentObj {
|
|||
BOOL ui_active;
|
||||
BOOL window_active;
|
||||
BOOL hostui_setup;
|
||||
BOOL is_webbrowser;
|
||||
BOOL container_locked;
|
||||
BOOL focus;
|
||||
INT download_state;
|
||||
|
|
|
@ -265,6 +265,9 @@ static void parse_complete(HTMLDocumentObj *doc)
|
|||
call_property_onchanged(&doc->basedoc.cp_propnotif, 1005);
|
||||
call_explorer_69(doc);
|
||||
|
||||
if(doc->is_webbrowser && doc->usermode != EDITMODE)
|
||||
IDocObjectService_FireNavigateComplete2(doc->doc_object_service, &doc->basedoc.window->IHTMLWindow2_iface, 0);
|
||||
|
||||
/* FIXME: IE7 calls EnableModelless(TRUE), EnableModelless(FALSE) and sets interactive state here */
|
||||
}
|
||||
|
||||
|
|
|
@ -1944,6 +1944,26 @@ HRESULT navigate_url(HTMLWindow *window, const WCHAR *new_url, const WCHAR *base
|
|||
}
|
||||
}
|
||||
|
||||
if(window->doc_obj->is_webbrowser && window->doc_obj && window == window->doc_obj->basedoc.window) {
|
||||
BOOL cancel = FALSE;
|
||||
IUri *uri;
|
||||
|
||||
hres = IDocObjectService_FireBeforeNavigate2(window->doc_obj->doc_object_service, NULL, url, 0x40,
|
||||
NULL, NULL, 0, NULL, TRUE, &cancel);
|
||||
if(SUCCEEDED(hres) && cancel) {
|
||||
TRACE("Navigation canceled\n");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
hres = CreateUri(url, 0, 0, &uri);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = super_navigate(window, uri, NULL, NULL, 0);
|
||||
IUri_Release(uri);
|
||||
return hres;
|
||||
}
|
||||
|
||||
if(window->doc_obj && window == window->doc_obj->basedoc.window) {
|
||||
BOOL cancel;
|
||||
|
||||
|
|
|
@ -125,6 +125,7 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
|
|||
}
|
||||
|
||||
memset(&This->doc_obj->hostinfo, 0, sizeof(DOCHOSTUIINFO));
|
||||
This->doc_obj->is_webbrowser = FALSE;
|
||||
|
||||
if(!pClientSite)
|
||||
return S_OK;
|
||||
|
@ -212,14 +213,27 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
|
|||
if(SUCCEEDED(hres)) {
|
||||
IDocObjectService *doc_object_service;
|
||||
IBrowserService *browser_service;
|
||||
IWebBrowser2 *wb;
|
||||
|
||||
hres = IServiceProvider_QueryService(sp, &IID_IShellBrowser,
|
||||
&IID_IBrowserService, (void**)&browser_service);
|
||||
if(SUCCEEDED(hres)) {
|
||||
hres = IBrowserService_QueryInterface(browser_service,
|
||||
&IID_IDocObjectService, (void**)&doc_object_service);
|
||||
if(SUCCEEDED(hres))
|
||||
if(SUCCEEDED(hres)) {
|
||||
This->doc_obj->doc_object_service = doc_object_service;
|
||||
|
||||
/*
|
||||
* Some embedding routines, esp. in regards to use of IDocObjectService, differ if
|
||||
* embedder supports IWebBrowserApp.
|
||||
*/
|
||||
hres = IServiceProvider_QueryService(sp, &IID_IWebBrowserApp, &IID_IWebBrowser2, (void**)&wb);
|
||||
if(SUCCEEDED(hres)) {
|
||||
This->doc_obj->is_webbrowser = TRUE;
|
||||
IWebBrowser2_Release(wb);
|
||||
}
|
||||
}
|
||||
|
||||
IBrowserService_Release(browser_service);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue