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-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 CPluginDomTraverser* m_traverser; | 37 CPluginDomTraverser* m_traverser; |
49 public: | 38 public: |
50 std::auto_ptr<CPluginFilter> m_filter; | 39 CPluginFilter m_filter; |
51 private: | 40 private: |
52 CComAutoCriticalSection m_criticalSectionCache; | 41 CComAutoCriticalSection m_criticalSectionCache; |
53 std::set<std::wstring> m_cacheFrames; | 42 std::set<std::wstring> m_cacheFrames; |
54 std::wstring m_cacheDomain; | 43 std::wstring m_cacheDomain; |
55 void SetDocumentUrl(const std::wstring& url); | |
56 void InjectABP(IWebBrowser2* browser); | 44 void InjectABP(IWebBrowser2* browser); |
57 public: | 45 public: |
58 | 46 |
59 CPluginTabBase(CPluginClass* plugin); | 47 CPluginTab(); |
60 ~CPluginTabBase(); | 48 ~CPluginTab(); |
61 | 49 |
62 std::wstring GetDocumentDomain(); | 50 std::wstring GetDocumentDomain(); |
| 51 void SetDocumentUrl(const std::wstring& url); |
63 std::wstring GetDocumentUrl(); | 52 std::wstring GetDocumentUrl(); |
64 virtual void OnNavigate(const std::wstring& url); | 53 virtual void OnNavigate(const std::wstring& url); |
65 virtual void OnDownloadComplete(IWebBrowser2* browser); | 54 virtual void OnDownloadComplete(IWebBrowser2* browser); |
66 virtual void OnDocumentComplete(IWebBrowser2* browser, const std::wstring& url
, bool isDocumentBrowser); | 55 virtual void OnDocumentComplete(IWebBrowser2* browser, const std::wstring& url
, bool isDocumentBrowser); |
67 void CacheFrame(const std::wstring& url); | 56 void CacheFrame(const std::wstring& url); |
68 bool IsFrameCached(const std::wstring& url); | 57 bool IsFrameCached(const std::wstring& url); |
69 void ClearFrameCache(const std::wstring& domain=L""); | 58 void ClearFrameCache(const std::wstring& domain=L""); |
70 | 59 /** |
| 60 * Is it possible to disable the current content of the present tab on a per-s
ite basis? |
| 61 */ |
| 62 bool IsPossibleToDisableOnSite(); |
71 }; | 63 }; |
72 | 64 |
73 /** | |
74 * Temporary class used during refactoring. | |
75 * This is the definition previously in AdblockPlusTab.h | |
76 * Defining this class during refactoring alleviates the need to rename CPluginT
abBase in the first change set. | |
77 */ | |
78 class CPluginTab : public CPluginTabBase | |
79 { | |
80 | |
81 public: | |
82 CPluginTab(CPluginClass* plugin) : CPluginTabBase(plugin) {}; | |
83 ~CPluginTab() {}; | |
84 }; | |
85 | |
86 | |
87 | |
88 #endif // _PLUGIN_TAB_BASE_H_ | 65 #endif // _PLUGIN_TAB_BASE_H_ |
LEFT | RIGHT |