Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/plugin/PluginClass.h

Issue 4937147073167360: Issue 1672 - Subscribe and listen COM events using ATL::IDispEventImpl and BEGIN_SINK_MAP (Closed)
Patch Set: Created Dec. 8, 2014, 12:19 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/plugin/PluginClass.h
diff --git a/src/plugin/PluginClass.h b/src/plugin/PluginClass.h
index 2e91f807a4480c53512ef72da65e4c58bf00463f..00e4321095ec5201c202980bfa83eb0d6f54358b 100644
--- a/src/plugin/PluginClass.h
+++ b/src/plugin/PluginClass.h
@@ -28,11 +28,11 @@ class CPluginMimeFilterClient;
class ATL_NO_VTABLE CPluginClass :
- public CComObjectRootEx<CComMultiThreadModel>,
- public CComCoClass<CPluginClass, &CLSID_PluginClass>,
- public IObjectWithSiteImpl<CPluginClass>,
- public IDispatchImpl<IIEPlugin, &IID_IIEPlugin, &LIBID_PluginLib>,
- public IOleCommandTarget
+ public ATL::CComObjectRootEx<ATL::CComMultiThreadModel>,
+ public ATL::CComCoClass<CPluginClass, &CLSID_PluginClass>,
+ public ATL::IObjectWithSiteImpl<CPluginClass>,
+ public IOleCommandTarget,
+ public ATL::IDispEventImpl<1, CPluginClass, &DIID_DWebBrowserEvents2, &LIBID_SHDocVw, 1, 1>
Eric 2014/12/31 17:03:15 From http://msdn.microsoft.com/en-us/library/d7eec
Oleksandr 2015/01/09 00:02:17 For reference: discussion on this moved to the com
{
friend class CPluginTab;
@@ -48,12 +48,20 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CPluginClass)
- COM_INTERFACE_ENTRY(IIEPlugin)
- COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IObjectWithSite)
COM_INTERFACE_ENTRY(IOleCommandTarget)
END_COM_MAP()
+ BEGIN_SINK_MAP(CPluginClass)
+ SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_BEFORENAVIGATE2, OnBeforeNavigate2)
+ SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_DOWNLOADBEGIN, OnDownloadBegin)
+ SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_DOWNLOADCOMPLETE, OnDownloadComplete)
+ SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_DOCUMENTCOMPLETE, OnDocumentComplete)
+ SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_WINDOWSTATECHANGED, OnWindowStateChanged)
+ SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_COMMANDSTATECHANGE, OnCommandStateChange)
+ SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_ONQUIT, Unadvice)
+ END_SINK_MAP()
+
CPluginClass();
~CPluginClass();
@@ -69,10 +77,6 @@ public:
STDMETHOD(QueryStatus)(const GUID* pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT* pCmdText);
STDMETHOD(Exec)(const GUID*, DWORD nCmdID, DWORD, VARIANTARG*, VARIANTARG* pvaOut);
- // IDispatch
-
- STDMETHOD(Invoke)(DISPID dispidMember,REFIID riid, LCID lcid, WORD wFlags,
- DISPPARAMS * pdispparams, VARIANT * pvarResult,EXCEPINFO * pexcepinfo, UINT * puArgErr);
static CPluginTab* GetTab(DWORD dwThreadId);
CPluginTab* GetTab();
@@ -88,14 +92,11 @@ private:
void DisplayPluginMenu(HMENU hMenu, int nToolbarCmdID, POINT pt, UINT nMenuFlags);
bool CreateStatusBarPane();
- CComPtr<IConnectionPoint> GetConnectionPoint();
-
public:
HWND GetBrowserHWND() const;
HWND GetTabHWND() const;
CComQIPtr<IWebBrowser2> GetBrowser() const;
- STDMETHODIMP OnTabChanged(DISPPARAMS* pDispParams, WORD wFlags);
static CPluginMimeFilterClient* s_mimeFilter;
@@ -114,9 +115,21 @@ private:
static LRESULT CALLBACK NewStatusProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK PaneWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static void FirstRunThread();
- void BeforeNavigate2(DISPPARAMS* pDispParams);
- void Unadvice();
+ void STDMETHODCALLTYPE OnBeforeNavigate2(/* [in] */ IDispatch* pDisp,
+ /* [in] */ VARIANT* URL,
+ /* [in] */ VARIANT* Flags,
+ /* [in] */ VARIANT* TargetFrameName,
+ /* [in] */ VARIANT* PostData,
+ /* [in] */ VARIANT* Headers,
+ /* [in, out] */ VARIANT_BOOL* Cancel);
+ void STDMETHODCALLTYPE OnDownloadBegin();
+ void STDMETHODCALLTYPE OnDownloadComplete();
+ void STDMETHODCALLTYPE OnDocumentComplete(IDispatch* frameBrowserDisp, VARIANT* /*urlOrPidl*/);
+ void STDMETHODCALLTYPE OnWindowStateChanged(unsigned long flags, unsigned long validFlagsMask);
+ void STDMETHODCALLTYPE OnCommandStateChange(long command, VARIANT_BOOL enable);
+ // OnOnQuit
+ void STDMETHODCALLTYPE Unadvice();
void ShowStatusBar();
bool IsStatusBarEnabled();
@@ -124,7 +137,6 @@ private:
public:
CComQIPtr<IWebBrowser2> m_webBrowser2;
private:
- DWORD m_nConnectionID;
HWND m_hBrowserWnd;
HWND m_hTabWnd;
HWND m_hStatusBarWnd;

Powered by Google App Engine
This is Rietveld