Commit 0bf9266b authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ieframe: Get rid of no longer needed IEDocHost.

parent b51af0b1
......@@ -50,7 +50,7 @@ static HRESULT WINAPI InternetExplorer_QueryInterface(IWebBrowser2 *iface, REFII
*ppv = &This->IWebBrowser2_iface;
}else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
*ppv = &This->doc_host->doc_host.cps.IConnectionPointContainer_iface;
*ppv = &This->doc_host.cps.IConnectionPointContainer_iface;
}else if(IsEqualGUID(&IID_IExternalConnection, riid)) {
TRACE("(%p)->(IID_IExternalConnection %p)\n", This, ppv);
*ppv = &This->IExternalConnection_iface;
......@@ -86,14 +86,8 @@ static ULONG WINAPI InternetExplorer_Release(IWebBrowser2 *iface)
TRACE("(%p) ref=%d\n", This, ref);
if(!ref) {
if(This->doc_host) {
deactivate_document(&This->doc_host->doc_host);
DocHost_Release(&This->doc_host->doc_host);
if(This->doc_host) {
This->doc_host->ie = NULL;
This->doc_host->doc_host.container_vtbl->release(&This->doc_host->doc_host);
}
}
deactivate_document(&This->doc_host);
DocHost_Release(&This->doc_host);
if(This->frame_hwnd)
DestroyWindow(This->frame_hwnd);
......@@ -146,21 +140,21 @@ static HRESULT WINAPI InternetExplorer_GoBack(IWebBrowser2 *iface)
{
InternetExplorer *This = impl_from_IWebBrowser2(iface);
TRACE("(%p)\n", This);
return go_back(&This->doc_host->doc_host);
return go_back(&This->doc_host);
}
static HRESULT WINAPI InternetExplorer_GoForward(IWebBrowser2 *iface)
{
InternetExplorer *This = impl_from_IWebBrowser2(iface);
TRACE("(%p)\n", This);
return go_forward(&This->doc_host->doc_host);
return go_forward(&This->doc_host);
}
static HRESULT WINAPI InternetExplorer_GoHome(IWebBrowser2 *iface)
{
InternetExplorer *This = impl_from_IWebBrowser2(iface);
TRACE("(%p)\n", This);
return go_home(&This->doc_host->doc_host);
return go_home(&This->doc_host);
}
static HRESULT WINAPI InternetExplorer_GoSearch(IWebBrowser2 *iface)
......@@ -179,7 +173,7 @@ static HRESULT WINAPI InternetExplorer_Navigate(IWebBrowser2 *iface, BSTR szUrl,
TRACE("(%p)->(%s %p %p %p %p)\n", This, debugstr_w(szUrl), Flags, TargetFrameName,
PostData, Headers);
return navigate_url(&This->doc_host->doc_host, szUrl, Flags, TargetFrameName, PostData, Headers);
return navigate_url(&This->doc_host, szUrl, Flags, TargetFrameName, PostData, Headers);
}
static HRESULT WINAPI InternetExplorer_Refresh(IWebBrowser2 *iface)
......@@ -188,7 +182,7 @@ static HRESULT WINAPI InternetExplorer_Refresh(IWebBrowser2 *iface)
TRACE("(%p)\n", This);
return refresh_document(&This->doc_host->doc_host);
return refresh_document(&This->doc_host);
}
static HRESULT WINAPI InternetExplorer_Refresh2(IWebBrowser2 *iface, VARIANT *Level)
......@@ -316,7 +310,7 @@ static HRESULT WINAPI InternetExplorer_get_LocationURL(IWebBrowser2 *iface, BSTR
TRACE("(%p)->(%p)\n", This, LocationURL);
return get_location_url(&This->doc_host->doc_host, LocationURL);
return get_location_url(&This->doc_host, LocationURL);
}
static HRESULT WINAPI InternetExplorer_get_Busy(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
......@@ -498,7 +492,7 @@ static HRESULT WINAPI InternetExplorer_Navigate2(IWebBrowser2 *iface, VARIANT *U
return E_INVALIDARG;
}
return navigate_url(&This->doc_host->doc_host, V_BSTR(URL), Flags, TargetFrameName, PostData, Headers);
return navigate_url(&This->doc_host, V_BSTR(URL), Flags, TargetFrameName, PostData, Headers);
}
static HRESULT WINAPI InternetExplorer_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
......@@ -733,8 +727,7 @@ DWORD release_extern_ref(InternetExplorer *This, BOOL last_closes)
return ref;
}
if(This->doc_host)
deactivate_document(&This->doc_host->doc_host);
deactivate_document(&This->doc_host);
return ref;
}
......@@ -820,7 +813,7 @@ static HRESULT WINAPI IEServiceProvider_QueryService(IServiceProvider *iface,
if(IsEqualGUID(&SID_SHTMLWindow, riid)) {
TRACE("(%p)->(SID_SHTMLWindow)\n", This);
return IHTMLWindow2_QueryInterface(&This->doc_host->doc_host.html_window.IHTMLWindow2_iface, riid, ppv);
return IHTMLWindow2_QueryInterface(&This->doc_host.html_window.IHTMLWindow2_iface, riid, ppv);
}
FIXME("(%p)->(%s, %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
......
......@@ -214,15 +214,8 @@ struct WebBrowser {
DocHost doc_host;
};
typedef struct {
DocHost doc_host;
LONG ref;
InternetExplorer *ie;
} IEDocHost;
struct InternetExplorer {
DocHost doc_host;
IWebBrowser2 IWebBrowser2_iface;
IExternalConnection IExternalConnection_iface;
IServiceProvider IServiceProvider_iface;
......@@ -237,7 +230,6 @@ struct InternetExplorer {
BOOL nohome;
struct list entry;
IEDocHost *doc_host;
};
void WebBrowser_OleObject_Init(WebBrowser*) DECLSPEC_HIDDEN;
......
......@@ -518,8 +518,8 @@ static LRESULT iewnd_OnSize(InternetExplorer *This, INT width, INT height)
adjust_ie_docobj_rect(This->frame_hwnd, &docarea);
if(This->doc_host->doc_host.hwnd)
SetWindowPos(This->doc_host->doc_host.hwnd, NULL, docarea.left, docarea.top, docarea.right, docarea.bottom,
if(This->doc_host.hwnd)
SetWindowPos(This->doc_host.hwnd, NULL, docarea.left, docarea.top, docarea.right, docarea.bottom,
SWP_NOZORDER | SWP_NOACTIVATE);
SetWindowPos(hwndRebar, NULL, 0, 0, width, barHeight, SWP_NOZORDER | SWP_NOACTIVATE);
......@@ -557,8 +557,8 @@ static LRESULT iewnd_OnNotify(InternetExplorer *This, WPARAM wparam, LPARAM lpar
GetClientRect(This->frame_hwnd, &docarea);
adjust_ie_docobj_rect(This->frame_hwnd, &docarea);
if(This->doc_host->doc_host.hwnd)
SetWindowPos(This->doc_host->doc_host.hwnd, NULL, docarea.left, docarea.top, docarea.right, docarea.bottom,
if(This->doc_host.hwnd)
SetWindowPos(This->doc_host.hwnd, NULL, docarea.left, docarea.top, docarea.right, docarea.bottom,
SWP_NOZORDER | SWP_NOACTIVATE);
}
......@@ -589,11 +589,11 @@ static LRESULT iewnd_OnCommand(InternetExplorer *This, HWND hwnd, UINT msg, WPAR
break;
case ID_BROWSE_PRINT:
if(This->doc_host->doc_host.document)
if(This->doc_host.document)
{
IOleCommandTarget* target;
if(FAILED(IUnknown_QueryInterface(This->doc_host->doc_host.document, &IID_IOleCommandTarget, (LPVOID*)&target)))
if(FAILED(IUnknown_QueryInterface(This->doc_host.document, &IID_IOleCommandTarget, (LPVOID*)&target)))
break;
IOleCommandTarget_Exec(target, &CGID_MSHTML, IDM_PRINT, OLECMDEXECOPT_DODEFAULT, NULL, NULL);
......@@ -686,7 +686,7 @@ static LRESULT WINAPI ie_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM
case WM_NOTIFY:
return iewnd_OnNotify(This, wparam, lparam);
case WM_DOCHOSTTASK:
return process_dochost_tasks(&This->doc_host->doc_host);
return process_dochost_tasks(&This->doc_host);
case WM_UPDATEADDRBAR:
return update_addrbar(This, lparam);
}
......@@ -730,39 +730,25 @@ static void create_frame_hwnd(InternetExplorer *This)
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL /* FIXME */, ieframe_instance, This);
This->doc_host->doc_host.frame_hwnd = This->frame_hwnd;
create_doc_view_hwnd(&This->doc_host->doc_host);
This->doc_host.frame_hwnd = This->frame_hwnd;
create_doc_view_hwnd(&This->doc_host);
}
static inline IEDocHost *impl_from_DocHost(DocHost *iface)
static inline InternetExplorer *impl_from_DocHost(DocHost *iface)
{
return CONTAINING_RECORD(iface, IEDocHost, doc_host);
return CONTAINING_RECORD(iface, InternetExplorer, doc_host);
}
static ULONG IEDocHost_addref(DocHost *iface)
{
IEDocHost *This = impl_from_DocHost(iface);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
return ref;
InternetExplorer *This = impl_from_DocHost(iface);
return IWebBrowser2_AddRef(&This->IWebBrowser2_iface);
}
static ULONG IEDocHost_release(DocHost *iface)
{
IEDocHost *This = impl_from_DocHost(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
if(!ref) {
if(This->ie)
ERR("This->ie is not NULL\n");
heap_free(This);
}
return ref;
InternetExplorer *This = impl_from_DocHost(iface);
return IWebBrowser2_Release(&This->IWebBrowser2_iface);
}
static void WINAPI DocHostContainer_GetDocObjRect(DocHost* This, RECT* rc)
......@@ -773,19 +759,16 @@ static void WINAPI DocHostContainer_GetDocObjRect(DocHost* This, RECT* rc)
static HRESULT WINAPI DocHostContainer_SetStatusText(DocHost *iface, LPCWSTR text)
{
IEDocHost *This = impl_from_DocHost(iface);
return update_ie_statustext(This->ie, text);
InternetExplorer *This = impl_from_DocHost(iface);
return update_ie_statustext(This, text);
}
static void WINAPI DocHostContainer_SetURL(DocHost* iface, LPCWSTR url)
{
IEDocHost *This = impl_from_DocHost(iface);
InternetExplorer *This = impl_from_DocHost(iface);
if(!This->ie)
return;
This->ie->nohome = FALSE;
SendMessageW(This->ie->frame_hwnd, WM_UPDATEADDRBAR, 0, (LPARAM)url);
This->nohome = FALSE;
SendMessageW(This->frame_hwnd, WM_UPDATEADDRBAR, 0, (LPARAM)url);
}
static HRESULT DocHostContainer_exec(DocHost* This, const GUID *cmd_group, DWORD cmdid, DWORD execopt, VARIANT *in,
......@@ -811,21 +794,13 @@ static HRESULT create_ie(InternetExplorer **ret_obj)
if(!ret)
return E_OUTOFMEMORY;
ret->doc_host = heap_alloc_zero(sizeof(IEDocHost));
if(!ret->doc_host) {
heap_free(ret);
return E_OUTOFMEMORY;
}
ret->ref = 1;
ret->doc_host->ref = 1;
ret->doc_host->ie = ret;
DocHost_Init(&ret->doc_host->doc_host, &ret->IWebBrowser2_iface, &DocHostContainerVtbl);
DocHost_Init(&ret->doc_host, &ret->IWebBrowser2_iface, &DocHostContainerVtbl);
InternetExplorer_WebBrowser_Init(ret);
HlinkFrame_Init(&ret->hlink_frame, (IUnknown*)&ret->IWebBrowser2_iface, &ret->doc_host->doc_host);
HlinkFrame_Init(&ret->hlink_frame, (IUnknown*)&ret->IWebBrowser2_iface, &ret->doc_host);
create_frame_hwnd(ret);
......
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