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: Addressed all issues Created June 25, 2013, 2:19 p.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 if (url.Find('/', pos) >= 0)
34 url.Tokenize(L"/", pos);
35 CString domain = url.Tokenize(L"/", pos);
36 domain.MakeLower();
37 return domain;
38 }
39 }
28 40
29 CPluginTabBase::CPluginTabBase(CPluginClass* plugin) : m_plugin(plugin), m_isAct ivated(false) 41 CPluginTabBase::CPluginTabBase(CPluginClass* plugin) : m_plugin(plugin), m_isAct ivated(false)
30 { 42 {
31 m_filter = std::auto_ptr<CPluginFilter>(new CPluginFilter()); 43 m_filter = std::auto_ptr<CPluginFilter>(new CPluginFilter());
32 44
33 CPluginClient* client = CPluginClient::GetInstance(); 45 CPluginClient* client = CPluginClient::GetInstance();
34 if (client->GetIEVersion() < 10) 46 if (client->GetIEVersion() < 10)
35 { 47 {
36 m_isActivated = true; 48 m_isActivated = true;
37 } 49 }
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 { 261 {
250 domain = m_documentDomain; 262 domain = m_documentDomain;
251 } 263 }
252 m_criticalSection.Unlock(); 264 m_criticalSection.Unlock();
253 265
254 return domain; 266 return domain;
255 } 267 }
256 268
257 void CPluginTabBase::SetDocumentUrl(const CString& url) 269 void CPluginTabBase::SetDocumentUrl(const CString& url)
258 { 270 {
259 CString domain; 271 CString domain;
Wladimir Palant 2013/06/25 18:03:58 Still unused, feel free to remove while you are at
Felix Dahlke 2013/06/26 09:32:55 Done.
260 272
261 m_criticalSection.Lock(); 273 m_criticalSection.Lock();
262 { 274 {
263 m_documentUrl = url; 275 m_documentUrl = url;
264 m_documentDomain = CPluginClient::ExtractDomain(url); 276 m_documentDomain = ExtractDomain(url);
265 277
266 domain = m_documentDomain; 278 domain = m_documentDomain;
267 } 279 }
268 m_criticalSection.Unlock(); 280 m_criticalSection.Unlock();
269 } 281 }
270 282
271 CString CPluginTabBase::GetDocumentUrl() 283 CString CPluginTabBase::GetDocumentUrl()
272 { 284 {
273 CString url; 285 CString url;
274 286
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 447
436 // Non-hanging sleep 448 // Non-hanging sleep
437 Sleep(50); 449 Sleep(50);
438 } 450 }
439 451
440 tabLoopIteration++; 452 tabLoopIteration++;
441 } 453 }
442 454
443 return 0; 455 return 0;
444 } 456 }
OLDNEW

Powered by Google App Engine
This is Rietveld