Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/plugin/PluginSettings.cpp

Issue 10948032: Fix domain-based whitelisting (Closed)
Patch Set: Created June 17, 2013, 1:50 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/plugin/PluginSettings.h ('k') | src/plugin/PluginTabBase.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/plugin/PluginSettings.cpp
===================================================================
--- a/src/plugin/PluginSettings.cpp
+++ b/src/plugin/PluginSettings.cpp
@@ -22,6 +22,14 @@
#include <knownfolders.h>
+namespace
+{
+ std::string CreateDomainWhitelistingFilter(CString domain)
+ {
+ return std::string("@@||").append(CW2A(domain)).append("^$document");
+ }
+}
+
class TSettings
{
DWORD processorId;
@@ -1269,34 +1277,14 @@
void CPluginSettings::AddWhiteListedDomain(const CString& domain)
{
DEBUG_SETTINGS("SettingsWhitelist::AddWhiteListedDomain domain:" + domain)
-
- bool isNewVersion = false;
- bool isForcingUpdateOnStart = false;
-
- CPluginSettingsWhitelistLock lock;
- if (lock.IsLocked())
- {
- ReadWhitelist(false);
-
- std::string newDomain = CW2A(domain, CP_UTF8);
-
- //Domain already present?
- if (std::find(m_whitelistedDomains.begin(), m_whitelistedDomains.end(), newDomain) != m_whitelistedDomains.end())
- {
- return;
- }
- s_criticalSectionLocal.Lock();
- CPluginClient::GetInstance()->AddFilter(std::string("@@||").append(CW2A(domain)).append("^$document"));
- s_criticalSectionLocal.Unlock();
-
- }
-
- if (isForcingUpdateOnStart)
- {
- ForceConfigurationUpdateOnStart();
- }
+ CPluginClient::GetInstance()->AddFilter(CreateDomainWhitelistingFilter(domain));
}
+void CPluginSettings::RemoveWhiteListedDomain(const CString& domain)
+{
+ DEBUG_SETTINGS("SettingsWhitelist::RemoveWhiteListedDomain domain:" + domain)
+ CPluginClient::GetInstance()->RemoveFilter(CreateDomainWhitelistingFilter(domain));
+}
bool CPluginSettings::IsWhiteListedDomain(const CString& domain) const
{
« no previous file with comments | « src/plugin/PluginSettings.h ('k') | src/plugin/PluginTabBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld