| 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 15 matching lines...) Expand all Loading... |
| 26 #include "PluginMutex.h" | 26 #include "PluginMutex.h" |
| 27 #include "../shared/Utils.h" | 27 #include "../shared/Utils.h" |
| 28 #include <memory> | 28 #include <memory> |
| 29 | 29 |
| 30 | 30 |
| 31 // IE functions | 31 // IE functions |
| 32 #pragma comment(lib, "iepmapi.lib") | 32 #pragma comment(lib, "iepmapi.lib") |
| 33 | 33 |
| 34 #include <knownfolders.h> | 34 #include <knownfolders.h> |
| 35 | 35 |
| 36 namespace | |
| 37 { | |
| 38 std::wstring CreateDomainWhitelistingFilter(const CString& domain) | |
| 39 { | |
| 40 return L"@@||" + ToWstring(domain) + L"^$document"; | |
| 41 } | |
| 42 } | |
| 43 | |
| 44 class TSettings | 36 class TSettings |
| 45 { | 37 { |
| 46 DWORD processorId; | 38 DWORD processorId; |
| 47 | 39 |
| 48 char sPluginId[44]; | 40 char sPluginId[44]; |
| 49 }; | 41 }; |
| 50 | 42 |
| 51 class CPluginSettingsWhitelistLock : public CPluginMutex | 43 class CPluginSettingsWhitelistLock : public CPluginMutex |
| 52 { | 44 { |
| 53 public: | 45 public: |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 s_criticalSectionLocal.Unlock(); | 186 s_criticalSectionLocal.Unlock(); |
| 195 } | 187 } |
| 196 else | 188 else |
| 197 { | 189 { |
| 198 isRead = false; | 190 isRead = false; |
| 199 } | 191 } |
| 200 | 192 |
| 201 return isRead; | 193 return isRead; |
| 202 } | 194 } |
| 203 | 195 |
| 204 void CPluginSettings::AddWhiteListedDomain(const CString& domain) | 196 void CPluginSettings::AddWhiteListedDomain(const std::wstring& url) |
| 205 { | 197 { |
| 206 DEBUG_SETTINGS("SettingsWhitelist::AddWhiteListedDomain domain:" + domain) | 198 DEBUG_SETTINGS("SettingsWhitelist::AddWhiteListedDomain domain:" + ToCString(u
rl)) |
| 207 CPluginClient::GetInstance()->AddFilter(CreateDomainWhitelistingFilter(domain)
); | 199 CPluginClient::GetInstance()->AddWhiteListedDomain(url); |
| 208 } | 200 } |
| 209 | 201 |
| 210 void CPluginSettings::RemoveWhiteListedDomain(const CString& domain) | 202 void CPluginSettings::RemoveWhiteListedDomain(const std::wstring& url) |
| 211 { | 203 { |
| 212 DEBUG_SETTINGS("SettingsWhitelist::RemoveWhiteListedDomain domain:" + domain) | 204 DEBUG_SETTINGS("SettingsWhitelist::RemoveWhiteListedDomain domain:" + ToCStrin
g(url)) |
| 213 CPluginClient::GetInstance()->RemoveFilter(CreateDomainWhitelistingFilter(doma
in)); | 205 CPluginClient::GetInstance()->RemoveWhiteListedDomain(url); |
| 214 } | 206 } |
| 215 | 207 |
| 216 int CPluginSettings::GetWhiteListedDomainCount() const | 208 int CPluginSettings::GetWhiteListedDomainCount() const |
| 217 { | 209 { |
| 218 int count = 0; | 210 int count = 0; |
| 219 | 211 |
| 220 s_criticalSectionLocal.Lock(); | 212 s_criticalSectionLocal.Lock(); |
| 221 { | 213 { |
| 222 count = (int)m_whitelistedDomains.size(); | 214 count = (int)m_whitelistedDomains.size(); |
| 223 } | 215 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 | 274 |
| 283 CString CPluginSettings::GetAppLocale() | 275 CString CPluginSettings::GetAppLocale() |
| 284 { | 276 { |
| 285 return ToCString(GetBrowserLanguage()); | 277 return ToCString(GetBrowserLanguage()); |
| 286 } | 278 } |
| 287 | 279 |
| 288 CString CPluginSettings::GetDocumentationLink() | 280 CString CPluginSettings::GetDocumentationLink() |
| 289 { | 281 { |
| 290 return CString(CPluginClient::GetInstance()->GetDocumentationLink().c_str()); | 282 return CString(CPluginClient::GetInstance()->GetDocumentationLink().c_str()); |
| 291 } | 283 } |
| OLD | NEW |