mshtml: Added IOmHistory::get_length implementation.

oldstable
Piotr Caban 2013-04-23 16:21:04 +02:00 committed by Alexandre Julliard
parent 47c6310e46
commit 019a1af76e
5 changed files with 67 additions and 26 deletions

View File

@ -264,8 +264,12 @@ static void release_inner_window(HTMLInnerWindow *This)
if(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)
IMoniker_Release(This->mon);
@ -763,13 +767,13 @@ static HRESULT WINAPI HTMLWindow2_get_history(IHTMLWindow2 *iface, IOmHistory **
if(!window->history) {
HRESULT hres;
hres = create_history(&window->history);
hres = create_history(window, &window->history);
if(FAILED(hres))
return hres;
}
IOmHistory_AddRef(window->history);
*p = window->history;
IOmHistory_AddRef(&window->history->IOmHistory_iface);
*p = &window->history->IOmHistory_iface;
return S_OK;
}

View File

@ -28,6 +28,7 @@
#include "objsafe.h"
#include "htiframe.h"
#include "tlogstg.h"
#include "shdeprecated.h"
#include "wine/list.h"
#include "wine/unicode.h"
@ -338,6 +339,15 @@ struct HTMLLocation {
HTMLInnerWindow *window;
};
typedef struct {
DispatchEx dispex;
IOmHistory IOmHistory_iface;
LONG ref;
HTMLInnerWindow *window;
} OmHistory;
typedef struct {
HTMLOuterWindow *window;
LONG ref;
@ -403,7 +413,7 @@ struct HTMLInnerWindow {
HTMLImageElementFactory *image_factory;
HTMLOptionElementFactory *option_factory;
IHTMLScreen *screen;
IOmHistory *history;
OmHistory *history;
IHTMLStorage *session_storage;
unsigned parser_callback_cnt;
@ -545,6 +555,8 @@ struct HTMLDocumentObj {
IAdviseSink *view_sink;
IDocObjectService *doc_object_service;
IUnknown *webbrowser;
ITravelLog *travel_log;
IUnknown *browser_service;
DOCHOSTUIINFO hostinfo;
@ -738,7 +750,7 @@ HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory*
HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
IOmNavigator *OmNavigator_Create(void) 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;

View File

@ -215,6 +215,7 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
HTMLDocument *This = impl_from_IOleObject(iface);
IOleCommandTarget *cmdtrg = NULL;
IOleWindow *ole_window;
IBrowserService *browser_service;
BOOL hostui_setup;
VARIANT silent;
HWND hwnd;
@ -251,6 +252,16 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
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));
if(!pClientSite)
@ -323,6 +334,20 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
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);
if(SUCCEEDED(hres)) {
VARIANT var;
@ -332,16 +357,13 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
if(!hostui_setup) {
IDocObjectService *doc_object_service;
IBrowserService *browser_service;
IWebBrowser2 *wb;
V_VT(&var) = VT_UNKNOWN;
V_UNKNOWN(&var) = (IUnknown*)&This->window->base.IHTMLWindow2_iface;
IOleCommandTarget_Exec(cmdtrg, &CGID_DocHostCmdPriv, DOCHOST_DOCCANNAVIGATE, 0, &var, NULL);
hres = do_query_service((IUnknown*)pClientSite, &IID_IShellBrowser,
&IID_IBrowserService, (void**)&browser_service);
if(SUCCEEDED(hres)) {
if(browser_service) {
hres = IBrowserService_QueryInterface(browser_service,
&IID_IDocObjectService, (void**)&doc_object_service);
if(SUCCEEDED(hres)) {
@ -354,7 +376,6 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
hres = do_query_service((IUnknown*)pClientSite, &IID_IWebBrowserApp, &IID_IWebBrowser2, (void**)&wb);
if(SUCCEEDED(hres))
This->doc_obj->webbrowser = (IUnknown*)wb;
IBrowserService_Release(browser_service);
}
}
}

View File

@ -44,13 +44,6 @@ typedef struct {
HTMLMimeTypesCollection *mime_types;
} OmNavigator;
typedef struct {
DispatchEx dispex;
IOmHistory IOmHistory_iface;
LONG ref;
} OmHistory;
static inline OmHistory *impl_from_IOmHistory(IOmHistory *iface)
{
return CONTAINING_RECORD(iface, OmHistory, IOmHistory_iface);
@ -142,8 +135,17 @@ static HRESULT WINAPI OmHistory_Invoke(IOmHistory *iface, DISPID dispIdMember, R
static HRESULT WINAPI OmHistory_get_length(IOmHistory *iface, short *p)
{
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)
@ -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;
@ -205,7 +207,9 @@ HRESULT create_history(IOmHistory **ret)
history->IOmHistory_iface.lpVtbl = &OmHistoryVtbl;
history->ref = 1;
*ret = &history->IOmHistory_iface;
history->window = window;
*ret = history;
return S_OK;
}

View File

@ -5291,7 +5291,7 @@ static void test_Load(IPersistMoniker *persist, IMoniker *mon)
CHECK_CALLED(Exec_ShellDocView_37);
todo_wine CHECK_CALLED_BROKEN(IsErrorUrl);
}else {
todo_wine CHECK_CALLED(GetTravelLog);
CHECK_CALLED(GetTravelLog);
}
CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
todo_wine CHECK_CALLED(GetPendingUrl);
@ -6377,7 +6377,7 @@ static void test_ClientSite(IOleObject *oleobj, DWORD flags)
CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
CLEAR_CALLED(Invoke_AMBIENT_PALETTE); /* not called on IE9 */
CLEAR_CALLED(GetOverrideKeyPath); /* Called by IE9 */
todo_wine CHECK_CALLED(GetTravelLog);
CHECK_CALLED(GetTravelLog);
CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
set_clientsite = TRUE;
@ -7706,7 +7706,7 @@ static void test_UIActivate(BOOL do_load, BOOL use_ipsex, BOOL use_ipsw)
CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
CHECK_CALLED(Exec_SETPROGRESSMAX);
CHECK_CALLED(Exec_SETPROGRESSPOS);
todo_wine CHECK_CALLED(GetTravelLog);
CHECK_CALLED(GetTravelLog);
CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);