LEFT | RIGHT |
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-2015 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 CPluginTabBase | 29 class CPluginTab |
30 { | 30 { |
31 CComAutoCriticalSection m_criticalSection; | 31 CComAutoCriticalSection m_criticalSection; |
32 CriticalSection m_csInject; | 32 CriticalSection m_csInject; |
33 | 33 |
34 std::wstring m_documentDomain; | 34 std::wstring m_documentDomain; |
35 std::wstring m_documentUrl; | 35 std::wstring m_documentUrl; |
36 CPluginUserSettings m_pluginUserSettings; | 36 CPluginUserSettings m_pluginUserSettings; |
37 bool m_isActivated; | 37 bool m_isActivated; |
38 | 38 |
39 std::thread m_thread; | 39 std::thread m_thread; |
40 std::atomic<bool> m_continueThreadRunning; | 40 std::atomic<bool> m_continueThreadRunning; |
41 CPluginDomTraverser* m_traverser; | 41 CPluginDomTraverser* m_traverser; |
42 public: | 42 public: |
43 CPluginFilter m_filter; | 43 CPluginFilter m_filter; |
44 private: | 44 private: |
45 void ThreadProc(); | 45 void ThreadProc(); |
46 CComAutoCriticalSection m_criticalSectionCache; | 46 CComAutoCriticalSection m_criticalSectionCache; |
47 std::set<std::wstring> m_cacheFrames; | 47 std::set<std::wstring> m_cacheFrames; |
48 std::wstring m_cacheDomain; | 48 std::wstring m_cacheDomain; |
49 void InjectABP(IWebBrowser2* browser); | 49 void InjectABP(IWebBrowser2* browser); |
50 public: | 50 public: |
51 | 51 |
52 CPluginTabBase(); | 52 CPluginTab(); |
53 ~CPluginTabBase(); | 53 ~CPluginTab(); |
54 | 54 |
55 std::wstring GetDocumentDomain(); | 55 std::wstring GetDocumentDomain(); |
56 void SetDocumentUrl(const std::wstring& url); | 56 void SetDocumentUrl(const std::wstring& url); |
57 std::wstring GetDocumentUrl(); | 57 std::wstring GetDocumentUrl(); |
58 virtual void OnActivate(); | 58 virtual void OnActivate(); |
59 virtual void OnUpdate(); | 59 virtual void OnUpdate(); |
60 virtual void OnNavigate(const std::wstring& url); | 60 virtual void OnNavigate(const std::wstring& url); |
61 virtual void OnDownloadComplete(IWebBrowser2* browser); | 61 virtual void OnDownloadComplete(IWebBrowser2* browser); |
62 virtual void OnDocumentComplete(IWebBrowser2* browser, const std::wstring& url
, bool isDocumentBrowser); | 62 virtual void OnDocumentComplete(IWebBrowser2* browser, const std::wstring& url
, bool isDocumentBrowser); |
63 static DWORD WINAPI TabThreadProc(LPVOID pParam); | 63 static DWORD WINAPI TabThreadProc(LPVOID pParam); |
64 void CacheFrame(const std::wstring& url); | 64 void CacheFrame(const std::wstring& url); |
65 bool IsFrameCached(const std::wstring& url); | 65 bool IsFrameCached(const std::wstring& url); |
66 void ClearFrameCache(const std::wstring& domain=L""); | 66 void ClearFrameCache(const std::wstring& domain=L""); |
67 }; | 67 }; |
68 | 68 |
69 /** | |
70 * Temporary class used during refactoring. | |
71 * This is the definition previously in AdblockPlusTab.h | |
72 * Defining this class during refactoring alleviates the need to rename CPluginT
abBase in the first change set. | |
73 */ | |
74 class CPluginTab : public CPluginTabBase | |
75 { | |
76 | |
77 public: | |
78 CPluginTab() : CPluginTabBase() {}; | |
79 ~CPluginTab() {}; | |
80 }; | |
81 | |
82 | |
83 | |
84 #endif // _PLUGIN_TAB_BASE_H_ | 69 #endif // _PLUGIN_TAB_BASE_H_ |
LEFT | RIGHT |