Commit f86abedb authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Properly handle navigation in containers supporting IWebBrowserApp.

parent 8ba65149
...@@ -192,12 +192,13 @@ void set_doc_state(DocHost *This, READYSTATE doc_state) ...@@ -192,12 +192,13 @@ void set_doc_state(DocHost *This, READYSTATE doc_state)
static void update_ready_state(DocHost *This, READYSTATE ready_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); notif_complete(This, DISPID_NAVIGATECOMPLETE2);
if(ready_state == READYSTATE_COMPLETE && This->doc_state < READYSTATE_COMPLETE) { if(ready_state == READYSTATE_COMPLETE && This->doc_state < READYSTATE_COMPLETE) {
set_doc_state(This, READYSTATE_COMPLETE); set_doc_state(This, READYSTATE_COMPLETE);
notif_complete(This, DISPID_DOCUMENTCOMPLETE); if(!This->browser_service) /* FIXME: Not fully correct */
notif_complete(This, DISPID_DOCUMENTCOMPLETE);
}else { }else {
set_doc_state(This, ready_state); set_doc_state(This, ready_state);
} }
...@@ -844,7 +845,7 @@ static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, D ...@@ -844,7 +845,7 @@ static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, D
if(ready_state == READYSTATE_COMPLETE && !This->doc_navigate) if(ready_state == READYSTATE_COMPLETE && !This->doc_navigate)
advise_prop_notif(This, FALSE); advise_prop_notif(This, FALSE);
push_ready_state_task(This, ready_state); update_ready_state(This, ready_state);
break; break;
} }
default: default:
......
...@@ -787,8 +787,42 @@ static HRESULT WINAPI DocObjectService_FireDocumentComplete( ...@@ -787,8 +787,42 @@ static HRESULT WINAPI DocObjectService_FireDocumentComplete(
DWORD dwFlags) DWORD dwFlags)
{ {
ShellBrowser *This = impl_from_IDocObjectService(iface); ShellBrowser *This = impl_from_IDocObjectService(iface);
FIXME("%p %p %x\n", This, pHTMLWindow, dwFlags); IHTMLPrivateWindow *priv_window;
return E_NOTIMPL; 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( static HRESULT WINAPI DocObjectService_UpdateDesktopComponent(
......
...@@ -463,6 +463,7 @@ struct HTMLDocumentObj { ...@@ -463,6 +463,7 @@ struct HTMLDocumentObj {
BOOL ui_active; BOOL ui_active;
BOOL window_active; BOOL window_active;
BOOL hostui_setup; BOOL hostui_setup;
BOOL is_webbrowser;
BOOL container_locked; BOOL container_locked;
BOOL focus; BOOL focus;
INT download_state; INT download_state;
......
...@@ -265,6 +265,9 @@ static void parse_complete(HTMLDocumentObj *doc) ...@@ -265,6 +265,9 @@ static void parse_complete(HTMLDocumentObj *doc)
call_property_onchanged(&doc->basedoc.cp_propnotif, 1005); call_property_onchanged(&doc->basedoc.cp_propnotif, 1005);
call_explorer_69(doc); 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 */ /* 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 ...@@ -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) { if(window->doc_obj && window == window->doc_obj->basedoc.window) {
BOOL cancel; BOOL cancel;
......
...@@ -125,6 +125,7 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite ...@@ -125,6 +125,7 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
} }
memset(&This->doc_obj->hostinfo, 0, sizeof(DOCHOSTUIINFO)); memset(&This->doc_obj->hostinfo, 0, sizeof(DOCHOSTUIINFO));
This->doc_obj->is_webbrowser = FALSE;
if(!pClientSite) if(!pClientSite)
return S_OK; return S_OK;
...@@ -212,14 +213,27 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite ...@@ -212,14 +213,27 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
IDocObjectService *doc_object_service; IDocObjectService *doc_object_service;
IBrowserService *browser_service; IBrowserService *browser_service;
IWebBrowser2 *wb;
hres = IServiceProvider_QueryService(sp, &IID_IShellBrowser, hres = IServiceProvider_QueryService(sp, &IID_IShellBrowser,
&IID_IBrowserService, (void**)&browser_service); &IID_IBrowserService, (void**)&browser_service);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
hres = IBrowserService_QueryInterface(browser_service, hres = IBrowserService_QueryInterface(browser_service,
&IID_IDocObjectService, (void**)&doc_object_service); &IID_IDocObjectService, (void**)&doc_object_service);
if(SUCCEEDED(hres)) if(SUCCEEDED(hres)) {
This->doc_obj->doc_object_service = doc_object_service; 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); IBrowserService_Release(browser_service);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment