| OLD | NEW | 
|---|
| 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 _ADBLOCK_PLUS_CLIENT_H_ | 18 #ifndef _ADBLOCK_PLUS_CLIENT_H_ | 
| 19 #define _ADBLOCK_PLUS_CLIENT_H_ | 19 #define _ADBLOCK_PLUS_CLIENT_H_ | 
| 20 | 20 | 
| 21 | 21 | 
| 22 #include "PluginTypedef.h" | 22 #include "PluginTypedef.h" | 
| 23 #include "PluginClientBase.h" | 23 #include "PluginClientBase.h" | 
| 24 #include "../shared/Communication.h" | 24 #include "../shared/Communication.h" | 
| 25 #include "../shared/CriticalSection.h" | 25 #include "../shared/CriticalSection.h" | 
|  | 26 #include <AdblockPlus/FilterEngine.h> | 
| 26 | 27 | 
| 27 | 28 | 
| 28 class CPluginFilter; | 29 class CPluginFilter; | 
| 29 | 30 | 
| 30 struct SubscriptionDescription | 31 struct SubscriptionDescription | 
| 31 { | 32 { | 
| 32   std::wstring url; | 33   std::wstring url; | 
| 33   std::wstring title; | 34   std::wstring title; | 
| 34   std::wstring specialization; | 35   std::wstring specialization; | 
| 35   bool listed; | 36   bool listed; | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
| 59 public: | 60 public: | 
| 60 | 61 | 
| 61   static CAdblockPlusClient* s_instance; | 62   static CAdblockPlusClient* s_instance; | 
| 62 | 63 | 
| 63   ~CAdblockPlusClient(); | 64   ~CAdblockPlusClient(); | 
| 64 | 65 | 
| 65   static CAdblockPlusClient* GetInstance(); | 66   static CAdblockPlusClient* GetInstance(); | 
| 66 | 67 | 
| 67   // Removes the url from the list of whitelisted urls if present | 68   // Removes the url from the list of whitelisted urls if present | 
| 68   // Only called from ui thread | 69   // Only called from ui thread | 
| 69   bool ShouldBlock(const std::wstring& src, int contentType, const std::wstring&
      domain, bool addDebug=false); | 70   bool ShouldBlock(const std::wstring& src, AdblockPlus::FilterEngine::ContentTy
     pe contentType, const std::wstring& domain, bool addDebug=false); | 
| 70 | 71 | 
| 71   bool IsElementHidden(const std::wstring& tag, IHTMLElement* pEl, const std::ws
     tring& domain, const std::wstring& indent, CPluginFilter* filter); | 72   bool IsElementHidden(const std::wstring& tag, IHTMLElement* pEl, const std::ws
     tring& domain, const std::wstring& indent, CPluginFilter* filter); | 
| 72   bool IsWhitelistedUrl(const std::wstring& url); | 73   bool IsWhitelistedUrl(const std::wstring& url); | 
| 73   bool IsElemhideWhitelistedOnDomain(const std::wstring& url); | 74   bool IsElemhideWhitelistedOnDomain(const std::wstring& url); | 
| 74 | 75 | 
| 75   bool Matches(const std::wstring& url, const std::wstring& contentType, const s
     td::wstring& domain); | 76   bool Matches(const std::wstring& url, AdblockPlus::FilterEngine::ContentType c
     ontentType, const std::wstring& domain); | 
| 76   std::vector<std::wstring> GetElementHidingSelectors(const std::wstring& domain
     ); | 77   std::vector<std::wstring> GetElementHidingSelectors(const std::wstring& domain
     ); | 
| 77   std::vector<SubscriptionDescription> FetchAvailableSubscriptions(); | 78   std::vector<SubscriptionDescription> FetchAvailableSubscriptions(); | 
| 78   std::vector<SubscriptionDescription> GetListedSubscriptions(); | 79   std::vector<SubscriptionDescription> GetListedSubscriptions(); | 
| 79   bool IsAcceptableAdsEnabled(); | 80   bool IsAcceptableAdsEnabled(); | 
| 80   void SetSubscription(const std::wstring& url); | 81   void SetSubscription(const std::wstring& url); | 
| 81   void AddSubscription(const std::wstring& url); | 82   void AddSubscription(const std::wstring& url); | 
| 82   void RemoveSubscription(const std::wstring& url); | 83   void RemoveSubscription(const std::wstring& url); | 
| 83   void UpdateAllSubscriptions(); | 84   void UpdateAllSubscriptions(); | 
| 84   std::vector<std::wstring> GetExceptionDomains(); | 85   std::vector<std::wstring> GetExceptionDomains(); | 
| 85   void AddFilter(const std::wstring& text); | 86   void AddFilter(const std::wstring& text); | 
| 86   void RemoveFilter(const std::wstring& text); | 87   void RemoveFilter(const std::wstring& text); | 
| 87   void SetPref(const std::wstring& name, const std::wstring& value); | 88   void SetPref(const std::wstring& name, const std::wstring& value); | 
| 88   void SetPref(const std::wstring& name, const int64_t& value); | 89   void SetPref(const std::wstring& name, const int64_t& value); | 
| 89   void SetPref(const std::wstring& name, bool value); | 90   void SetPref(const std::wstring& name, bool value); | 
| 90   std::wstring GetPref(const std::wstring& name, const std::wstring& defaultValu
     e = L""); | 91   std::wstring GetPref(const std::wstring& name, const std::wstring& defaultValu
     e = L""); | 
| 91   std::wstring GetPref(const std::wstring& name, const wchar_t* defaultValue); | 92   std::wstring GetPref(const std::wstring& name, const wchar_t* defaultValue); | 
| 92   bool GetPref(const std::wstring& name, bool defaultValue = false); | 93   bool GetPref(const std::wstring& name, bool defaultValue = false); | 
| 93   int64_t GetPref(const std::wstring& name, int64_t defaultValue = 0); | 94   int64_t GetPref(const std::wstring& name, int64_t defaultValue = 0); | 
| 94   void CheckForUpdates(HWND callbackWindow); | 95   void CheckForUpdates(HWND callbackWindow); | 
| 95   std::wstring GetAppLocale(); | 96   std::wstring GetAppLocale(); | 
| 96   std::wstring GetDocumentationLink(); | 97   std::wstring GetDocumentationLink(); | 
| 97   bool TogglePluginEnabled(); | 98   bool TogglePluginEnabled(); | 
| 98   std::wstring GetHostFromUrl(const std::wstring& url); | 99   std::wstring GetHostFromUrl(const std::wstring& url); | 
| 99   int CompareVersions(const std::wstring& v1, const std::wstring& v2); | 100   int CompareVersions(const std::wstring& v1, const std::wstring& v2); | 
| 100 | 101 | 
| 101   bool IsFirstRun(); | 102   bool IsFirstRun(); | 
| 102 }; | 103 }; | 
| 103 | 104 | 
| 104 #endif // _ADBLOCK_PLUS_CLIENT_H_ | 105 #endif // _ADBLOCK_PLUS_CLIENT_H_ | 
| OLD | NEW | 
|---|