Commit a14281c0 authored by Damjan Jovanovic's avatar Damjan Jovanovic Committed by Alexandre Julliard

ieframe: Implement COM aggregation in WebBrowser.

parent 2c708d8d
...@@ -37,19 +37,19 @@ static HRESULT WINAPI ProvideClassInfo_QueryInterface(IProvideClassInfo2 *iface, ...@@ -37,19 +37,19 @@ static HRESULT WINAPI ProvideClassInfo_QueryInterface(IProvideClassInfo2 *iface,
REFIID riid, LPVOID *ppobj) REFIID riid, LPVOID *ppobj)
{ {
WebBrowser *This = impl_from_IProvideClassInfo2(iface); WebBrowser *This = impl_from_IProvideClassInfo2(iface);
return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppobj); return IUnknown_QueryInterface(This->hlink_frame.outer, riid, ppobj);
} }
static ULONG WINAPI ProvideClassInfo_AddRef(IProvideClassInfo2 *iface) static ULONG WINAPI ProvideClassInfo_AddRef(IProvideClassInfo2 *iface)
{ {
WebBrowser *This = impl_from_IProvideClassInfo2(iface); WebBrowser *This = impl_from_IProvideClassInfo2(iface);
return IWebBrowser2_AddRef(&This->IWebBrowser2_iface); return IUnknown_AddRef(This->hlink_frame.outer);
} }
static ULONG WINAPI ProvideClassInfo_Release(IProvideClassInfo2 *iface) static ULONG WINAPI ProvideClassInfo_Release(IProvideClassInfo2 *iface)
{ {
WebBrowser *This = impl_from_IProvideClassInfo2(iface); WebBrowser *This = impl_from_IProvideClassInfo2(iface);
return IWebBrowser2_Release(&This->IWebBrowser2_iface); return IUnknown_Release(This->hlink_frame.outer);
} }
static HRESULT WINAPI ProvideClassInfo_GetClassInfo(IProvideClassInfo2 *iface, ITypeInfo **ppTI) static HRESULT WINAPI ProvideClassInfo_GetClassInfo(IProvideClassInfo2 *iface, ITypeInfo **ppTI)
......
...@@ -170,6 +170,7 @@ struct DocHost { ...@@ -170,6 +170,7 @@ struct DocHost {
}; };
struct WebBrowser { struct WebBrowser {
IUnknown IUnknown_inner;
IWebBrowser2 IWebBrowser2_iface; IWebBrowser2 IWebBrowser2_iface;
IOleObject IOleObject_iface; IOleObject IOleObject_iface;
IOleInPlaceObject IOleInPlaceObject_iface; IOleInPlaceObject IOleInPlaceObject_iface;
......
...@@ -439,19 +439,19 @@ static inline WebBrowser *impl_from_IOleObject(IOleObject *iface) ...@@ -439,19 +439,19 @@ static inline WebBrowser *impl_from_IOleObject(IOleObject *iface)
static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, void **ppv) static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, void **ppv)
{ {
WebBrowser *This = impl_from_IOleObject(iface); WebBrowser *This = impl_from_IOleObject(iface);
return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppv); return IUnknown_QueryInterface(This->hlink_frame.outer, riid, ppv);
} }
static ULONG WINAPI OleObject_AddRef(IOleObject *iface) static ULONG WINAPI OleObject_AddRef(IOleObject *iface)
{ {
WebBrowser *This = impl_from_IOleObject(iface); WebBrowser *This = impl_from_IOleObject(iface);
return IWebBrowser2_AddRef(&This->IWebBrowser2_iface); return IUnknown_AddRef(This->hlink_frame.outer);
} }
static ULONG WINAPI OleObject_Release(IOleObject *iface) static ULONG WINAPI OleObject_Release(IOleObject *iface)
{ {
WebBrowser *This = impl_from_IOleObject(iface); WebBrowser *This = impl_from_IOleObject(iface);
return IWebBrowser2_Release(&This->IWebBrowser2_iface); return IUnknown_Release(This->hlink_frame.outer);
} }
static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE pClientSite) static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE pClientSite)
...@@ -838,19 +838,19 @@ static HRESULT WINAPI OleInPlaceObject_QueryInterface(IOleInPlaceObject *iface, ...@@ -838,19 +838,19 @@ static HRESULT WINAPI OleInPlaceObject_QueryInterface(IOleInPlaceObject *iface,
REFIID riid, LPVOID *ppobj) REFIID riid, LPVOID *ppobj)
{ {
WebBrowser *This = impl_from_IOleInPlaceObject(iface); WebBrowser *This = impl_from_IOleInPlaceObject(iface);
return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppobj); return IUnknown_QueryInterface(This->hlink_frame.outer, riid, ppobj);
} }
static ULONG WINAPI OleInPlaceObject_AddRef(IOleInPlaceObject *iface) static ULONG WINAPI OleInPlaceObject_AddRef(IOleInPlaceObject *iface)
{ {
WebBrowser *This = impl_from_IOleInPlaceObject(iface); WebBrowser *This = impl_from_IOleInPlaceObject(iface);
return IWebBrowser2_AddRef(&This->IWebBrowser2_iface); return IUnknown_AddRef(This->hlink_frame.outer);
} }
static ULONG WINAPI OleInPlaceObject_Release(IOleInPlaceObject *iface) static ULONG WINAPI OleInPlaceObject_Release(IOleInPlaceObject *iface)
{ {
WebBrowser *This = impl_from_IOleInPlaceObject(iface); WebBrowser *This = impl_from_IOleInPlaceObject(iface);
return IWebBrowser2_Release(&This->IWebBrowser2_iface); return IUnknown_Release(This->hlink_frame.outer);
} }
static HRESULT WINAPI OleInPlaceObject_GetWindow(IOleInPlaceObject *iface, HWND* phwnd) static HRESULT WINAPI OleInPlaceObject_GetWindow(IOleInPlaceObject *iface, HWND* phwnd)
...@@ -947,19 +947,19 @@ static HRESULT WINAPI OleControl_QueryInterface(IOleControl *iface, ...@@ -947,19 +947,19 @@ static HRESULT WINAPI OleControl_QueryInterface(IOleControl *iface,
REFIID riid, LPVOID *ppobj) REFIID riid, LPVOID *ppobj)
{ {
WebBrowser *This = impl_from_IOleControl(iface); WebBrowser *This = impl_from_IOleControl(iface);
return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppobj); return IUnknown_QueryInterface(This->hlink_frame.outer, riid, ppobj);
} }
static ULONG WINAPI OleControl_AddRef(IOleControl *iface) static ULONG WINAPI OleControl_AddRef(IOleControl *iface)
{ {
WebBrowser *This = impl_from_IOleControl(iface); WebBrowser *This = impl_from_IOleControl(iface);
return IWebBrowser2_AddRef(&This->IWebBrowser2_iface); return IUnknown_AddRef(This->hlink_frame.outer);
} }
static ULONG WINAPI OleControl_Release(IOleControl *iface) static ULONG WINAPI OleControl_Release(IOleControl *iface)
{ {
WebBrowser *This = impl_from_IOleControl(iface); WebBrowser *This = impl_from_IOleControl(iface);
return IWebBrowser2_Release(&This->IWebBrowser2_iface); return IUnknown_Release(This->hlink_frame.outer);
} }
static HRESULT WINAPI OleControl_GetControlInfo(IOleControl *iface, LPCONTROLINFO pCI) static HRESULT WINAPI OleControl_GetControlInfo(IOleControl *iface, LPCONTROLINFO pCI)
...@@ -1030,19 +1030,19 @@ static HRESULT WINAPI InPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject ...@@ -1030,19 +1030,19 @@ static HRESULT WINAPI InPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject
REFIID riid, void **ppv) REFIID riid, void **ppv)
{ {
WebBrowser *This = impl_from_IOleInPlaceActiveObject(iface); WebBrowser *This = impl_from_IOleInPlaceActiveObject(iface);
return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppv); return IUnknown_QueryInterface(This->hlink_frame.outer, riid, ppv);
} }
static ULONG WINAPI InPlaceActiveObject_AddRef(IOleInPlaceActiveObject *iface) static ULONG WINAPI InPlaceActiveObject_AddRef(IOleInPlaceActiveObject *iface)
{ {
WebBrowser *This = impl_from_IOleInPlaceActiveObject(iface); WebBrowser *This = impl_from_IOleInPlaceActiveObject(iface);
return IWebBrowser2_AddRef(&This->IWebBrowser2_iface); return IUnknown_AddRef(This->hlink_frame.outer);
} }
static ULONG WINAPI InPlaceActiveObject_Release(IOleInPlaceActiveObject *iface) static ULONG WINAPI InPlaceActiveObject_Release(IOleInPlaceActiveObject *iface)
{ {
WebBrowser *This = impl_from_IOleInPlaceActiveObject(iface); WebBrowser *This = impl_from_IOleInPlaceActiveObject(iface);
return IWebBrowser2_Release(&This->IWebBrowser2_iface); return IUnknown_Release(This->hlink_frame.outer);
} }
static HRESULT WINAPI InPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *iface, static HRESULT WINAPI InPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *iface,
...@@ -1137,19 +1137,19 @@ static HRESULT WINAPI WBOleCommandTarget_QueryInterface(IOleCommandTarget *iface ...@@ -1137,19 +1137,19 @@ static HRESULT WINAPI WBOleCommandTarget_QueryInterface(IOleCommandTarget *iface
REFIID riid, void **ppv) REFIID riid, void **ppv)
{ {
WebBrowser *This = impl_from_IOleCommandTarget(iface); WebBrowser *This = impl_from_IOleCommandTarget(iface);
return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppv); return IUnknown_QueryInterface(This->hlink_frame.outer, riid, ppv);
} }
static ULONG WINAPI WBOleCommandTarget_AddRef(IOleCommandTarget *iface) static ULONG WINAPI WBOleCommandTarget_AddRef(IOleCommandTarget *iface)
{ {
WebBrowser *This = impl_from_IOleCommandTarget(iface); WebBrowser *This = impl_from_IOleCommandTarget(iface);
return IWebBrowser2_AddRef(&This->IWebBrowser2_iface); return IUnknown_AddRef(This->hlink_frame.outer);
} }
static ULONG WINAPI WBOleCommandTarget_Release(IOleCommandTarget *iface) static ULONG WINAPI WBOleCommandTarget_Release(IOleCommandTarget *iface)
{ {
WebBrowser *This = impl_from_IOleCommandTarget(iface); WebBrowser *This = impl_from_IOleCommandTarget(iface);
return IWebBrowser2_Release(&This->IWebBrowser2_iface); return IUnknown_Release(This->hlink_frame.outer);
} }
static HRESULT WINAPI WBOleCommandTarget_QueryStatus(IOleCommandTarget *iface, static HRESULT WINAPI WBOleCommandTarget_QueryStatus(IOleCommandTarget *iface,
......
...@@ -38,19 +38,19 @@ static HRESULT WINAPI PersistStorage_QueryInterface(IPersistStorage *iface, ...@@ -38,19 +38,19 @@ static HRESULT WINAPI PersistStorage_QueryInterface(IPersistStorage *iface,
REFIID riid, LPVOID *ppobj) REFIID riid, LPVOID *ppobj)
{ {
WebBrowser *This = impl_from_IPersistStorage(iface); WebBrowser *This = impl_from_IPersistStorage(iface);
return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppobj); return IUnknown_QueryInterface(This->hlink_frame.outer, riid, ppobj);
} }
static ULONG WINAPI PersistStorage_AddRef(IPersistStorage *iface) static ULONG WINAPI PersistStorage_AddRef(IPersistStorage *iface)
{ {
WebBrowser *This = impl_from_IPersistStorage(iface); WebBrowser *This = impl_from_IPersistStorage(iface);
return IWebBrowser2_AddRef(&This->IWebBrowser2_iface); return IUnknown_AddRef(This->hlink_frame.outer);
} }
static ULONG WINAPI PersistStorage_Release(IPersistStorage *iface) static ULONG WINAPI PersistStorage_Release(IPersistStorage *iface)
{ {
WebBrowser *This = impl_from_IPersistStorage(iface); WebBrowser *This = impl_from_IPersistStorage(iface);
return IWebBrowser2_Release(&This->IWebBrowser2_iface); return IUnknown_Release(This->hlink_frame.outer);
} }
static HRESULT WINAPI PersistStorage_GetClassID(IPersistStorage *iface, CLSID *pClassID) static HRESULT WINAPI PersistStorage_GetClassID(IPersistStorage *iface, CLSID *pClassID)
...@@ -122,19 +122,19 @@ static HRESULT WINAPI PersistMemory_QueryInterface(IPersistMemory *iface, ...@@ -122,19 +122,19 @@ static HRESULT WINAPI PersistMemory_QueryInterface(IPersistMemory *iface,
REFIID riid, LPVOID *ppobj) REFIID riid, LPVOID *ppobj)
{ {
WebBrowser *This = impl_from_IPersistMemory(iface); WebBrowser *This = impl_from_IPersistMemory(iface);
return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppobj); return IUnknown_QueryInterface(This->hlink_frame.outer, riid, ppobj);
} }
static ULONG WINAPI PersistMemory_AddRef(IPersistMemory *iface) static ULONG WINAPI PersistMemory_AddRef(IPersistMemory *iface)
{ {
WebBrowser *This = impl_from_IPersistMemory(iface); WebBrowser *This = impl_from_IPersistMemory(iface);
return IWebBrowser2_AddRef(&This->IWebBrowser2_iface); return IUnknown_AddRef(This->hlink_frame.outer);
} }
static ULONG WINAPI PersistMemory_Release(IPersistMemory *iface) static ULONG WINAPI PersistMemory_Release(IPersistMemory *iface)
{ {
WebBrowser *This = impl_from_IPersistMemory(iface); WebBrowser *This = impl_from_IPersistMemory(iface);
return IWebBrowser2_Release(&This->IWebBrowser2_iface); return IUnknown_Release(This->hlink_frame.outer);
} }
static HRESULT WINAPI PersistMemory_GetClassID(IPersistMemory *iface, CLSID *pClassID) static HRESULT WINAPI PersistMemory_GetClassID(IPersistMemory *iface, CLSID *pClassID)
...@@ -206,19 +206,19 @@ static HRESULT WINAPI PersistStreamInit_QueryInterface(IPersistStreamInit *iface ...@@ -206,19 +206,19 @@ static HRESULT WINAPI PersistStreamInit_QueryInterface(IPersistStreamInit *iface
REFIID riid, LPVOID *ppobj) REFIID riid, LPVOID *ppobj)
{ {
WebBrowser *This = impl_from_IPersistStreamInit(iface); WebBrowser *This = impl_from_IPersistStreamInit(iface);
return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppobj); return IUnknown_QueryInterface(This->hlink_frame.outer, riid, ppobj);
} }
static ULONG WINAPI PersistStreamInit_AddRef(IPersistStreamInit *iface) static ULONG WINAPI PersistStreamInit_AddRef(IPersistStreamInit *iface)
{ {
WebBrowser *This = impl_from_IPersistStreamInit(iface); WebBrowser *This = impl_from_IPersistStreamInit(iface);
return IWebBrowser2_AddRef(&This->IWebBrowser2_iface); return IUnknown_AddRef(This->hlink_frame.outer);
} }
static ULONG WINAPI PersistStreamInit_Release(IPersistStreamInit *iface) static ULONG WINAPI PersistStreamInit_Release(IPersistStreamInit *iface)
{ {
WebBrowser *This = impl_from_IPersistStreamInit(iface); WebBrowser *This = impl_from_IPersistStreamInit(iface);
return IWebBrowser2_Release(&This->IWebBrowser2_iface); return IUnknown_Release(This->hlink_frame.outer);
} }
static HRESULT WINAPI PersistStreamInit_GetClassID(IPersistStreamInit *iface, CLSID *pClassID) static HRESULT WINAPI PersistStreamInit_GetClassID(IPersistStreamInit *iface, CLSID *pClassID)
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "docobjectservice.h" #include "docobjectservice.h"
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
DEFINE_GUID(outer_test_iid,0x06d4cd6c,0x18dd,0x11ea,0x8e,0x76,0xfc,0xaa,0x14,0x72,0x2d,0xac);
DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0); DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
#define DEFINE_EXPECT(func) \ #define DEFINE_EXPECT(func) \
...@@ -155,6 +156,7 @@ DEFINE_EXPECT(ControlSite_TranslateAccelerator); ...@@ -155,6 +156,7 @@ DEFINE_EXPECT(ControlSite_TranslateAccelerator);
DEFINE_EXPECT(OnFocus_TRUE); DEFINE_EXPECT(OnFocus_TRUE);
DEFINE_EXPECT(OnFocus_FALSE); DEFINE_EXPECT(OnFocus_FALSE);
DEFINE_EXPECT(GetExternal); DEFINE_EXPECT(GetExternal);
DEFINE_EXPECT(outer_QI_test);
static const WCHAR wszItem[] = {'i','t','e','m',0}; static const WCHAR wszItem[] = {'i','t','e','m',0};
...@@ -4136,6 +4138,63 @@ static void test_SetAdvise(void) ...@@ -4136,6 +4138,63 @@ static void test_SetAdvise(void)
IWebBrowser2_Release(browser); IWebBrowser2_Release(browser);
} }
static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
{
if(IsEqualGUID(riid, &outer_test_iid)) {
CHECK_EXPECT(outer_QI_test);
*ppv = (IUnknown*)0xdeadbeef;
return S_OK;
}
ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
return E_NOINTERFACE;
}
static ULONG WINAPI outer_AddRef(IUnknown *iface)
{
return 2;
}
static ULONG WINAPI outer_Release(IUnknown *iface)
{
return 1;
}
static IUnknownVtbl outer_vtbl = {
outer_QueryInterface,
outer_AddRef,
outer_Release
};
static void test_com_aggregation(void)
{
HRESULT hr;
IClassFactory *class_factory;
IUnknown outer = { &outer_vtbl };
IUnknown *unk = NULL;
IWebBrowser *web_browser = NULL;
IUnknown *unk2 = NULL;
hr = CoGetClassObject(&CLSID_WebBrowser, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&class_factory);
ok(hr == S_OK, "CoGetClassObject failed: %08x\n", hr);
hr = IClassFactory_CreateInstance(class_factory, &outer, &IID_IUnknown, (void**)&unk);
ok(hr == S_OK, "CreateInstance returned hr = %08x\n", hr);
ok(unk != NULL, "result NULL, hr = %08x\n", hr);
hr = IUnknown_QueryInterface(unk, &IID_IWebBrowser, (void**)&web_browser);
ok(hr == S_OK, "QI to IWebBrowser failed, hr=%08x\n", hr);
SET_EXPECT(outer_QI_test);
hr = IWebBrowser_QueryInterface(web_browser, &outer_test_iid, (void**)&unk2);
CHECK_CALLED(outer_QI_test);
ok(hr == S_OK, "Could not get test iface: %08x\n", hr);
ok(unk2 == (IUnknown*)0xdeadbeef, "unexpected unk2\n");
IWebBrowser_Release(web_browser);
IUnknown_Release(unk);
IClassFactory_Release(class_factory);
}
START_TEST(webbrowser) START_TEST(webbrowser)
{ {
OleInitialize(NULL); OleInitialize(NULL);
...@@ -4167,6 +4226,7 @@ START_TEST(webbrowser) ...@@ -4167,6 +4226,7 @@ START_TEST(webbrowser)
test_FileProtocol(); test_FileProtocol();
trace("Testing SetAdvise...\n"); trace("Testing SetAdvise...\n");
test_SetAdvise(); test_SetAdvise();
test_com_aggregation();
OleUninitialize(); OleUninitialize();
} }
...@@ -35,19 +35,19 @@ static inline WebBrowser *impl_from_IViewObject2(IViewObject2 *iface) ...@@ -35,19 +35,19 @@ static inline WebBrowser *impl_from_IViewObject2(IViewObject2 *iface)
static HRESULT WINAPI ViewObject_QueryInterface(IViewObject2 *iface, REFIID riid, void **ppv) static HRESULT WINAPI ViewObject_QueryInterface(IViewObject2 *iface, REFIID riid, void **ppv)
{ {
WebBrowser *This = impl_from_IViewObject2(iface); WebBrowser *This = impl_from_IViewObject2(iface);
return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppv); return IUnknown_QueryInterface(This->hlink_frame.outer, riid, ppv);
} }
static ULONG WINAPI ViewObject_AddRef(IViewObject2 *iface) static ULONG WINAPI ViewObject_AddRef(IViewObject2 *iface)
{ {
WebBrowser *This = impl_from_IViewObject2(iface); WebBrowser *This = impl_from_IViewObject2(iface);
return IWebBrowser2_AddRef(&This->IWebBrowser2_iface); return IUnknown_AddRef(This->hlink_frame.outer);
} }
static ULONG WINAPI ViewObject_Release(IViewObject2 *iface) static ULONG WINAPI ViewObject_Release(IViewObject2 *iface)
{ {
WebBrowser *This = impl_from_IViewObject2(iface); WebBrowser *This = impl_from_IViewObject2(iface);
return IWebBrowser2_Release(&This->IWebBrowser2_iface); return IUnknown_Release(This->hlink_frame.outer);
} }
static HRESULT WINAPI ViewObject_Draw(IViewObject2 *iface, DWORD dwDrawAspect, static HRESULT WINAPI ViewObject_Draw(IViewObject2 *iface, DWORD dwDrawAspect,
...@@ -157,19 +157,19 @@ static inline WebBrowser *impl_from_IDataObject(IDataObject *iface) ...@@ -157,19 +157,19 @@ static inline WebBrowser *impl_from_IDataObject(IDataObject *iface)
static HRESULT WINAPI DataObject_QueryInterface(LPDATAOBJECT iface, REFIID riid, LPVOID * ppvObj) static HRESULT WINAPI DataObject_QueryInterface(LPDATAOBJECT iface, REFIID riid, LPVOID * ppvObj)
{ {
WebBrowser *This = impl_from_IDataObject(iface); WebBrowser *This = impl_from_IDataObject(iface);
return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppvObj); return IUnknown_QueryInterface(This->hlink_frame.outer, riid, ppvObj);
} }
static ULONG WINAPI DataObject_AddRef(LPDATAOBJECT iface) static ULONG WINAPI DataObject_AddRef(LPDATAOBJECT iface)
{ {
WebBrowser *This = impl_from_IDataObject(iface); WebBrowser *This = impl_from_IDataObject(iface);
return IWebBrowser2_AddRef(&This->IWebBrowser2_iface); return IUnknown_AddRef(This->hlink_frame.outer);
} }
static ULONG WINAPI DataObject_Release(LPDATAOBJECT iface) static ULONG WINAPI DataObject_Release(LPDATAOBJECT iface)
{ {
WebBrowser *This = impl_from_IDataObject(iface); WebBrowser *This = impl_from_IDataObject(iface);
return IWebBrowser2_Release(&This->IWebBrowser2_iface); return IUnknown_Release(This->hlink_frame.outer);
} }
static HRESULT WINAPI DataObject_GetData(LPDATAOBJECT iface, LPFORMATETC pformatetcIn, STGMEDIUM *pmedium) static HRESULT WINAPI DataObject_GetData(LPDATAOBJECT iface, LPFORMATETC pformatetcIn, STGMEDIUM *pmedium)
......
...@@ -28,14 +28,14 @@ ...@@ -28,14 +28,14 @@
WINE_DEFAULT_DEBUG_CHANNEL(ieframe); WINE_DEFAULT_DEBUG_CHANNEL(ieframe);
static inline WebBrowser *impl_from_IWebBrowser2(IWebBrowser2 *iface) static inline WebBrowser *impl_from_IUnknown(IUnknown *iface)
{ {
return CONTAINING_RECORD(iface, WebBrowser, IWebBrowser2_iface); return CONTAINING_RECORD(iface, WebBrowser, IUnknown_inner);
} }
static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser2 *iface, REFIID riid, LPVOID *ppv) static HRESULT WINAPI WebBrowser_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
{ {
WebBrowser *This = impl_from_IWebBrowser2(iface); WebBrowser *This = impl_from_IUnknown(iface);
if (ppv == NULL) if (ppv == NULL)
return E_POINTER; return E_POINTER;
...@@ -43,7 +43,7 @@ static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser2 *iface, REFIID riid ...@@ -43,7 +43,7 @@ static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser2 *iface, REFIID riid
if(IsEqualGUID(&IID_IUnknown, riid)) { if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
*ppv = &This->IWebBrowser2_iface; *ppv = &This->IUnknown_inner;
}else if(IsEqualGUID(&IID_IDispatch, riid)) { }else if(IsEqualGUID(&IID_IDispatch, riid)) {
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv); TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
*ppv = &This->IWebBrowser2_iface; *ppv = &This->IWebBrowser2_iface;
...@@ -151,17 +151,17 @@ static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser2 *iface, REFIID riid ...@@ -151,17 +151,17 @@ static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser2 *iface, REFIID riid
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI WebBrowser_AddRef(IWebBrowser2 *iface) static ULONG WINAPI WebBrowser_AddRef(IUnknown *iface)
{ {
WebBrowser *This = impl_from_IWebBrowser2(iface); WebBrowser *This = impl_from_IUnknown(iface);
LONG ref = InterlockedIncrement(&This->ref); LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref); TRACE("(%p) ref=%d\n", This, ref);
return ref; return ref;
} }
static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface) static ULONG WINAPI WebBrowser_Release(IUnknown *iface)
{ {
WebBrowser *This = impl_from_IWebBrowser2(iface); WebBrowser *This = impl_from_IUnknown(iface);
LONG ref = InterlockedDecrement(&This->ref); LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref); TRACE("(%p) ref=%d\n", This, ref);
...@@ -184,6 +184,39 @@ static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface) ...@@ -184,6 +184,39 @@ static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface)
return ref; return ref;
} }
static const struct IUnknownVtbl internal_unk_vtbl =
{
WebBrowser_QueryInterface,
WebBrowser_AddRef,
WebBrowser_Release
};
static inline WebBrowser *impl_from_IWebBrowser2(IWebBrowser2 *iface)
{
return CONTAINING_RECORD(iface, WebBrowser, IWebBrowser2_iface);
}
static HRESULT WINAPI WebBrowser2_QueryInterface(IWebBrowser2 *iface, REFIID riid, LPVOID *ppv)
{
WebBrowser *This = impl_from_IWebBrowser2(iface);
return IUnknown_QueryInterface(This->hlink_frame.outer, riid, ppv);
}
static ULONG WINAPI WebBrowser2_AddRef(IWebBrowser2 *iface)
{
WebBrowser *This = impl_from_IWebBrowser2(iface);
return IUnknown_AddRef(This->hlink_frame.outer);
}
static ULONG WINAPI WebBrowser2_Release(IWebBrowser2 *iface)
{
WebBrowser *This = impl_from_IWebBrowser2(iface);
return IUnknown_Release(This->hlink_frame.outer);
}
/* IDispatch methods */ /* IDispatch methods */
static HRESULT WINAPI WebBrowser_GetTypeInfoCount(IWebBrowser2 *iface, UINT *pctinfo) static HRESULT WINAPI WebBrowser_GetTypeInfoCount(IWebBrowser2 *iface, UINT *pctinfo)
{ {
...@@ -1054,9 +1087,9 @@ static HRESULT WINAPI WebBrowser_put_Resizable(IWebBrowser2 *iface, VARIANT_BOOL ...@@ -1054,9 +1087,9 @@ static HRESULT WINAPI WebBrowser_put_Resizable(IWebBrowser2 *iface, VARIANT_BOOL
static const IWebBrowser2Vtbl WebBrowser2Vtbl = static const IWebBrowser2Vtbl WebBrowser2Vtbl =
{ {
WebBrowser_QueryInterface, WebBrowser2_QueryInterface,
WebBrowser_AddRef, WebBrowser2_AddRef,
WebBrowser_Release, WebBrowser2_Release,
WebBrowser_GetTypeInfoCount, WebBrowser_GetTypeInfoCount,
WebBrowser_GetTypeInfo, WebBrowser_GetTypeInfo,
WebBrowser_GetIDsOfNames, WebBrowser_GetIDsOfNames,
...@@ -1136,19 +1169,19 @@ static HRESULT WINAPI WBServiceProvider_QueryInterface(IServiceProvider *iface, ...@@ -1136,19 +1169,19 @@ static HRESULT WINAPI WBServiceProvider_QueryInterface(IServiceProvider *iface,
REFIID riid, LPVOID *ppv) REFIID riid, LPVOID *ppv)
{ {
WebBrowser *This = impl_from_IServiceProvider(iface); WebBrowser *This = impl_from_IServiceProvider(iface);
return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppv); return IUnknown_QueryInterface(This->hlink_frame.outer, riid, ppv);
} }
static ULONG WINAPI WBServiceProvider_AddRef(IServiceProvider *iface) static ULONG WINAPI WBServiceProvider_AddRef(IServiceProvider *iface)
{ {
WebBrowser *This = impl_from_IServiceProvider(iface); WebBrowser *This = impl_from_IServiceProvider(iface);
return IWebBrowser2_AddRef(&This->IWebBrowser2_iface); return IUnknown_AddRef(This->hlink_frame.outer);
} }
static ULONG WINAPI WBServiceProvider_Release(IServiceProvider *iface) static ULONG WINAPI WBServiceProvider_Release(IServiceProvider *iface)
{ {
WebBrowser *This = impl_from_IServiceProvider(iface); WebBrowser *This = impl_from_IServiceProvider(iface);
return IWebBrowser2_Release(&This->IWebBrowser2_iface); return IUnknown_Release(This->hlink_frame.outer);
} }
static HRESULT STDMETHODCALLTYPE WBServiceProvider_QueryService(IServiceProvider *iface, static HRESULT STDMETHODCALLTYPE WBServiceProvider_QueryService(IServiceProvider *iface,
...@@ -1188,13 +1221,13 @@ static inline WebBrowser *impl_from_DocHost(DocHost *iface) ...@@ -1188,13 +1221,13 @@ static inline WebBrowser *impl_from_DocHost(DocHost *iface)
static ULONG WebBrowser_addref(DocHost *iface) static ULONG WebBrowser_addref(DocHost *iface)
{ {
WebBrowser *This = impl_from_DocHost(iface); WebBrowser *This = impl_from_DocHost(iface);
return IWebBrowser2_AddRef(&This->IWebBrowser2_iface); return IUnknown_AddRef(This->hlink_frame.outer);
} }
static ULONG WebBrowser_release(DocHost *iface) static ULONG WebBrowser_release(DocHost *iface)
{ {
WebBrowser *This = impl_from_DocHost(iface); WebBrowser *This = impl_from_DocHost(iface);
return IWebBrowser2_Release(&This->IWebBrowser2_iface); return IUnknown_Release(This->hlink_frame.outer);
} }
static void DocHostContainer_get_docobj_rect(DocHost *This, RECT *rc) static void DocHostContainer_get_docobj_rect(DocHost *This, RECT *rc)
...@@ -1231,13 +1264,18 @@ static HRESULT create_webbrowser(int version, IUnknown *outer, REFIID riid, void ...@@ -1231,13 +1264,18 @@ static HRESULT create_webbrowser(int version, IUnknown *outer, REFIID riid, void
TRACE("(%p %s %p) version=%d\n", outer, debugstr_guid(riid), ppv, version); TRACE("(%p %s %p) version=%d\n", outer, debugstr_guid(riid), ppv, version);
if (outer && !IsEqualIID(riid, &IID_IUnknown))
return CLASS_E_NOAGGREGATION;
ret = heap_alloc_zero(sizeof(WebBrowser)); ret = heap_alloc_zero(sizeof(WebBrowser));
ret->IUnknown_inner.lpVtbl = &internal_unk_vtbl;
ret->IWebBrowser2_iface.lpVtbl = &WebBrowser2Vtbl; ret->IWebBrowser2_iface.lpVtbl = &WebBrowser2Vtbl;
ret->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl; ret->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;
ret->ref = 1; ret->ref = 1;
ret->version = version; ret->version = version;
HlinkFrame_Init(&ret->hlink_frame, outer ? outer : &ret->IUnknown_inner, &ret->doc_host);
DocHost_Init(&ret->doc_host, &ret->IWebBrowser2_iface, &DocHostContainerVtbl); DocHost_Init(&ret->doc_host, &ret->IWebBrowser2_iface, &DocHostContainerVtbl);
ret->visible = VARIANT_TRUE; ret->visible = VARIANT_TRUE;
...@@ -1251,13 +1289,11 @@ static HRESULT create_webbrowser(int version, IUnknown *outer, REFIID riid, void ...@@ -1251,13 +1289,11 @@ static HRESULT create_webbrowser(int version, IUnknown *outer, REFIID riid, void
WebBrowser_Persist_Init(ret); WebBrowser_Persist_Init(ret);
WebBrowser_ClassInfo_Init(ret); WebBrowser_ClassInfo_Init(ret);
HlinkFrame_Init(&ret->hlink_frame, (IUnknown*)&ret->IWebBrowser2_iface, &ret->doc_host);
lock_module(); lock_module();
hres = IWebBrowser2_QueryInterface(&ret->IWebBrowser2_iface, riid, ppv); hres = IUnknown_QueryInterface(&ret->IUnknown_inner, riid, ppv);
IWebBrowser2_Release(&ret->IWebBrowser2_iface); IUnknown_Release(&ret->IUnknown_inner);
return hres; return hres;
} }
......
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