Commit 019a1af7 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

mshtml: Added IOmHistory::get_length implementation.

parent 47c6310e
...@@ -264,8 +264,12 @@ static void release_inner_window(HTMLInnerWindow *This) ...@@ -264,8 +264,12 @@ static void release_inner_window(HTMLInnerWindow *This)
if(This->screen) if(This->screen)
IHTMLScreen_Release(This->screen); IHTMLScreen_Release(This->screen);
if(This->history)
IOmHistory_Release(This->history); if(This->history) {
This->history->window = NULL;
IOmHistory_Release(&This->history->IOmHistory_iface);
}
if(This->mon) if(This->mon)
IMoniker_Release(This->mon); IMoniker_Release(This->mon);
...@@ -763,13 +767,13 @@ static HRESULT WINAPI HTMLWindow2_get_history(IHTMLWindow2 *iface, IOmHistory ** ...@@ -763,13 +767,13 @@ static HRESULT WINAPI HTMLWindow2_get_history(IHTMLWindow2 *iface, IOmHistory **
if(!window->history) { if(!window->history) {
HRESULT hres; HRESULT hres;
hres = create_history(&window->history); hres = create_history(window, &window->history);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
} }
IOmHistory_AddRef(window->history); IOmHistory_AddRef(&window->history->IOmHistory_iface);
*p = window->history; *p = &window->history->IOmHistory_iface;
return S_OK; return S_OK;
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "objsafe.h" #include "objsafe.h"
#include "htiframe.h" #include "htiframe.h"
#include "tlogstg.h" #include "tlogstg.h"
#include "shdeprecated.h"
#include "wine/list.h" #include "wine/list.h"
#include "wine/unicode.h" #include "wine/unicode.h"
...@@ -339,6 +340,15 @@ struct HTMLLocation { ...@@ -339,6 +340,15 @@ struct HTMLLocation {
}; };
typedef struct { typedef struct {
DispatchEx dispex;
IOmHistory IOmHistory_iface;
LONG ref;
HTMLInnerWindow *window;
} OmHistory;
typedef struct {
HTMLOuterWindow *window; HTMLOuterWindow *window;
LONG ref; LONG ref;
} windowref_t; } windowref_t;
...@@ -403,7 +413,7 @@ struct HTMLInnerWindow { ...@@ -403,7 +413,7 @@ struct HTMLInnerWindow {
HTMLImageElementFactory *image_factory; HTMLImageElementFactory *image_factory;
HTMLOptionElementFactory *option_factory; HTMLOptionElementFactory *option_factory;
IHTMLScreen *screen; IHTMLScreen *screen;
IOmHistory *history; OmHistory *history;
IHTMLStorage *session_storage; IHTMLStorage *session_storage;
unsigned parser_callback_cnt; unsigned parser_callback_cnt;
...@@ -545,6 +555,8 @@ struct HTMLDocumentObj { ...@@ -545,6 +555,8 @@ struct HTMLDocumentObj {
IAdviseSink *view_sink; IAdviseSink *view_sink;
IDocObjectService *doc_object_service; IDocObjectService *doc_object_service;
IUnknown *webbrowser; IUnknown *webbrowser;
ITravelLog *travel_log;
IUnknown *browser_service;
DOCHOSTUIINFO hostinfo; DOCHOSTUIINFO hostinfo;
...@@ -738,7 +750,7 @@ HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory* ...@@ -738,7 +750,7 @@ HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory*
HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN; HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN; IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN; HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
HRESULT create_history(IOmHistory**) DECLSPEC_HIDDEN; HRESULT create_history(HTMLInnerWindow*,OmHistory**) DECLSPEC_HIDDEN;
HRESULT create_storage(IHTMLStorage**) DECLSPEC_HIDDEN; HRESULT create_storage(IHTMLStorage**) DECLSPEC_HIDDEN;
......
...@@ -215,6 +215,7 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite ...@@ -215,6 +215,7 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
HTMLDocument *This = impl_from_IOleObject(iface); HTMLDocument *This = impl_from_IOleObject(iface);
IOleCommandTarget *cmdtrg = NULL; IOleCommandTarget *cmdtrg = NULL;
IOleWindow *ole_window; IOleWindow *ole_window;
IBrowserService *browser_service;
BOOL hostui_setup; BOOL hostui_setup;
VARIANT silent; VARIANT silent;
HWND hwnd; HWND hwnd;
...@@ -251,6 +252,16 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite ...@@ -251,6 +252,16 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
This->doc_obj->webbrowser = NULL; This->doc_obj->webbrowser = NULL;
} }
if(This->doc_obj->browser_service) {
IUnknown_Release(This->doc_obj->browser_service);
This->doc_obj->browser_service = NULL;
}
if(This->doc_obj->travel_log) {
ITravelLog_Release(This->doc_obj->travel_log);
This->doc_obj->travel_log = NULL;
}
memset(&This->doc_obj->hostinfo, 0, sizeof(DOCHOSTUIINFO)); memset(&This->doc_obj->hostinfo, 0, sizeof(DOCHOSTUIINFO));
if(!pClientSite) if(!pClientSite)
...@@ -323,6 +334,20 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite ...@@ -323,6 +334,20 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
IOleWindow_Release(ole_window); IOleWindow_Release(ole_window);
} }
hres = do_query_service((IUnknown*)pClientSite, &IID_IShellBrowser,
&IID_IBrowserService, (void**)&browser_service);
if(SUCCEEDED(hres)) {
ITravelLog *travel_log;
This->doc_obj->browser_service = (IUnknown*)browser_service;
hres = IBrowserService_GetTravelLog(browser_service, &travel_log);
if(SUCCEEDED(hres))
This->doc_obj->travel_log = travel_log;
}else {
browser_service = NULL;
}
hres = IOleClientSite_QueryInterface(pClientSite, &IID_IOleCommandTarget, (void**)&cmdtrg); hres = IOleClientSite_QueryInterface(pClientSite, &IID_IOleCommandTarget, (void**)&cmdtrg);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
VARIANT var; VARIANT var;
...@@ -332,16 +357,13 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite ...@@ -332,16 +357,13 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
if(!hostui_setup) { if(!hostui_setup) {
IDocObjectService *doc_object_service; IDocObjectService *doc_object_service;
IBrowserService *browser_service;
IWebBrowser2 *wb; IWebBrowser2 *wb;
V_VT(&var) = VT_UNKNOWN; V_VT(&var) = VT_UNKNOWN;
V_UNKNOWN(&var) = (IUnknown*)&This->window->base.IHTMLWindow2_iface; V_UNKNOWN(&var) = (IUnknown*)&This->window->base.IHTMLWindow2_iface;
IOleCommandTarget_Exec(cmdtrg, &CGID_DocHostCmdPriv, DOCHOST_DOCCANNAVIGATE, 0, &var, NULL); IOleCommandTarget_Exec(cmdtrg, &CGID_DocHostCmdPriv, DOCHOST_DOCCANNAVIGATE, 0, &var, NULL);
hres = do_query_service((IUnknown*)pClientSite, &IID_IShellBrowser, if(browser_service) {
&IID_IBrowserService, (void**)&browser_service);
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)) {
...@@ -354,7 +376,6 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite ...@@ -354,7 +376,6 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
hres = do_query_service((IUnknown*)pClientSite, &IID_IWebBrowserApp, &IID_IWebBrowser2, (void**)&wb); hres = do_query_service((IUnknown*)pClientSite, &IID_IWebBrowserApp, &IID_IWebBrowser2, (void**)&wb);
if(SUCCEEDED(hres)) if(SUCCEEDED(hres))
This->doc_obj->webbrowser = (IUnknown*)wb; This->doc_obj->webbrowser = (IUnknown*)wb;
IBrowserService_Release(browser_service);
} }
} }
} }
......
...@@ -44,13 +44,6 @@ typedef struct { ...@@ -44,13 +44,6 @@ typedef struct {
HTMLMimeTypesCollection *mime_types; HTMLMimeTypesCollection *mime_types;
} OmNavigator; } OmNavigator;
typedef struct {
DispatchEx dispex;
IOmHistory IOmHistory_iface;
LONG ref;
} OmHistory;
static inline OmHistory *impl_from_IOmHistory(IOmHistory *iface) static inline OmHistory *impl_from_IOmHistory(IOmHistory *iface)
{ {
return CONTAINING_RECORD(iface, OmHistory, IOmHistory_iface); return CONTAINING_RECORD(iface, OmHistory, IOmHistory_iface);
...@@ -142,8 +135,17 @@ static HRESULT WINAPI OmHistory_Invoke(IOmHistory *iface, DISPID dispIdMember, R ...@@ -142,8 +135,17 @@ static HRESULT WINAPI OmHistory_Invoke(IOmHistory *iface, DISPID dispIdMember, R
static HRESULT WINAPI OmHistory_get_length(IOmHistory *iface, short *p) static HRESULT WINAPI OmHistory_get_length(IOmHistory *iface, short *p)
{ {
OmHistory *This = impl_from_IOmHistory(iface); OmHistory *This = impl_from_IOmHistory(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL; TRACE("(%p)->(%p)\n", This, p);
if(!This->window || !This->window->base.outer_window->doc_obj
|| !This->window->base.outer_window->doc_obj->travel_log) {
*p = 0;
}else {
*p = ITravelLog_CountEntries(This->window->base.outer_window->doc_obj->travel_log,
This->window->base.outer_window->doc_obj->browser_service);
}
return S_OK;
} }
static HRESULT WINAPI OmHistory_back(IOmHistory *iface, VARIANT *pvargdistance) static HRESULT WINAPI OmHistory_back(IOmHistory *iface, VARIANT *pvargdistance)
...@@ -193,7 +195,7 @@ static dispex_static_data_t OmHistory_dispex = { ...@@ -193,7 +195,7 @@ static dispex_static_data_t OmHistory_dispex = {
}; };
HRESULT create_history(IOmHistory **ret) HRESULT create_history(HTMLInnerWindow *window, OmHistory **ret)
{ {
OmHistory *history; OmHistory *history;
...@@ -205,7 +207,9 @@ HRESULT create_history(IOmHistory **ret) ...@@ -205,7 +207,9 @@ HRESULT create_history(IOmHistory **ret)
history->IOmHistory_iface.lpVtbl = &OmHistoryVtbl; history->IOmHistory_iface.lpVtbl = &OmHistoryVtbl;
history->ref = 1; history->ref = 1;
*ret = &history->IOmHistory_iface; history->window = window;
*ret = history;
return S_OK; return S_OK;
} }
......
...@@ -5291,7 +5291,7 @@ static void test_Load(IPersistMoniker *persist, IMoniker *mon) ...@@ -5291,7 +5291,7 @@ static void test_Load(IPersistMoniker *persist, IMoniker *mon)
CHECK_CALLED(Exec_ShellDocView_37); CHECK_CALLED(Exec_ShellDocView_37);
todo_wine CHECK_CALLED_BROKEN(IsErrorUrl); todo_wine CHECK_CALLED_BROKEN(IsErrorUrl);
}else { }else {
todo_wine CHECK_CALLED(GetTravelLog); CHECK_CALLED(GetTravelLog);
} }
CHECK_CALLED_BROKEN(Exec_ShellDocView_84); CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
todo_wine CHECK_CALLED(GetPendingUrl); todo_wine CHECK_CALLED(GetPendingUrl);
...@@ -6377,7 +6377,7 @@ static void test_ClientSite(IOleObject *oleobj, DWORD flags) ...@@ -6377,7 +6377,7 @@ static void test_ClientSite(IOleObject *oleobj, DWORD flags)
CHECK_CALLED(Invoke_AMBIENT_USERAGENT); CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
CLEAR_CALLED(Invoke_AMBIENT_PALETTE); /* not called on IE9 */ CLEAR_CALLED(Invoke_AMBIENT_PALETTE); /* not called on IE9 */
CLEAR_CALLED(GetOverrideKeyPath); /* Called by IE9 */ CLEAR_CALLED(GetOverrideKeyPath); /* Called by IE9 */
todo_wine CHECK_CALLED(GetTravelLog); CHECK_CALLED(GetTravelLog);
CHECK_CALLED_BROKEN(Exec_ShellDocView_84); CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
set_clientsite = TRUE; set_clientsite = TRUE;
...@@ -7706,7 +7706,7 @@ static void test_UIActivate(BOOL do_load, BOOL use_ipsex, BOOL use_ipsw) ...@@ -7706,7 +7706,7 @@ static void test_UIActivate(BOOL do_load, BOOL use_ipsex, BOOL use_ipsw)
CHECK_CALLED(QueryStatus_SETPROGRESSTEXT); CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
CHECK_CALLED(Exec_SETPROGRESSMAX); CHECK_CALLED(Exec_SETPROGRESSMAX);
CHECK_CALLED(Exec_SETPROGRESSPOS); CHECK_CALLED(Exec_SETPROGRESSPOS);
todo_wine CHECK_CALLED(GetTravelLog); CHECK_CALLED(GetTravelLog);
CHECK_CALLED_BROKEN(Exec_ShellDocView_84); CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite); hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
......
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