diff --git a/dlls/ieframe/dochost.c b/dlls/ieframe/dochost.c index d59c335efa5..6eb27ec75ef 100644 --- a/dlls/ieframe/dochost.c +++ b/dlls/ieframe/dochost.c @@ -30,6 +30,9 @@ DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0); #define DOCHOST_DOCCANNAVIGATE 0 +/* Undocumented notification, see mshtml tests */ +#define CMDID_EXPLORER_UPDATEHISTORY 38 + static ATOM doc_view_atom = 0; void push_dochost_task(DocHost *This, task_header_t *task, task_proc_t proc, task_destr_t destr, BOOL send) @@ -324,6 +327,39 @@ static LRESULT WINAPI doc_view_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l return DefWindowProcW(hwnd, msg, wParam, lParam); } +static void update_travellog(DocHost *This) +{ + travellog_entry_t *new_entry; + + if(!This->travellog) { + This->travellog = heap_alloc(4 * sizeof(*This->travellog)); + if(!This->travellog) + return; + + This->travellog_size = 4; + }else if(This->travellog_size < This->travellog_position+1) { + travellog_entry_t *new_travellog; + + new_travellog = heap_realloc(This->travellog, This->travellog_size*2); + if(!new_travellog) + return; + + This->travellog = new_travellog; + This->travellog_size *= 2; + } + + while(This->travellog_length > This->travellog_position) + heap_free(This->travellog[--This->travellog_length].url); + + new_entry = This->travellog + This->travellog_position; + + new_entry->url = heap_strdupW(This->url); + if(!new_entry->url) + return; + + This->travellog_position++; +} + void create_doc_view_hwnd(DocHost *This) { RECT rect; @@ -550,12 +586,20 @@ static HRESULT WINAPI ClOleCommandTarget_Exec(IOleCommandTarget *iface, } } + if(IsEqualGUID(pguidCmdGroup, &CGID_Explorer)) { + switch(nCmdID) { + case CMDID_EXPLORER_UPDATEHISTORY: + update_travellog(This); + break; + default: + FIXME("Unimplemented cmd %d of CGID_Explorer\n", nCmdID); + } + } + FIXME("Unimplemented group %s\n", debugstr_guid(pguidCmdGroup)); return E_NOTIMPL; } -#undef impl_from_IOleCommandTarget - static const IOleCommandTargetVtbl OleCommandTargetVtbl = { ClOleCommandTarget_QueryInterface, ClOleCommandTarget_AddRef, @@ -899,5 +943,9 @@ void DocHost_Release(DocHost *This) ConnectionPointContainer_Destroy(&This->cps); + while(This->travellog_length) + heap_free(This->travellog[--This->travellog_length].url); + heap_free(This->travellog); + heap_free(This->url); } diff --git a/dlls/ieframe/ieframe.h b/dlls/ieframe/ieframe.h index 60a65fb5356..29538410e88 100644 --- a/dlls/ieframe/ieframe.h +++ b/dlls/ieframe/ieframe.h @@ -94,6 +94,10 @@ typedef struct { DocHost *doc_host; } NewWindowManager; +typedef struct { + WCHAR *url; +} travellog_entry_t; + typedef struct _IDocHostContainerVtbl { ULONG (*addref)(DocHost*); @@ -148,6 +152,11 @@ struct DocHost { ShellBrowser *browser_service; + travellog_entry_t *travellog; + unsigned travellog_size; + unsigned travellog_length; + unsigned travellog_position; + ConnectionPointContainer cps; IEHTMLWindow html_window; NewWindowManager nwm; @@ -253,6 +262,7 @@ void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*) DECLSPEC_HIDDEN; HRESULT navigate_url(DocHost*,LPCWSTR,const VARIANT*,const VARIANT*,VARIANT*,VARIANT*) DECLSPEC_HIDDEN; HRESULT go_home(DocHost*) DECLSPEC_HIDDEN; +HRESULT go_back(DocHost*) DECLSPEC_HIDDEN; HRESULT get_location_url(DocHost*,BSTR*) DECLSPEC_HIDDEN; HRESULT set_dochost_url(DocHost*,const WCHAR*) DECLSPEC_HIDDEN; void handle_navigation_error(DocHost*,HRESULT,BSTR,IHTMLWindow2*) DECLSPEC_HIDDEN; diff --git a/dlls/ieframe/navigate.c b/dlls/ieframe/navigate.c index 8d2636b7e35..dac10778fc8 100644 --- a/dlls/ieframe/navigate.c +++ b/dlls/ieframe/navigate.c @@ -994,6 +994,29 @@ HRESULT go_home(DocHost *This) return navigate_url(This, wszPageName, NULL, NULL, NULL, NULL); } +HRESULT go_back(DocHost *This) +{ + WCHAR *url; + HRESULT hres; + + if(!This->travellog_position) { + WARN("No history available\n"); + return E_FAIL; + } + + url = This->travellog[--This->travellog_position].url; + + if(This->doc_navigate) { + hres = async_doc_navigate(This, url, NULL, NULL, 0, FALSE); + }else { + FIXME("unsupported doc_navigate FALSE\n"); + hres = E_NOTIMPL; + } + + heap_free(url); + return hres; +} + HRESULT get_location_url(DocHost *This, BSTR *ret) { FIXME("semi-stub\n"); diff --git a/dlls/ieframe/webbrowser.c b/dlls/ieframe/webbrowser.c index 2d4d8189ffd..48462078ede 100644 --- a/dlls/ieframe/webbrowser.c +++ b/dlls/ieframe/webbrowser.c @@ -251,8 +251,8 @@ static HRESULT WINAPI WebBrowser_Invoke(IWebBrowser2 *iface, DISPID dispIdMember static HRESULT WINAPI WebBrowser_GoBack(IWebBrowser2 *iface) { WebBrowser *This = impl_from_IWebBrowser2(iface); - FIXME("(%p)\n", This); - return E_NOTIMPL; + TRACE("(%p)\n", This); + return go_back(&This->doc_host); } static HRESULT WINAPI WebBrowser_GoForward(IWebBrowser2 *iface)