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 #include "../shared/CriticalSection.h" | 8 #include "../shared/CriticalSection.h" |
9 | 9 |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 class CAdblockPlusClient : public CPluginClientBase | 21 class CAdblockPlusClient : public CPluginClientBase |
22 { | 22 { |
23 | 23 |
24 private: | 24 private: |
25 | 25 |
26 std::auto_ptr<CPluginFilter> m_filter; | 26 std::auto_ptr<CPluginFilter> m_filter; |
27 | 27 |
28 CComAutoCriticalSection m_criticalSectionFilter; | 28 CComAutoCriticalSection m_criticalSectionFilter; |
29 CComAutoCriticalSection m_criticalSectionCache; | 29 CComAutoCriticalSection m_criticalSectionCache; |
30 | 30 |
31 std::map<CString,bool> m_cacheBlockedSources; | 31 std::map<std::wstring, bool> m_cacheBlockedSources; |
32 | 32 |
33 std::shared_ptr<Communication::Pipe> enginePipe; | 33 std::shared_ptr<Communication::Pipe> enginePipe; |
34 CriticalSection enginePipeLock; | 34 CriticalSection enginePipeLock; |
35 | 35 |
36 | 36 |
37 // Private constructor used by the singleton pattern | 37 // Private constructor used by the singleton pattern |
38 CAdblockPlusClient(); | 38 CAdblockPlusClient(); |
39 | 39 |
40 bool CallEngine(Communication::OutputBuffer& message, Communication::InputBuff
er& inputBuffer = Communication::InputBuffer()); | 40 bool CallEngine(Communication::OutputBuffer& message, Communication::InputBuff
er& inputBuffer = Communication::InputBuffer()); |
41 bool CallEngine(Communication::ProcType proc, Communication::InputBuffer& inpu
tBuffer = Communication::InputBuffer()); | 41 bool CallEngine(Communication::ProcType proc, Communication::InputBuffer& inpu
tBuffer = Communication::InputBuffer()); |
42 public: | 42 public: |
43 | 43 |
44 static CAdblockPlusClient* s_instance; | 44 static CAdblockPlusClient* s_instance; |
45 | 45 |
46 ~CAdblockPlusClient(); | 46 ~CAdblockPlusClient(); |
47 | 47 |
48 static CAdblockPlusClient* GetInstance(); | 48 static CAdblockPlusClient* GetInstance(); |
49 | 49 |
50 // Removes the url from the list of whitelisted urls if present | 50 // Removes the url from the list of whitelisted urls if present |
51 // Only called from ui thread | 51 // Only called from ui thread |
52 bool ShouldBlock(CString src, int contentType, const CString& domain, bool add
Debug=false); | 52 bool ShouldBlock(const std::wstring& src, int contentType, const std::wstring&
domain, bool addDebug=false); |
53 | 53 |
54 bool IsElementHidden(const CString& tag, IHTMLElement* pEl, const CString& dom
ain, const CString& indent, CPluginFilter* filter); | 54 bool IsElementHidden(const std::wstring& tag, IHTMLElement* pEl, const std::ws
tring& domain, const std::wstring& indent, CPluginFilter* filter); |
55 bool IsWhitelistedUrl(const std::wstring& url); | 55 bool IsWhitelistedUrl(const std::wstring& url); |
| 56 bool IsElemhideWhitelistedOnDomain(const std::wstring& url); |
56 | 57 |
57 bool Matches(const std::wstring& url, const std::wstring& contentType, const s
td::wstring& domain); | 58 bool Matches(const std::wstring& url, const std::wstring& contentType, const s
td::wstring& domain); |
58 std::vector<std::wstring> GetElementHidingSelectors(const std::wstring& domain
); | 59 std::vector<std::wstring> GetElementHidingSelectors(const std::wstring& domain
); |
59 std::vector<SubscriptionDescription> FetchAvailableSubscriptions(); | 60 std::vector<SubscriptionDescription> FetchAvailableSubscriptions(); |
60 std::vector<SubscriptionDescription> GetListedSubscriptions(); | 61 std::vector<SubscriptionDescription> GetListedSubscriptions(); |
61 bool IsAcceptableAdsEnabled(); | 62 bool IsAcceptableAdsEnabled(); |
62 void SetSubscription(const std::wstring& url); | 63 void SetSubscription(const std::wstring& url); |
63 void AddSubscription(const std::wstring& url); | 64 void AddSubscription(const std::wstring& url); |
64 void RemoveSubscription(const std::wstring& url); | 65 void RemoveSubscription(const std::wstring& url); |
65 void UpdateAllSubscriptions(); | 66 void UpdateAllSubscriptions(); |
66 std::vector<std::wstring> GetExceptionDomains(); | 67 std::vector<std::wstring> GetExceptionDomains(); |
67 void AddFilter(const std::wstring& text); | 68 void AddFilter(const std::wstring& text); |
68 void RemoveFilter(const std::wstring& text); | 69 void RemoveFilter(const std::wstring& text); |
69 void SetPref(const std::wstring& name, const std::wstring& value); | 70 void SetPref(const std::wstring& name, const std::wstring& value); |
70 void SetPref(const std::wstring& name, const int64_t& value); | 71 void SetPref(const std::wstring& name, const int64_t& value); |
71 void SetPref(const std::wstring& name, bool value); | 72 void SetPref(const std::wstring& name, bool value); |
72 std::wstring GetPref(const std::wstring& name, const std::wstring& defaultValu
e = L""); | 73 std::wstring GetPref(const std::wstring& name, const std::wstring& defaultValu
e = L""); |
73 std::wstring GetPref(const std::wstring& name, const wchar_t* defaultValue); | 74 std::wstring GetPref(const std::wstring& name, const wchar_t* defaultValue); |
74 bool GetPref(const std::wstring& name, bool defaultValue = false); | 75 bool GetPref(const std::wstring& name, bool defaultValue = false); |
75 int64_t GetPref(const std::wstring& name, int64_t defaultValue = 0); | 76 int64_t GetPref(const std::wstring& name, int64_t defaultValue = 0); |
76 void CheckForUpdates(HWND callbackWindow); | 77 void CheckForUpdates(HWND callbackWindow); |
77 std::wstring GetAppLocale(); | 78 std::wstring GetAppLocale(); |
78 std::wstring GetDocumentationLink(); | 79 std::wstring GetDocumentationLink(); |
79 bool TogglePluginEnabled(); | 80 bool TogglePluginEnabled(); |
80 std::wstring GetHostFromUrl(const std::wstring& url); | 81 std::wstring GetHostFromUrl(const std::wstring& url); |
| 82 int CompareVersions(const std::wstring& v1, const std::wstring& v2); |
81 | 83 |
82 bool IsFirstRun(); | 84 bool IsFirstRun(); |
83 }; | 85 }; |
84 | 86 |
85 #endif // _ADBLOCK_PLUS_CLIENT_H_ | 87 #endif // _ADBLOCK_PLUS_CLIENT_H_ |
LEFT | RIGHT |