mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-01 11:08:45 +00:00
Improve IConnectionPoint handling.
This commit is contained in:
parent
bcb4201130
commit
b1a00245a6
2 changed files with 114 additions and 88 deletions
|
@ -27,10 +27,15 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
|
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
|
||||||
|
|
||||||
static IConnectionPointImpl SHDOCVW_ConnectionPoint;
|
typedef struct {
|
||||||
|
const IConnectionPointVtbl *lpConnectionPointVtbl;
|
||||||
|
|
||||||
static const GUID IID_INotifyDBEvents =
|
WebBrowser *webbrowser;
|
||||||
{ 0xdb526cc0, 0xd188, 0x11cd, { 0xad, 0x48, 0x00, 0xaa, 0x00, 0x3c, 0x9c, 0xb6 } };
|
|
||||||
|
IID iid;
|
||||||
|
} ConnectionPoint;
|
||||||
|
|
||||||
|
#define CONPOINT(x) ((IConnectionPoint*) &(x)->lpConnectionPointVtbl)
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Implement the IConnectionPointContainer interface
|
* Implement the IConnectionPointContainer interface
|
||||||
|
@ -70,27 +75,31 @@ static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPo
|
||||||
{
|
{
|
||||||
WebBrowser *This = CONPTCONT_THIS(iface);
|
WebBrowser *This = CONPTCONT_THIS(iface);
|
||||||
|
|
||||||
FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppCP);
|
if(!ppCP) {
|
||||||
|
WARN("ppCP == NULL\n");
|
||||||
/* For now, return the same IConnectionPoint object for both
|
return E_POINTER;
|
||||||
* event interface requests.
|
|
||||||
*/
|
|
||||||
if (IsEqualGUID (&IID_INotifyDBEvents, riid))
|
|
||||||
{
|
|
||||||
TRACE("Returning connection point %p for IID_INotifyDBEvents\n",
|
|
||||||
&SHDOCVW_ConnectionPoint);
|
|
||||||
*ppCP = (LPCONNECTIONPOINT)&SHDOCVW_ConnectionPoint;
|
|
||||||
return S_OK;
|
|
||||||
}
|
}
|
||||||
else if (IsEqualGUID (&IID_IPropertyNotifySink, riid))
|
|
||||||
{
|
*ppCP = NULL;
|
||||||
TRACE("Returning connection point %p for IID_IPropertyNotifySink\n",
|
|
||||||
&SHDOCVW_ConnectionPoint);
|
if(IsEqualGUID(&DIID_DWebBrowserEvents2, riid)) {
|
||||||
*ppCP = (LPCONNECTIONPOINT)&SHDOCVW_ConnectionPoint;
|
TRACE("(%p)->(DIID_DWebBrowserEvents2 %p)\n", This, ppCP);
|
||||||
|
*ppCP = This->cp_wbe2;
|
||||||
|
}else if(IsEqualGUID(&DIID_DWebBrowserEvents, riid)) {
|
||||||
|
TRACE("(%p)->(DIID_DWebBrowserEvents %p)\n", This, ppCP);
|
||||||
|
*ppCP = This->cp_wbe;
|
||||||
|
}else if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
|
||||||
|
TRACE("(%p)->(IID_IPropertyNotifySink %p)\n", This, ppCP);
|
||||||
|
*ppCP = This->cp_pns;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(*ppCP) {
|
||||||
|
IConnectionPoint_AddRef(*ppCP);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return E_FAIL;
|
WARN("Unsupported IID %s\n", debugstr_guid(riid));
|
||||||
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef CONPTCONT_THIS
|
#undef CONPTCONT_THIS
|
||||||
|
@ -109,97 +118,118 @@ static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl =
|
||||||
* Implement the IConnectionPoint interface
|
* Implement the IConnectionPoint interface
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static HRESULT WINAPI WBCP_QueryInterface(LPCONNECTIONPOINT iface,
|
#define CONPOINT_THIS(iface) DEFINE_THIS(ConnectionPoint, ConnectionPoint, iface)
|
||||||
REFIID riid, LPVOID *ppobj)
|
|
||||||
{
|
|
||||||
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
|
|
||||||
|
|
||||||
if (ppobj == NULL) return E_POINTER;
|
static HRESULT WINAPI ConnectionPoint_QueryInterface(IConnectionPoint *iface,
|
||||||
|
REFIID riid, LPVOID *ppv)
|
||||||
|
{
|
||||||
|
ConnectionPoint *This = CONPOINT_THIS(iface);
|
||||||
|
|
||||||
|
*ppv = NULL;
|
||||||
|
|
||||||
|
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
||||||
|
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
|
||||||
|
*ppv = CONPOINT(This);
|
||||||
|
}else if(IsEqualGUID(&IID_IConnectionPoint, riid)) {
|
||||||
|
TRACE("(%p)->(IID_IConnectionPoint %p)\n", This, ppv);
|
||||||
|
*ppv = CONPOINT(This);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(*ppv) {
|
||||||
|
IWebBrowser2_AddRef(WEBBROWSER(This->webbrowser));
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
WARN("Unsupported interface %s\n", debugstr_guid(riid));
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI WBCP_AddRef(LPCONNECTIONPOINT iface)
|
static ULONG WINAPI ConnectionPoint_AddRef(IConnectionPoint *iface)
|
||||||
{
|
{
|
||||||
SHDOCVW_LockModule();
|
ConnectionPoint *This = CONPOINT_THIS(iface);
|
||||||
|
return IWebBrowser2_AddRef(WEBBROWSER(This->webbrowser));
|
||||||
return 2; /* non-heap based object */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI WBCP_Release(LPCONNECTIONPOINT iface)
|
static ULONG WINAPI ConnectionPoint_Release(IConnectionPoint *iface)
|
||||||
{
|
{
|
||||||
SHDOCVW_UnlockModule();
|
ConnectionPoint *This = CONPOINT_THIS(iface);
|
||||||
|
return IWebBrowser2_Release(WEBBROWSER(This->webbrowser));
|
||||||
return 1; /* non-heap based object */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI WBCP_GetConnectionInterface(LPCONNECTIONPOINT iface, IID* pIId)
|
static HRESULT WINAPI ConnectionPoint_GetConnectionInterface(IConnectionPoint *iface, IID *pIID)
|
||||||
{
|
{
|
||||||
FIXME("stub: %s\n", debugstr_guid(pIId));
|
ConnectionPoint *This = CONPOINT_THIS(iface);
|
||||||
|
|
||||||
|
TRACE("(%p)->(%p)\n", This, pIID);
|
||||||
|
|
||||||
|
memcpy(pIID, &This->iid, sizeof(IID));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get this connection point's owning container */
|
static HRESULT WINAPI ConnectionPoint_GetConnectionPointContainer(IConnectionPoint *iface,
|
||||||
static HRESULT WINAPI
|
IConnectionPointContainer **ppCPC)
|
||||||
WBCP_GetConnectionPointContainer(LPCONNECTIONPOINT iface,
|
|
||||||
LPCONNECTIONPOINTCONTAINER *ppCPC)
|
|
||||||
{
|
{
|
||||||
FIXME("stub: IConnectionPointContainer = %p\n", *ppCPC);
|
ConnectionPoint *This = CONPOINT_THIS(iface);
|
||||||
|
|
||||||
|
TRACE("(%p)->(%p)\n", This, ppCPC);
|
||||||
|
|
||||||
|
*ppCPC = CONPTCONT(This->webbrowser);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Connect the pUnkSink event-handling implementation (in the control site)
|
static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *pUnkSink,
|
||||||
* to this connection point. Return a handle to this connection in
|
DWORD *pdwCookie)
|
||||||
* pdwCookie (for later use in Unadvise()).
|
|
||||||
*/
|
|
||||||
static HRESULT WINAPI WBCP_Advise(LPCONNECTIONPOINT iface,
|
|
||||||
LPUNKNOWN pUnkSink, DWORD *pdwCookie)
|
|
||||||
{
|
{
|
||||||
static int new_cookie;
|
ConnectionPoint *This = CONPOINT_THIS(iface);
|
||||||
|
FIXME("(%p)->(%p %p)\n", This, pUnkSink, pdwCookie);
|
||||||
FIXME("stub: IUnknown = %p, connection cookie = %ld\n", pUnkSink, *pdwCookie);
|
return E_NOTIMPL;
|
||||||
|
|
||||||
*pdwCookie = ++new_cookie;
|
|
||||||
TRACE ("Returning cookie = %ld\n", *pdwCookie);
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disconnect this implementation from the connection point. */
|
static HRESULT WINAPI ConnectionPoint_Unadvise(IConnectionPoint *iface, DWORD dwCookie)
|
||||||
static HRESULT WINAPI WBCP_Unadvise(LPCONNECTIONPOINT iface,
|
|
||||||
DWORD dwCookie)
|
|
||||||
{
|
{
|
||||||
FIXME("stub: cookie to disconnect = %lx\n", dwCookie);
|
ConnectionPoint *This = CONPOINT_THIS(iface);
|
||||||
return S_OK;
|
FIXME("(%p)->(%ld)\n", This, dwCookie);
|
||||||
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a list of connections in this connection point. */
|
static HRESULT WINAPI ConnectionPoint_EnumConnections(IConnectionPoint *iface,
|
||||||
static HRESULT WINAPI WBCP_EnumConnections(LPCONNECTIONPOINT iface,
|
IEnumConnections **ppEnum)
|
||||||
LPENUMCONNECTIONS *ppEnum)
|
|
||||||
{
|
{
|
||||||
FIXME("stub: IEnumConnections = %p\n", *ppEnum);
|
ConnectionPoint *This = CONPOINT_THIS(iface);
|
||||||
return S_OK;
|
FIXME("(%p)->(%p)\n", This, ppEnum);
|
||||||
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
#undef CONPOINT_THIS
|
||||||
* IConnectionPoint virtual function table for IE Web Browser component
|
|
||||||
*/
|
|
||||||
|
|
||||||
static const IConnectionPointVtbl WBCP_Vtbl =
|
static const IConnectionPointVtbl ConnectionPointVtbl =
|
||||||
{
|
{
|
||||||
WBCP_QueryInterface,
|
ConnectionPoint_QueryInterface,
|
||||||
WBCP_AddRef,
|
ConnectionPoint_AddRef,
|
||||||
WBCP_Release,
|
ConnectionPoint_Release,
|
||||||
WBCP_GetConnectionInterface,
|
ConnectionPoint_GetConnectionInterface,
|
||||||
WBCP_GetConnectionPointContainer,
|
ConnectionPoint_GetConnectionPointContainer,
|
||||||
WBCP_Advise,
|
ConnectionPoint_Advise,
|
||||||
WBCP_Unadvise,
|
ConnectionPoint_Unadvise,
|
||||||
WBCP_EnumConnections
|
ConnectionPoint_EnumConnections
|
||||||
};
|
};
|
||||||
|
|
||||||
static IConnectionPointImpl SHDOCVW_ConnectionPoint = {&WBCP_Vtbl};
|
static void ConnectionPoint_Create(WebBrowser *wb, REFIID riid, IConnectionPoint **cp)
|
||||||
|
{
|
||||||
|
ConnectionPoint *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(ConnectionPoint));
|
||||||
|
|
||||||
|
ret->lpConnectionPointVtbl = &ConnectionPointVtbl;
|
||||||
|
ret->webbrowser = wb;
|
||||||
|
memcpy(&ret->iid, riid, sizeof(IID));
|
||||||
|
|
||||||
|
*cp = CONPOINT(ret);
|
||||||
|
}
|
||||||
|
|
||||||
void WebBrowser_Events_Init(WebBrowser *This)
|
void WebBrowser_Events_Init(WebBrowser *This)
|
||||||
{
|
{
|
||||||
This->lpConnectionPointContainerVtbl = &ConnectionPointContainerVtbl;
|
This->lpConnectionPointContainerVtbl = &ConnectionPointContainerVtbl;
|
||||||
|
|
||||||
|
ConnectionPoint_Create(This, &DIID_DWebBrowserEvents2, &This->cp_wbe2);
|
||||||
|
ConnectionPoint_Create(This, &DIID_DWebBrowserEvents, &This->cp_wbe);
|
||||||
|
ConnectionPoint_Create(This, &IID_IPropertyNotifySink, &This->cp_pns);
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,6 +94,12 @@ typedef struct {
|
||||||
RECT pos_rect;
|
RECT pos_rect;
|
||||||
RECT clip_rect;
|
RECT clip_rect;
|
||||||
OLEINPLACEFRAMEINFO frameinfo;
|
OLEINPLACEFRAMEINFO frameinfo;
|
||||||
|
|
||||||
|
/* Connection points */
|
||||||
|
|
||||||
|
IConnectionPoint *cp_wbe2;
|
||||||
|
IConnectionPoint *cp_wbe;
|
||||||
|
IConnectionPoint *cp_pns;
|
||||||
} WebBrowser;
|
} WebBrowser;
|
||||||
|
|
||||||
#define WEBBROWSER(x) ((IWebBrowser*) &(x)->lpWebBrowser2Vtbl)
|
#define WEBBROWSER(x) ((IWebBrowser*) &(x)->lpWebBrowser2Vtbl)
|
||||||
|
@ -128,16 +134,6 @@ void WebBrowser_OleObject_Destroy(WebBrowser*);
|
||||||
|
|
||||||
HRESULT WebBrowser_Create(IUnknown*,REFIID,void**);
|
HRESULT WebBrowser_Create(IUnknown*,REFIID,void**);
|
||||||
|
|
||||||
/**********************************************************************
|
|
||||||
* IConnectionPoint declaration for SHDOCVW.DLL
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
/* IUnknown fields */
|
|
||||||
const IConnectionPointVtbl *lpVtbl;
|
|
||||||
LONG ref;
|
|
||||||
} IConnectionPointImpl;
|
|
||||||
|
|
||||||
#define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
|
#define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
|
|
Loading…
Reference in a new issue