Jacek Caban : ieframe: Added very beginning IWebBrowser2:: GoBack implementation.
Alexandre Julliard
julliard at winehq.org
Fri Jan 20 13:09:31 CST 2012
Module: wine
Branch: master
Commit: 51c141ab4cd839b98cde41cc0d746f3fa69ff35a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=51c141ab4cd839b98cde41cc0d746f3fa69ff35a
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Jan 20 15:16:10 2012 +0100
ieframe: Added very beginning IWebBrowser2::GoBack implementation.
---
dlls/ieframe/dochost.c | 52 +++++++++++++++++++++++++++++++++++++++++++-
dlls/ieframe/ieframe.h | 10 ++++++++
dlls/ieframe/navigate.c | 23 +++++++++++++++++++
dlls/ieframe/webbrowser.c | 4 +-
4 files changed, 85 insertions(+), 4 deletions(-)
diff --git a/dlls/ieframe/dochost.c b/dlls/ieframe/dochost.c
index d59c335..6eb27ec 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 60a65fb..2953841 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 8d2636b..dac1077 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 2d4d818..4846207 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)
More information about the wine-cvs
mailing list