LEFT | RIGHT |
| 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 #ifndef _PLUGIN_TAB_BASE_H_ | 18 #ifndef _PLUGIN_TAB_BASE_H_ |
2 #define _PLUGIN_TAB_BASE_H_ | 19 #define _PLUGIN_TAB_BASE_H_ |
3 | 20 |
4 class CPluginDomTraverser; | 21 class CPluginDomTraverser; |
5 | 22 |
6 #include "PluginUserSettings.h" | 23 #include "PluginUserSettings.h" |
7 #include "PluginFilter.h" | 24 #include "PluginFilter.h" |
8 #include "../shared/CriticalSection.h" | 25 #include "../shared/CriticalSection.h" |
9 #include <thread> | 26 #include <thread> |
10 #include <atomic> | 27 #include <atomic> |
11 | 28 |
12 class CPluginClass; | 29 class CPluginTab |
13 | |
14 | |
15 class CPluginTabBase | |
16 { | 30 { |
17 | |
18 friend class CPluginClass; | |
19 | |
20 protected: | |
21 | |
22 CComAutoCriticalSection m_criticalSection; | 31 CComAutoCriticalSection m_criticalSection; |
23 CriticalSection m_csInject; | 32 CriticalSection m_csInject; |
24 | 33 |
25 std::wstring m_documentDomain; | 34 std::wstring m_documentDomain; |
26 CString m_documentUrl; | 35 std::wstring m_documentUrl; |
27 CPluginUserSettings m_pluginUserSettings; | 36 CPluginUserSettings m_pluginUserSettings; |
28 public: | |
29 CPluginClass* m_plugin; | |
30 protected: | |
31 bool m_isActivated; | 37 bool m_isActivated; |
32 | 38 |
33 std::thread m_thread; | 39 std::thread m_thread; |
34 std::atomic<bool> m_continueThreadRunning; | 40 std::atomic<bool> m_continueThreadRunning; |
35 CPluginDomTraverser* m_traverser; | 41 std::unique_ptr<CPluginDomTraverser> m_traverser; |
36 static int s_dictionaryVersion; | |
37 static int s_settingsVersion; | |
38 static int s_filterVersion; | |
39 public: | 42 public: |
40 std::auto_ptr<CPluginFilter> m_filter; | 43 class AsyncPluginFilter; |
| 44 std::shared_ptr<AsyncPluginFilter> m_asyncPluginFilter; |
41 private: | 45 private: |
42 static int s_whitelistVersion; | |
43 | |
44 void ThreadProc(); | 46 void ThreadProc(); |
45 CComAutoCriticalSection m_criticalSectionCache; | 47 CComAutoCriticalSection m_criticalSectionCache; |
46 std::set<CString> m_cacheFrames; | 48 std::set<std::wstring> m_cacheFrames; |
47 std::wstring m_cacheDomain; | 49 std::wstring m_cacheDomain; |
48 void SetDocumentUrl(const CString& url); | |
49 void InjectABP(IWebBrowser2* browser); | 50 void InjectABP(IWebBrowser2* browser); |
50 bool IsTraverserEnabled(); | 51 bool IsTraverserEnabled(); |
51 bool IsCSSInjectionEnabled(); | 52 bool IsCSSInjectionEnabled(); |
52 public: | 53 public: |
53 | 54 |
54 CPluginTabBase(CPluginClass* plugin); | 55 CPluginTab(); |
55 ~CPluginTabBase(); | 56 ~CPluginTab(); |
56 | 57 |
57 std::wstring GetDocumentDomain(); | 58 std::wstring GetDocumentDomain(); |
58 CString GetDocumentUrl(); | 59 void SetDocumentUrl(const std::wstring& url); |
| 60 std::wstring GetDocumentUrl(); |
59 virtual void OnActivate(); | 61 virtual void OnActivate(); |
60 virtual void OnUpdate(); | 62 virtual void OnUpdate(); |
61 virtual void OnNavigate(const CString& url); | 63 virtual void OnNavigate(const std::wstring& url); |
62 virtual void OnDownloadComplete(IWebBrowser2* browser); | 64 virtual void OnDownloadComplete(IWebBrowser2* browser); |
63 virtual void OnDocumentComplete(IWebBrowser2* browser, const CString& url, boo
l isDocumentBrowser); | 65 virtual void OnDocumentComplete(IWebBrowser2* browser, const std::wstring& url
, bool isDocumentBrowser); |
64 static DWORD WINAPI TabThreadProc(LPVOID pParam); | 66 static DWORD WINAPI TabThreadProc(LPVOID pParam); |
65 void CacheFrame(const CString& url); | 67 void CacheFrame(const std::wstring& url); |
66 bool IsFrameCached(const CString& url); | 68 bool IsFrameCached(const std::wstring& url); |
67 void ClearFrameCache(const std::wstring& domain=L""); | 69 void ClearFrameCache(const std::wstring& domain=L""); |
68 | 70 /** |
| 71 * Is it possible to disable the current content of the present tab on a per-s
ite basis? |
| 72 */ |
| 73 bool IsPossibleToDisableOnSite(); |
69 }; | 74 }; |
70 | 75 |
71 | |
72 #endif // _PLUGIN_TAB_BASE_H_ | 76 #endif // _PLUGIN_TAB_BASE_H_ |
LEFT | RIGHT |