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

Side by Side Diff: src/plugin/PluginTabBase.cpp

Issue 10955040: Fix domain whitelisting and remove unused code (Closed)
Patch Set: Created June 25, 2013, 10:21 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginClient.h" 3 #include "PluginClient.h"
4 #include "PluginSettings.h" 4 #include "PluginSettings.h"
5 #ifdef SUPPORT_CONFIG 5 #ifdef SUPPORT_CONFIG
6 #include "PluginConfig.h" 6 #include "PluginConfig.h"
7 #endif 7 #endif
8 #include "PluginTab.h" 8 #include "PluginTab.h"
9 #include "PluginDomTraverser.h" 9 #include "PluginDomTraverser.h"
10 #include "PluginClass.h" 10 #include "PluginClass.h"
11 11
12 #include "PluginTabBase.h" 12 #include "PluginTabBase.h"
13 #include "PluginUtil.h" 13 #include "PluginUtil.h"
14 #include <dispex.h> 14 #include <dispex.h>
15 15
16 int CPluginTabBase::s_dictionaryVersion = 0; 16 int CPluginTabBase::s_dictionaryVersion = 0;
17 int CPluginTabBase::s_settingsVersion = 1; 17 int CPluginTabBase::s_settingsVersion = 1;
18 #ifdef SUPPORT_FILTER 18 #ifdef SUPPORT_FILTER
19 int CPluginTabBase::s_filterVersion = 0; 19 int CPluginTabBase::s_filterVersion = 0;
20 #endif 20 #endif
21 #ifdef SUPPORT_WHITELIST 21 #ifdef SUPPORT_WHITELIST
22 int CPluginTabBase::s_whitelistVersion = 0; 22 int CPluginTabBase::s_whitelistVersion = 0;
23 #endif 23 #endif
24 #ifdef SUPPORT_CONFIG 24 #ifdef SUPPORT_CONFIG
25 int CPluginTabBase::s_configVersion = 0; 25 int CPluginTabBase::s_configVersion = 0;
26 #endif 26 #endif
27 27
28 namespace
29 {
30 CString ExtractDomain(const CString& url)
31 {
32 int pos = 0;
33 CString scheme = url.Find('/', pos) >= 0 ? url.Tokenize(L"/", pos) : L"";
34 CString domain = url.Tokenize(L"/", pos);
35 domain.MakeLower();
36 return domain;
37 }
38 }
28 39
29 CPluginTabBase::CPluginTabBase(CPluginClass* plugin) : m_plugin(plugin), m_isAct ivated(false) 40 CPluginTabBase::CPluginTabBase(CPluginClass* plugin) : m_plugin(plugin), m_isAct ivated(false)
30 { 41 {
31 m_filter = std::auto_ptr<CPluginFilter>(new CPluginFilter()); 42 m_filter = std::auto_ptr<CPluginFilter>(new CPluginFilter());
32 43
33 CPluginClient* client = CPluginClient::GetInstance(); 44 CPluginClient* client = CPluginClient::GetInstance();
34 if (client->GetIEVersion() < 10) 45 if (client->GetIEVersion() < 10)
35 { 46 {
36 m_isActivated = true; 47 m_isActivated = true;
37 } 48 }
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 { 260 {
250 domain = m_documentDomain; 261 domain = m_documentDomain;
251 } 262 }
252 m_criticalSection.Unlock(); 263 m_criticalSection.Unlock();
253 264
254 return domain; 265 return domain;
255 } 266 }
256 267
257 void CPluginTabBase::SetDocumentUrl(const CString& url) 268 void CPluginTabBase::SetDocumentUrl(const CString& url)
258 { 269 {
259 CString domain; 270 CString domain;
Wladimir Palant 2013/06/25 11:55:13 This variable is unused.
260 271
261 m_criticalSection.Lock(); 272 m_criticalSection.Lock();
262 { 273 {
263 m_documentUrl = url; 274 m_documentUrl = url;
264 m_documentDomain = CPluginClient::ExtractDomain(url); 275 m_documentDomain = ExtractDomain(url);
265 276
266 domain = m_documentDomain; 277 domain = m_documentDomain;
267 } 278 }
268 m_criticalSection.Unlock(); 279 m_criticalSection.Unlock();
269 } 280 }
270 281
271 CString CPluginTabBase::GetDocumentUrl() 282 CString CPluginTabBase::GetDocumentUrl()
272 { 283 {
273 CString url; 284 CString url;
274 285
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 446
436 // Non-hanging sleep 447 // Non-hanging sleep
437 Sleep(50); 448 Sleep(50);
438 } 449 }
439 450
440 tabLoopIteration++; 451 tabLoopIteration++;
441 } 452 }
442 453
443 return 0; 454 return 0;
444 } 455 }
OLDNEW

Powered by Google App Engine
This is Rietveld