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

Delta Between Two Patch Sets: src/plugin/PluginSettings.cpp

Issue 10948032: Fix domain-based whitelisting (Closed)
Left Patch Set: Created June 14, 2013, 2:44 p.m.
Right Patch Set: Created June 17, 2013, 1:50 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/plugin/PluginSettings.h ('k') | src/plugin/PluginTabBase.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include <Wbemidl.h> 3 #include <Wbemidl.h>
4 #include <time.h> 4 #include <time.h>
5 #include "PluginIniFileW.h" 5 #include "PluginIniFileW.h"
6 #include "PluginIniFile.h" 6 #include "PluginIniFile.h"
7 #include "PluginSettings.h" 7 #include "PluginSettings.h"
8 #include "PluginClient.h" 8 #include "PluginClient.h"
9 #include "PluginChecksum.h" 9 #include "PluginChecksum.h"
10 #include "PluginSystem.h" 10 #include "PluginSystem.h"
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 isRead = false; 1270 isRead = false;
1271 } 1271 }
1272 1272
1273 return isRead; 1273 return isRead;
1274 } 1274 }
1275 1275
1276 1276
1277 void CPluginSettings::AddWhiteListedDomain(const CString& domain) 1277 void CPluginSettings::AddWhiteListedDomain(const CString& domain)
1278 { 1278 {
1279 DEBUG_SETTINGS("SettingsWhitelist::AddWhiteListedDomain domain:" + domain) 1279 DEBUG_SETTINGS("SettingsWhitelist::AddWhiteListedDomain domain:" + domain)
1280
1281 RefreshWhitelist();
1282 if (IsWhiteListedDomain(domain))
1283 return;
Wladimir Palant 2013/06/17 09:33:56 I think that this code block is unnecessary and me
Felix Dahlke 2013/06/17 11:19:01 Done.
1284
1285 s_criticalSectionLocal.Lock();
Wladimir Palant 2013/06/17 09:33:56 Please remove the pointless critical section use h
Felix Dahlke 2013/06/17 11:19:01 Done.
1286 CPluginClient::GetInstance()->AddFilter(CreateDomainWhitelistingFilter(domain) ); 1280 CPluginClient::GetInstance()->AddFilter(CreateDomainWhitelistingFilter(domain) );
1287 s_criticalSectionLocal.Unlock();
1288 } 1281 }
1289 1282
1290 void CPluginSettings::RemoveWhiteListedDomain(const CString& domain) 1283 void CPluginSettings::RemoveWhiteListedDomain(const CString& domain)
1291 { 1284 {
1292 DEBUG_SETTINGS("SettingsWhitelist::RemoveWhiteListedDomain domain:" + domain) 1285 DEBUG_SETTINGS("SettingsWhitelist::RemoveWhiteListedDomain domain:" + domain)
1293
1294 RefreshWhitelist();
1295 if (!IsWhiteListedDomain(domain))
1296 return;
Wladimir Palant 2013/06/17 09:33:56 I think that this code block is unnecessary and me
Felix Dahlke 2013/06/17 11:19:01 Done.
1297
1298 s_criticalSectionLocal.Lock();
Wladimir Palant 2013/06/17 09:33:56 Please remove the pointless critical section use h
Felix Dahlke 2013/06/17 11:19:01 Done.
1299 CPluginClient::GetInstance()->RemoveFilter(CreateDomainWhitelistingFilter(doma in)); 1286 CPluginClient::GetInstance()->RemoveFilter(CreateDomainWhitelistingFilter(doma in));
1300 s_criticalSectionLocal.Unlock();
1301 } 1287 }
1302 1288
1303 bool CPluginSettings::IsWhiteListedDomain(const CString& domain) const 1289 bool CPluginSettings::IsWhiteListedDomain(const CString& domain) const
1304 { 1290 {
1305 bool bIsWhiteListed; 1291 bool bIsWhiteListed;
1306 1292
1307 s_criticalSectionLocal.Lock(); 1293 s_criticalSectionLocal.Lock();
1308 { 1294 {
1309 bIsWhiteListed = std::find(m_whitelistedDomains.begin(), m_whitelistedDomain s.end(), std::string(CW2A(domain, CP_UTF8))) != m_whitelistedDomains.end(); 1295 bIsWhiteListed = std::find(m_whitelistedDomains.begin(), m_whitelistedDomain s.end(), std::string(CW2A(domain, CP_UTF8))) != m_whitelistedDomains.end();
1310 } 1296 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 return CString(L""); 1384 return CString(L"");
1399 } 1385 }
1400 1386
1401 1387
1402 void CPluginSettings::RefreshFilterlist() 1388 void CPluginSettings::RefreshFilterlist()
1403 { 1389 {
1404 CPluginClient::GetInstance()->UpdateAllSubscriptions(); 1390 CPluginClient::GetInstance()->UpdateAllSubscriptions();
1405 } 1391 }
1406 1392
1407 #endif // SUPPORT_WHITELIST 1393 #endif // SUPPORT_WHITELIST
LEFTRIGHT

Powered by Google App Engine
This is Rietveld