Jacek Caban : shdocvw: Store IDocHostUIHandler interface in the
WebBrowser object.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Jan 25 06:22:35 CST 2006
Module: wine
Branch: refs/heads/master
Commit: 9cbe52b111b774c3482973b7fc1363c875c15501
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=9cbe52b111b774c3482973b7fc1363c875c15501
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Jan 25 13:14:57 2006 +0100
shdocvw: Store IDocHostUIHandler interface in the WebBrowser object.
---
dlls/shdocvw/dochost.c | 31 +++++++++----------------------
dlls/shdocvw/oleobject.c | 8 ++++++++
dlls/shdocvw/shdocvw.h | 2 ++
3 files changed, 19 insertions(+), 22 deletions(-)
diff --git a/dlls/shdocvw/dochost.c b/dlls/shdocvw/dochost.c
index 57b8660..0ac1fcc 100644
--- a/dlls/shdocvw/dochost.c
+++ b/dlls/shdocvw/dochost.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2005 Jacek Caban for CodeWeavers
+ * Copyright 2005-2006 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -239,19 +239,14 @@ static HRESULT WINAPI DocHostUIHandler_G
DOCHOSTUIINFO *pInfo)
{
WebBrowser *This = DOCHOSTUI_THIS(iface);
- IDocHostUIHandler *handler;
HRESULT hres;
TRACE("(%p)->(%p)\n", This, pInfo);
- if(This->client) {
- hres = IOleClientSite_QueryInterface(This->client, &IID_IDocHostUIHandler, (void**)&handler);
- if(SUCCEEDED(hres)) {
- hres = IDocHostUIHandler_GetHostInfo(handler, pInfo);
- IDocHostUIHandler_Release(handler);
- if(SUCCEEDED(hres))
- return hres;
- }
+ if(This->hostui) {
+ hres = IDocHostUIHandler_GetHostInfo(This->hostui, pInfo);
+ if(SUCCEEDED(hres))
+ return hres;
}
pInfo->dwFlags = DOCHOSTUIFLAG_DISABLE_HELP_MENU | DOCHOSTUIFLAG_OPENNEWWIN
@@ -328,21 +323,11 @@ static HRESULT WINAPI DocHostUIHandler_G
LPOLESTR *pchKey, DWORD dw)
{
WebBrowser *This = DOCHOSTUI_THIS(iface);
- IDocHostUIHandler *handler;
- HRESULT hres;
TRACE("(%p)->(%p %ld)\n", This, pchKey, dw);
- if(!This->client)
- return S_OK;
-
- hres = IOleClientSite_QueryInterface(This->client, &IID_IDocHostUIHandler,
- (void**)&handler);
- if(SUCCEEDED(hres)) {
- hres = IDocHostUIHandler_GetOptionKeyPath(handler, pchKey, dw);
- IDocHostUIHandler_Release(handler);
- return hres;
- }
+ if(This->hostui)
+ return IDocHostUIHandler_GetOptionKeyPath(This->hostui, pchKey, dw);
return S_OK;
}
@@ -430,5 +415,7 @@ void WebBrowser_DocHost_Init(WebBrowser
{
This->lpDocHostUIHandlerVtbl = &DocHostUIHandler2Vtbl;
+ This->hostui = NULL;
+
This->doc_view_hwnd = NULL;
}
diff --git a/dlls/shdocvw/oleobject.c b/dlls/shdocvw/oleobject.c
index 656fe0d..4f41da3 100644
--- a/dlls/shdocvw/oleobject.c
+++ b/dlls/shdocvw/oleobject.c
@@ -124,6 +124,7 @@ static ULONG WINAPI OleObject_Release(IO
static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE pClientSite)
{
WebBrowser *This = OLEOBJ_THIS(iface);
+ HRESULT hres;
TRACE("(%p)->(%p)\n", This, pClientSite);
@@ -139,6 +140,8 @@ static HRESULT WINAPI OleObject_SetClien
This->shell_embedding_hwnd = NULL;
}
+ if(This->hostui)
+ IDocHostUIHandler_Release(This->hostui);
if(This->client)
IOleClientSite_Release(This->client);
@@ -152,6 +155,11 @@ static HRESULT WINAPI OleObject_SetClien
This->client = pClientSite;
IOleClientSite_AddRef(pClientSite);
+ hres = IOleClientSite_QueryInterface(This->client, &IID_IDocHostUIHandler,
+ (void**)&This->hostui);
+ if(FAILED(hres))
+ This->hostui = NULL;
+
create_shell_embedding_hwnd(This);
return S_OK;
diff --git a/dlls/shdocvw/shdocvw.h b/dlls/shdocvw/shdocvw.h
index 49508b8..1aa8480 100644
--- a/dlls/shdocvw/shdocvw.h
+++ b/dlls/shdocvw/shdocvw.h
@@ -2,6 +2,7 @@
* Header includes for shdocvw.dll
*
* Copyright 2001 John R. Sheets (for CodeWeavers)
+ * Copyright 2005-2006 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -94,6 +95,7 @@ typedef struct {
IOleClientSite *client;
IOleContainer *container;
IOleDocumentView *view;
+ IDocHostUIHandler *hostui;
LPOLESTR url;
More information about the wine-cvs
mailing list