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

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

Issue 11013110: Cleanup (Closed)
Patch Set: Whole cleanup + comments addressed Created July 23, 2013, 11:34 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 #ifndef _ADBLOCK_PLUS_CLIENT_H_ 1 #ifndef _ADBLOCK_PLUS_CLIENT_H_
2 #define _ADBLOCK_PLUS_CLIENT_H_ 2 #define _ADBLOCK_PLUS_CLIENT_H_
3 3
4 4
5 #include "PluginTypedef.h" 5 #include "PluginTypedef.h"
6 #include "PluginClientBase.h" 6 #include "PluginClientBase.h"
7 #include "../shared/Communication.h"
7 8
8 9
9 class CPluginFilter; 10 class CPluginFilter;
10 11
11 struct SubscriptionDescription 12 struct SubscriptionDescription
12 { 13 {
13 std::wstring url; 14 std::wstring url;
14 std::wstring title; 15 std::wstring title;
15 std::wstring specialization; 16 std::wstring specialization;
16 bool listed; 17 bool listed;
17 }; 18 };
18 19
19 class CAdblockPlusClient : public CPluginClientBase 20 class CAdblockPlusClient : public CPluginClientBase
20 { 21 {
21 22
22 private: 23 private:
23 24
24 std::auto_ptr<CPluginFilter> m_filter; 25 std::auto_ptr<CPluginFilter> m_filter;
25 26
26 CComAutoCriticalSection m_criticalSectionFilter; 27 CComAutoCriticalSection m_criticalSectionFilter;
27 CComAutoCriticalSection m_criticalSectionCache; 28 CComAutoCriticalSection m_criticalSectionCache;
28 29
29 std::map<CString,bool> m_cacheBlockedSources; 30 std::map<CString,bool> m_cacheBlockedSources;
30 31
31 32
32 // Private constructor used by the singleton pattern 33 // Private constructor used by the singleton pattern
33 CAdblockPlusClient(); 34 CAdblockPlusClient();
34 35
36 void PostRequest(Communication::OutputBuffer request);
35 public: 37 public:
36 38
37 static CAdblockPlusClient* s_instance; 39 static CAdblockPlusClient* s_instance;
38 40
39 ~CAdblockPlusClient(); 41 ~CAdblockPlusClient();
40 42
41 static CAdblockPlusClient* GetInstance(); 43 static CAdblockPlusClient* GetInstance();
42 44
43 // Removes the url from the list of whitelisted urls if present 45 // Removes the url from the list of whitelisted urls if present
44 // Only called from ui thread 46 // Only called from ui thread
45 bool ShouldBlock(CString src, int contentType, const CString& domain, bool add Debug=false); 47 bool ShouldBlock(CString src, int contentType, const CString& domain, bool add Debug=false);
46 48
47 bool IsElementHidden(const CString& tag, IHTMLElement* pEl, const CString& dom ain, const CString& indent, CPluginFilter* filter); 49 bool IsElementHidden(const CString& tag, IHTMLElement* pEl, const CString& dom ain, const CString& indent, CPluginFilter* filter);
48 bool IsWhitelistedUrl(const std::wstring& url); 50 bool IsWhitelistedUrl(const std::wstring& url);
49 51
50 int GetIEVersion(); 52 int GetIEVersion();
51 53
52 bool Matches(const std::wstring& url, const std::wstring& contentType, const s td::wstring& domain); 54 bool Matches(const std::wstring& url, const std::wstring& contentType, const s td::wstring& domain);
53 std::vector<std::wstring> GetElementHidingSelectors(const std::wstring& domain ); 55 std::vector<std::wstring> GetElementHidingSelectors(const std::wstring& domain );
54 std::vector<SubscriptionDescription> FetchAvailableSubscriptions(); 56 std::vector<SubscriptionDescription> FetchAvailableSubscriptions();
55 std::vector<SubscriptionDescription> GetListedSubscriptions(); 57 std::vector<SubscriptionDescription> GetListedSubscriptions();
56 void SetSubscription(const std::wstring& url); 58 void SetSubscription(const std::wstring& url);
57 void UpdateAllSubscriptions(); 59 void UpdateAllSubscriptions();
58 std::vector<std::wstring> GetExceptionDomains(); 60 std::vector<std::wstring> GetExceptionDomains();
59 void AddFilter(const std::wstring& text); 61 void AddFilter(const std::wstring& text);
60 void RemoveFilter(const std::wstring& text); 62 void RemoveFilter(const std::wstring& text);
63 void SetPref(const std::wstring& name, const std::wstring& value);
64 void SetPref(const std::wstring& name, const int64_t& value);
65 void SetPref(const std::wstring& name, bool value);
66 std::wstring GetPref(const std::wstring& name, const std::wstring& defaultValu e = L"");
67 std::wstring GetPref(const std::wstring& name, const wchar_t* defaultValue);
68 bool GetPref(const std::wstring& name, bool defaultValue = false);
69 int64_t GetPref(const std::wstring& name, int64_t defaultValue = 0);
61 }; 70 };
62 71
63 #endif // _ADBLOCK_PLUS_CLIENT_H_ 72 #endif // _ADBLOCK_PLUS_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld