LEFT | RIGHT |
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 16 matching lines...) Expand all Loading... |
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 | 35 |
36 void PostRequest(Communication::OutputBuffer request); | 36 void PostRequest(Communication::OutputBuffer request); |
37 Communication::InputBuffer FetchResponse(const std::wstring& name); | |
38 | |
39 public: | 37 public: |
40 | 38 |
41 static CAdblockPlusClient* s_instance; | 39 static CAdblockPlusClient* s_instance; |
42 | 40 |
43 ~CAdblockPlusClient(); | 41 ~CAdblockPlusClient(); |
44 | 42 |
45 static CAdblockPlusClient* GetInstance(); | 43 static CAdblockPlusClient* GetInstance(); |
46 | 44 |
47 // Removes the url from the list of whitelisted urls if present | 45 // Removes the url from the list of whitelisted urls if present |
48 // Only called from ui thread | 46 // Only called from ui thread |
49 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); |
50 | 48 |
51 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); |
52 bool IsWhitelistedUrl(const std::wstring& url); | 50 bool IsWhitelistedUrl(const std::wstring& url); |
53 | 51 |
54 int GetIEVersion(); | 52 int GetIEVersion(); |
55 | 53 |
56 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); |
57 std::vector<std::wstring> GetElementHidingSelectors(const std::wstring& domain
); | 55 std::vector<std::wstring> GetElementHidingSelectors(const std::wstring& domain
); |
58 std::vector<SubscriptionDescription> FetchAvailableSubscriptions(); | 56 std::vector<SubscriptionDescription> FetchAvailableSubscriptions(); |
59 std::vector<SubscriptionDescription> GetListedSubscriptions(); | 57 std::vector<SubscriptionDescription> GetListedSubscriptions(); |
60 void SetSubscription(const std::wstring& url); | 58 void SetSubscription(const std::wstring& url); |
61 void UpdateAllSubscriptions(); | 59 void UpdateAllSubscriptions(); |
62 std::vector<std::wstring> GetExceptionDomains(); | 60 std::vector<std::wstring> GetExceptionDomains(); |
63 void AddFilter(const std::wstring& text); | 61 void AddFilter(const std::wstring& text); |
64 void RemoveFilter(const std::wstring& text); | 62 void RemoveFilter(const std::wstring& text); |
65 void SetPref(const std::wstring& name, const std::wstring& value); | 63 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); | 64 void SetPref(const std::wstring& name, const int64_t& value); |
68 void SetPref(const std::wstring& name, bool value); | 65 void SetPref(const std::wstring& name, bool value); |
69 std::wstring GetPref(const std::wstring& name, const std::wstring& defaultValu
e = L""); | 66 std::wstring GetPref(const std::wstring& name, const std::wstring& defaultValu
e = L""); |
70 std::wstring GetPref(const std::wstring& name, LPCWSTR defaultValue); | 67 std::wstring GetPref(const std::wstring& name, const wchar_t* defaultValue); |
71 bool GetPref(const std::wstring& name, bool defaultValue = false); | 68 bool GetPref(const std::wstring& name, bool defaultValue = false); |
72 int64_t GetPref(const std::wstring& name, int64_t defaultValue = 0); | 69 int64_t GetPref(const std::wstring& name, int64_t defaultValue = 0); |
73 | 70 |
74 bool IsFirstRun(); | 71 bool IsFirstRun(); |
75 }; | 72 }; |
76 | 73 |
77 #endif // _ADBLOCK_PLUS_CLIENT_H_ | 74 #endif // _ADBLOCK_PLUS_CLIENT_H_ |
LEFT | RIGHT |