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

Delta Between Two Patch Sets: src/plugin/WebBrowserEventsListener.h

Issue 6567422169448448: Issue 119 - Switch to injecting CSS for element hiding (Closed)
Left Patch Set: rebase and address comments Created April 13, 2015, 8:04 a.m.
Right Patch Set: rename OnQuit Created Sept. 30, 2016, 3:25 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/plugin/PluginTabBase.cpp ('k') | src/plugin/WebBrowserEventsListener.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH
4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */
17
1 #pragma once 18 #pragma once
2 #include <functional> 19 #include <functional>
3 #include <memory> 20 #include <memory>
4 21
5 class WebBrowserEventsListener; 22 class WebBrowserEventsListener;
6 23
7 typedef ATL::IDispEventImpl <1, WebBrowserEventsListener, 24 typedef ATL::IDispEventImpl <1, WebBrowserEventsListener,
8 &__uuidof(DWebBrowserEvents2), &LIBID_SHDocVw, 1, 1> WebBrowserEvents2Listener ; 25 &__uuidof(DWebBrowserEvents2), &LIBID_SHDocVw, 1, 1> WebBrowserEvents2Listener ;
9 26
10 typedef ATL::IDispEventImpl <2, WebBrowserEventsListener, 27 typedef ATL::IDispEventImpl <2, WebBrowserEventsListener,
11 &__uuidof(HTMLDocumentEvents2), &LIBID_MSHTML, 4, 0> HTMLDocumentEvents2Listen er; 28 &__uuidof(HTMLDocumentEvents2), &LIBID_MSHTML, 4, 0> HTMLDocumentEvents2Listen er;
12 29
13 class ATL_NO_VTABLE WebBrowserEventsListener : 30 class ATL_NO_VTABLE WebBrowserEventsListener :
14 public ATL::CComObjectRootEx<ATL::CComSingleThreadModel>, 31 public ATL::CComObjectRootEx<ATL::CComMultiThreadModel>,
15 public WebBrowserEvents2Listener, 32 public WebBrowserEvents2Listener,
16 public HTMLDocumentEvents2Listener, 33 public HTMLDocumentEvents2Listener,
17 public IUnknown 34 public IUnknown
18 { 35 {
19 enum class State 36 enum class State
20 { 37 {
21 FirstTimeLoading, Loading, Loaded 38 FirstTimeLoading, Loading, Loaded
22 }; 39 };
23 public: 40 public:
24 typedef std::function<void()> OnDestroy; 41 typedef std::function<void()> OnDestroy;
25 typedef std::function<void()> OnReloaded; 42 typedef std::function<void()> OnReloaded;
26 43
27 WebBrowserEventsListener(); 44 WebBrowserEventsListener();
28 ~WebBrowserEventsListener(); 45 ~WebBrowserEventsListener();
29 BEGIN_COM_MAP(WebBrowserEventsListener) 46 BEGIN_COM_MAP(WebBrowserEventsListener)
30 COM_INTERFACE_ENTRY(IUnknown) 47 COM_INTERFACE_ENTRY(IUnknown)
31 END_COM_MAP() 48 END_COM_MAP()
32 49
33 DECLARE_NOT_AGGREGATABLE(WebBrowserEventsListener) 50 DECLARE_NOT_AGGREGATABLE(WebBrowserEventsListener)
34 BEGIN_SINK_MAP(WebBrowserEventsListener) 51 BEGIN_SINK_MAP(WebBrowserEventsListener)
35 SINK_ENTRY_EX(1, __uuidof(DWebBrowserEvents2), DISPID_DOCUMENTCOMPLETE, OnDo cumentComplete) 52 SINK_ENTRY_EX(1, __uuidof(DWebBrowserEvents2), DISPID_DOCUMENTCOMPLETE, OnDo cumentComplete)
53 SINK_ENTRY_EX(1, __uuidof(DWebBrowserEvents2), DISPID_ONQUIT, OnQuit)
36 SINK_ENTRY_EX(2, __uuidof(HTMLDocumentEvents2), DISPID_HTMLDOCUMENTEVENTS2_O NREADYSTATECHANGE, OnReadyStateChange) 54 SINK_ENTRY_EX(2, __uuidof(HTMLDocumentEvents2), DISPID_HTMLDOCUMENTEVENTS2_O NREADYSTATECHANGE, OnReadyStateChange)
37 END_SINK_MAP() 55 END_SINK_MAP()
38 56
39 STDMETHOD(OnDocumentComplete)(IDispatch* pDisp, VARIANT* urlVariant); 57 STDMETHOD(OnDocumentComplete)(IDispatch* pDisp, VARIANT* urlVariant);
58 STDMETHOD_(void, OnQuit)();
40 STDMETHOD_(void, OnReadyStateChange)(IHTMLEventObj* pEvtObj); 59 STDMETHOD_(void, OnReadyStateChange)(IHTMLEventObj* pEvtObj);
41 60
42 DECLARE_PROTECT_FINAL_CONSTRUCT() 61 DECLARE_PROTECT_FINAL_CONSTRUCT()
43 62
44 HRESULT FinalConstruct(){ return S_OK; } 63 HRESULT FinalConstruct(){ return S_OK; }
45 void FinalRelease(){} 64 void FinalRelease();
46 HRESULT Init(IWebBrowser2* webBrowser, const OnDestroy& onDestroy); 65 HRESULT Init(IWebBrowser2* webBrowser, const OnDestroy& onDestroy, const OnRel oaded& onReloaded);
47 66
48 OnReloaded reloaded;
49 private: 67 private:
50 void emitReloaded(); 68 void emitReloaded();
51 private: 69 private:
52 ATL::CComPtr<IWebBrowser2> m_browser; 70 ATL::CComPtr<IWebBrowser2> m_browser;
53 OnDestroy m_onDestroy; 71 OnDestroy m_onDestroy;
72 OnReloaded m_onReloaded;
54 bool m_isDocumentEvents2Connected; 73 bool m_isDocumentEvents2Connected;
55 State m_state; 74 State m_state;
56 }; 75 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld