| Left: | ||
| Right: |
| 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 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 | 64 |
| 65 ~CAdblockPlusClient(); | 65 ~CAdblockPlusClient(); |
| 66 | 66 |
| 67 static CAdblockPlusClient* GetInstance(); | 67 static CAdblockPlusClient* GetInstance(); |
| 68 | 68 |
| 69 // Removes the url from the list of whitelisted urls if present | 69 // Removes the url from the list of whitelisted urls if present |
| 70 // Only called from ui thread | 70 // Only called from ui thread |
| 71 bool ShouldBlock(const std::wstring& src, AdblockPlus::FilterEngine::ContentTy pe contentType, const std::wstring& domain, bool addDebug=false); | 71 bool ShouldBlock(const std::wstring& src, AdblockPlus::FilterEngine::ContentTy pe contentType, const std::wstring& domain, bool addDebug=false); |
| 72 | 72 |
| 73 bool IsElementHidden(const std::wstring& tag, IHTMLElement* pEl, const std::ws tring& domain, const std::wstring& indent, CPluginFilter* filter); | 73 bool IsElementHidden(const std::wstring& tag, IHTMLElement* pEl, const std::ws tring& domain, const std::wstring& indent, CPluginFilter* filter); |
| 74 bool IsWhitelistedUrl(const std::wstring& url); | 74 struct ExceptionFilter |
|
Eric
2015/03/04 13:55:39
I am generally in favor of adding simple classes l
| |
| 75 { | |
| 76 operator bool() const | |
| 77 { | |
| 78 return !filterText.empty(); | |
| 79 } | |
| 80 std::string filterText; | |
| 81 }; | |
| 82 ExceptionFilter IsWhitelistedUrl(const std::wstring& url); | |
|
Oleksandr
2015/03/05 07:35:27
How about:
bool IsWhitelistedUrl(const std::wstri
| |
| 75 bool IsElemhideWhitelistedOnDomain(const std::wstring& url); | 83 bool IsElemhideWhitelistedOnDomain(const std::wstring& url); |
| 76 | 84 |
| 77 bool Matches(const std::wstring& url, AdblockPlus::FilterEngine::ContentType c ontentType, const std::wstring& domain); | 85 bool Matches(const std::wstring& url, AdblockPlus::FilterEngine::ContentType c ontentType, const std::wstring& domain); |
| 78 std::vector<std::wstring> GetElementHidingSelectors(const std::wstring& domain ); | 86 std::vector<std::wstring> GetElementHidingSelectors(const std::wstring& domain ); |
| 79 std::vector<SubscriptionDescription> FetchAvailableSubscriptions(); | 87 std::vector<SubscriptionDescription> FetchAvailableSubscriptions(); |
| 80 std::vector<SubscriptionDescription> GetListedSubscriptions(); | 88 std::vector<SubscriptionDescription> GetListedSubscriptions(); |
| 81 bool IsAcceptableAdsEnabled(); | 89 bool IsAcceptableAdsEnabled(); |
| 82 void SetSubscription(const std::wstring& url); | 90 void SetSubscription(const std::wstring& url); |
| 83 void AddSubscription(const std::wstring& url); | 91 void AddSubscription(const std::wstring& url); |
| 84 void RemoveSubscription(const std::wstring& url); | 92 void RemoveSubscription(const std::wstring& url); |
| 85 void UpdateAllSubscriptions(); | 93 void UpdateAllSubscriptions(); |
| 86 std::vector<std::wstring> GetExceptionDomains(); | 94 std::vector<std::wstring> GetExceptionDomains(); |
| 87 void AddFilter(const std::wstring& text); | 95 void AddFilter(const std::wstring& text); |
| 88 void RemoveFilter(const std::wstring& text); | 96 void RemoveFilter(const std::wstring& text); |
| 97 void RemoveFilter(const std::string& text); | |
| 89 void SetPref(const std::wstring& name, const std::wstring& value); | 98 void SetPref(const std::wstring& name, const std::wstring& value); |
| 90 void SetPref(const std::wstring& name, const int64_t& value); | 99 void SetPref(const std::wstring& name, const int64_t& value); |
| 91 void SetPref(const std::wstring& name, bool value); | 100 void SetPref(const std::wstring& name, bool value); |
| 92 std::wstring GetPref(const std::wstring& name, const std::wstring& defaultValu e = L""); | 101 std::wstring GetPref(const std::wstring& name, const std::wstring& defaultValu e = L""); |
| 93 std::wstring GetPref(const std::wstring& name, const wchar_t* defaultValue); | 102 std::wstring GetPref(const std::wstring& name, const wchar_t* defaultValue); |
| 94 bool GetPref(const std::wstring& name, bool defaultValue = false); | 103 bool GetPref(const std::wstring& name, bool defaultValue = false); |
| 95 int64_t GetPref(const std::wstring& name, int64_t defaultValue = 0); | 104 int64_t GetPref(const std::wstring& name, int64_t defaultValue = 0); |
| 96 void CheckForUpdates(HWND callbackWindow); | 105 void CheckForUpdates(HWND callbackWindow); |
| 97 std::wstring GetAppLocale(); | 106 std::wstring GetAppLocale(); |
| 98 std::wstring GetDocumentationLink(); | 107 std::wstring GetDocumentationLink(); |
| 99 bool TogglePluginEnabled(); | 108 bool TogglePluginEnabled(); |
| 100 std::wstring GetHostFromUrl(const std::wstring& url); | 109 std::wstring GetHostFromUrl(const std::wstring& url); |
| 101 int CompareVersions(const std::wstring& v1, const std::wstring& v2); | 110 int CompareVersions(const std::wstring& v1, const std::wstring& v2); |
| 102 | 111 |
| 103 bool IsFirstRun(); | 112 bool IsFirstRun(); |
| 104 }; | 113 }; |
| 105 | 114 |
| 106 #endif // _ADBLOCK_PLUS_CLIENT_H_ | 115 #endif // _ADBLOCK_PLUS_CLIENT_H_ |
| OLD | NEW |