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

Delta Between Two Patch Sets: src/plugin/AdblockPlusClient.h

Issue 11013110: Cleanup (Closed)
Left Patch Set: SetPref/GetPref type safety. Comments addressed. Created July 22, 2013, 12:42 a.m.
Right Patch Set: More beautification and addressing comments Created July 29, 2013, 12:13 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/plugin/AdblockPlus.rc ('k') | src/plugin/AdblockPlusClient.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 #include "../shared/Communication.h"
8 8
9 9
10 class CPluginFilter; 10 class CPluginFilter;
(...skipping 14 matching lines...) Expand all
25 std::auto_ptr<CPluginFilter> m_filter; 25 std::auto_ptr<CPluginFilter> m_filter;
26 26
27 CComAutoCriticalSection m_criticalSectionFilter; 27 CComAutoCriticalSection m_criticalSectionFilter;
28 CComAutoCriticalSection m_criticalSectionCache; 28 CComAutoCriticalSection m_criticalSectionCache;
29 29
30 std::map<CString,bool> m_cacheBlockedSources; 30 std::map<CString,bool> m_cacheBlockedSources;
31 31
32 32
33 // Private constructor used by the singleton pattern 33 // Private constructor used by the singleton pattern
34 CAdblockPlusClient(); 34 CAdblockPlusClient();
35
36 void PostRequest(Communication::OutputBuffer request);
37 Communication::InputBuffer FetchResponse(const std::wstring& name);
38
39 public: 35 public:
40 36
41 static CAdblockPlusClient* s_instance; 37 static CAdblockPlusClient* s_instance;
42 38
43 ~CAdblockPlusClient(); 39 ~CAdblockPlusClient();
44 40
45 static CAdblockPlusClient* GetInstance(); 41 static CAdblockPlusClient* GetInstance();
46 42
47 // Removes the url from the list of whitelisted urls if present 43 // Removes the url from the list of whitelisted urls if present
48 // Only called from ui thread 44 // Only called from ui thread
49 bool ShouldBlock(CString src, int contentType, const CString& domain, bool add Debug=false); 45 bool ShouldBlock(CString src, int contentType, const CString& domain, bool add Debug=false);
50 46
51 bool IsElementHidden(const CString& tag, IHTMLElement* pEl, const CString& dom ain, const CString& indent, CPluginFilter* filter); 47 bool IsElementHidden(const CString& tag, IHTMLElement* pEl, const CString& dom ain, const CString& indent, CPluginFilter* filter);
52 bool IsWhitelistedUrl(const std::wstring& url); 48 bool IsWhitelistedUrl(const std::wstring& url);
53 49
54 int GetIEVersion(); 50 int GetIEVersion();
55 51
56 bool Matches(const std::wstring& url, const std::wstring& contentType, const s td::wstring& domain); 52 bool Matches(const std::wstring& url, const std::wstring& contentType, const s td::wstring& domain);
57 std::vector<std::wstring> GetElementHidingSelectors(const std::wstring& domain ); 53 std::vector<std::wstring> GetElementHidingSelectors(const std::wstring& domain );
58 std::vector<SubscriptionDescription> FetchAvailableSubscriptions(); 54 std::vector<SubscriptionDescription> FetchAvailableSubscriptions();
59 std::vector<SubscriptionDescription> GetListedSubscriptions(); 55 std::vector<SubscriptionDescription> GetListedSubscriptions();
60 void SetSubscription(const std::wstring& url); 56 void SetSubscription(const std::wstring& url);
61 void UpdateAllSubscriptions(); 57 void UpdateAllSubscriptions();
62 std::vector<std::wstring> GetExceptionDomains(); 58 std::vector<std::wstring> GetExceptionDomains();
63 void AddFilter(const std::wstring& text); 59 void AddFilter(const std::wstring& text);
64 void RemoveFilter(const std::wstring& text); 60 void RemoveFilter(const std::wstring& text);
65 void SetPref(const std::wstring& name, const std::wstring& value); 61 void SetPref(const std::wstring& name, const std::wstring& value);
66 void SetPref(const std::string& name, const std::string& value);
67 void SetPref(const std::wstring& name, const int64_t& value); 62 void SetPref(const std::wstring& name, const int64_t& value);
68 void SetPref(const std::wstring& name, bool value); 63 void SetPref(const std::wstring& name, bool value);
69 std::wstring GetPref(const std::wstring& name, const std::wstring& defaultValu e = L""); 64 std::wstring GetPref(const std::wstring& name, const std::wstring& defaultValu e = L"");
70 std::wstring GetPref(const std::wstring& name, LPCWSTR defaultValue); 65 std::wstring GetPref(const std::wstring& name, const wchar_t* defaultValue);
71 bool GetPref(const std::wstring& name, bool defaultValue = false); 66 bool GetPref(const std::wstring& name, bool defaultValue = false);
72 int64_t GetPref(const std::wstring& name, int64_t defaultValue = 0); 67 int64_t GetPref(const std::wstring& name, int64_t defaultValue = 0);
73 }; 68 };
74 69
75 #endif // _ADBLOCK_PLUS_CLIENT_H_ 70 #endif // _ADBLOCK_PLUS_CLIENT_H_
LEFTRIGHT

Powered by Google App Engine
This is Rietveld