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

Delta Between Two Patch Sets: src/plugin/PluginTabBase.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/PluginFilter.cpp ('k') | src/plugin/PluginTabBase.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 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 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 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 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/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #ifndef _PLUGIN_TAB_BASE_H_ 18 #ifndef _PLUGIN_TAB_BASE_H_
19 #define _PLUGIN_TAB_BASE_H_ 19 #define _PLUGIN_TAB_BASE_H_
20 20
21 class CPluginDomTraverser; 21 class CPluginDomTraverser;
22 22
23 #include "PluginUserSettings.h" 23 #include "PluginUserSettings.h"
24 #include "PluginFilter.h" 24 #include "PluginFilter.h"
25 #include "../shared/CriticalSection.h" 25 #include "../shared/CriticalSection.h"
26 #include <thread> 26 #include <thread>
27 #include <atomic> 27 #include <atomic>
28 28
29 class CPluginClass; 29 class CPluginTab
30
31
32 class CPluginTabBase
33 { 30 {
34
35 friend class CPluginClass;
36
37 protected:
38
39 CComAutoCriticalSection m_criticalSection; 31 CComAutoCriticalSection m_criticalSection;
40 CriticalSection m_csInject; 32 CriticalSection m_csInject;
41 33
42 std::wstring m_documentDomain; 34 std::wstring m_documentDomain;
43 std::wstring m_documentUrl; 35 std::wstring m_documentUrl;
44 CPluginUserSettings m_pluginUserSettings; 36 CPluginUserSettings m_pluginUserSettings;
45 public:
46 CPluginClass* m_plugin;
47 protected:
48 bool m_isActivated; 37 bool m_isActivated;
49 38
50 std::thread m_thread; 39 std::thread m_thread;
51 std::atomic<bool> m_continueThreadRunning; 40 std::atomic<bool> m_continueThreadRunning;
52 CPluginDomTraverser* m_traverser; 41 std::unique_ptr<CPluginDomTraverser> m_traverser;
53 public: 42 public:
54 std::auto_ptr<CPluginFilter> m_filter; 43 class AsyncPluginFilter;
44 std::shared_ptr<AsyncPluginFilter> m_asyncPluginFilter;
55 private: 45 private:
56 void ThreadProc(); 46 void ThreadProc();
57 CComAutoCriticalSection m_criticalSectionCache; 47 CComAutoCriticalSection m_criticalSectionCache;
58 std::set<std::wstring> m_cacheFrames; 48 std::set<std::wstring> m_cacheFrames;
59 std::wstring m_cacheDomain; 49 std::wstring m_cacheDomain;
60 void SetDocumentUrl(const std::wstring& url);
61 void InjectABP(IWebBrowser2* browser); 50 void InjectABP(IWebBrowser2* browser);
62 bool IsTraverserEnabled(); 51 bool IsTraverserEnabled();
63 bool IsCSSInjectionEnabled(); 52 bool IsCSSInjectionEnabled();
64 public: 53 public:
65 54
66 CPluginTabBase(CPluginClass* plugin); 55 CPluginTab();
67 ~CPluginTabBase(); 56 ~CPluginTab();
68 57
69 std::wstring GetDocumentDomain(); 58 std::wstring GetDocumentDomain();
59 void SetDocumentUrl(const std::wstring& url);
70 std::wstring GetDocumentUrl(); 60 std::wstring GetDocumentUrl();
71 virtual void OnActivate(); 61 virtual void OnActivate();
72 virtual void OnUpdate(); 62 virtual void OnUpdate();
73 virtual void OnNavigate(const std::wstring& url); 63 virtual void OnNavigate(const std::wstring& url);
74 virtual void OnDownloadComplete(IWebBrowser2* browser); 64 virtual void OnDownloadComplete(IWebBrowser2* browser);
75 virtual void OnDocumentComplete(IWebBrowser2* browser, const std::wstring& url , bool isDocumentBrowser); 65 virtual void OnDocumentComplete(IWebBrowser2* browser, const std::wstring& url , bool isDocumentBrowser);
76 static DWORD WINAPI TabThreadProc(LPVOID pParam); 66 static DWORD WINAPI TabThreadProc(LPVOID pParam);
77 void CacheFrame(const std::wstring& url); 67 void CacheFrame(const std::wstring& url);
78 bool IsFrameCached(const std::wstring& url); 68 bool IsFrameCached(const std::wstring& url);
79 void ClearFrameCache(const std::wstring& domain=L""); 69 void ClearFrameCache(const std::wstring& domain=L"");
80 70 /**
71 * Is it possible to disable the current content of the present tab on a per-s ite basis?
72 */
73 bool IsPossibleToDisableOnSite();
81 }; 74 };
82 75
83 /**
84 * Temporary class used during refactoring.
85 * This is the definition previously in AdblockPlusTab.h
86 * Defining this class during refactoring alleviates the need to rename CPluginT abBase in the first change set.
87 */
88 class CPluginTab : public CPluginTabBase
89 {
90
91 public:
92 CPluginTab(CPluginClass* plugin) : CPluginTabBase(plugin) {};
93 ~CPluginTab() {};
94 };
95
96
97
98 #endif // _PLUGIN_TAB_BASE_H_ 76 #endif // _PLUGIN_TAB_BASE_H_
LEFTRIGHT

Powered by Google App Engine
This is Rietveld