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

Side by Side Diff: src/plugin/PluginTabBase.h

Issue 29331767: Issue #1234 + Clean up - CPluginTab (dead code, nullptr defect fix, etc.) (Closed)
Patch Set: remove CString Created Dec. 3, 2015, 7:42 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/plugin/PluginDomTraverserBase.h ('k') | src/plugin/PluginTabBase.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 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 CPluginDomTraverser* m_traverser;
53 public: 42 public:
54 std::auto_ptr<CPluginFilter> m_filter; 43 CPluginFilter m_filter;
55 private: 44 private:
56 void ThreadProc(); 45 void ThreadProc();
57 CComAutoCriticalSection m_criticalSectionCache; 46 CComAutoCriticalSection m_criticalSectionCache;
58 std::set<std::wstring> m_cacheFrames; 47 std::set<std::wstring> m_cacheFrames;
59 std::wstring m_cacheDomain; 48 std::wstring m_cacheDomain;
60 void SetDocumentUrl(const std::wstring& url);
61 void InjectABP(IWebBrowser2* browser); 49 void InjectABP(IWebBrowser2* browser);
62 public: 50 public:
63 51
64 CPluginTabBase(CPluginClass* plugin); 52 CPluginTab();
65 ~CPluginTabBase(); 53 ~CPluginTab();
66 54
67 std::wstring GetDocumentDomain(); 55 std::wstring GetDocumentDomain();
56 void SetDocumentUrl(const std::wstring& url);
68 std::wstring GetDocumentUrl(); 57 std::wstring GetDocumentUrl();
69 virtual void OnActivate(); 58 virtual void OnActivate();
70 virtual void OnUpdate(); 59 virtual void OnUpdate();
71 virtual void OnNavigate(const std::wstring& url); 60 virtual void OnNavigate(const std::wstring& url);
72 virtual void OnDownloadComplete(IWebBrowser2* browser); 61 virtual void OnDownloadComplete(IWebBrowser2* browser);
73 virtual void OnDocumentComplete(IWebBrowser2* browser, const std::wstring& url , bool isDocumentBrowser); 62 virtual void OnDocumentComplete(IWebBrowser2* browser, const std::wstring& url , bool isDocumentBrowser);
74 static DWORD WINAPI TabThreadProc(LPVOID pParam); 63 static DWORD WINAPI TabThreadProc(LPVOID pParam);
75 void CacheFrame(const std::wstring& url); 64 void CacheFrame(const std::wstring& url);
76 bool IsFrameCached(const std::wstring& url); 65 bool IsFrameCached(const std::wstring& url);
77 void ClearFrameCache(const std::wstring& domain=L""); 66 void ClearFrameCache(const std::wstring& domain=L"");
78
79 }; 67 };
80 68
81 /**
82 * Temporary class used during refactoring.
83 * This is the definition previously in AdblockPlusTab.h
84 * Defining this class during refactoring alleviates the need to rename CPluginT abBase in the first change set.
85 */
86 class CPluginTab : public CPluginTabBase
87 {
88
89 public:
90 CPluginTab(CPluginClass* plugin) : CPluginTabBase(plugin) {};
91 ~CPluginTab() {};
92 };
93
94
95
96 #endif // _PLUGIN_TAB_BASE_H_ 69 #endif // _PLUGIN_TAB_BASE_H_
OLDNEW
« no previous file with comments | « src/plugin/PluginDomTraverserBase.h ('k') | src/plugin/PluginTabBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld