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

Delta Between Two Patch Sets: Shared/PluginTabBase.cpp

Issue 9998007: Initial libadblockplus integration (Closed)
Left Patch Set: Created April 1, 2013, 9:55 p.m.
Right Patch Set: Whitelisting management Created April 11, 2013, 9:06 a.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 | « Shared/PluginSettings.cpp ('k') | Shared/PluginTypedef.h » ('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 "PluginClient.h" 3 #include "PluginClient.h"
4 #include "PluginSettings.h" 4 #include "PluginSettings.h"
5 #include "PluginDictionary.h" 5 #include "PluginDictionary.h"
6 #ifdef SUPPORT_CONFIG 6 #ifdef SUPPORT_CONFIG
7 #include "PluginConfig.h" 7 #include "PluginConfig.h"
8 #endif 8 #endif
9 #include "PluginTab.h" 9 #include "PluginTab.h"
10 #include "PluginDomTraverser.h" 10 #include "PluginDomTraverser.h"
(...skipping 11 matching lines...) Expand all
22 #ifdef SUPPORT_WHITELIST 22 #ifdef SUPPORT_WHITELIST
23 int CPluginTabBase::s_whitelistVersion = 0; 23 int CPluginTabBase::s_whitelistVersion = 0;
24 #endif 24 #endif
25 #ifdef SUPPORT_CONFIG 25 #ifdef SUPPORT_CONFIG
26 int CPluginTabBase::s_configVersion = 0; 26 int CPluginTabBase::s_configVersion = 0;
27 #endif 27 #endif
28 28
29 29
30 CPluginTabBase::CPluginTabBase(CPluginClass* plugin) : m_plugin(plugin), m_isAct ivated(false) 30 CPluginTabBase::CPluginTabBase(CPluginClass* plugin) : m_plugin(plugin), m_isAct ivated(false)
31 { 31 {
32 m_filter = std::auto_ptr<CPluginFilter>(new CPluginFilter());
33
32 CPluginClient* client = CPluginClient::GetInstance(); 34 CPluginClient* client = CPluginClient::GetInstance();
33 if (client->GetIEVersion() < 10) 35 if (client->GetIEVersion() < 10)
34 { 36 {
35 m_isActivated = true; 37 m_isActivated = true;
36 } 38 }
37 39
38 DWORD id; 40 DWORD id;
39 m_hThread = ::CreateThread(NULL, 0, ThreadProc, (LPVOID)this, CREATE_SUSPENDED , &id); 41 m_hThread = ::CreateThread(NULL, 0, ThreadProc, (LPVOID)this, CREATE_SUSPENDED , &id);
40 if (m_hThread) 42 if (m_hThread)
41 { 43 {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 126
125 127
126 void CPluginTabBase::OnNavigate(const CString& url) 128 void CPluginTabBase::OnNavigate(const CString& url)
127 { 129 {
128 SetDocumentUrl(url); 130 SetDocumentUrl(url);
129 131
130 132
131 #ifdef SUPPORT_FRAME_CACHING 133 #ifdef SUPPORT_FRAME_CACHING
132 ClearFrameCache(GetDocumentDomain()); 134 ClearFrameCache(GetDocumentDomain());
133 #endif 135 #endif
136
137 std::string domainString = CT2A(GetDocumentDomain());
138 m_filter->LoadHideFilters(CPluginClient::GetInstance()->GetFilterEngine()->Get ElementHidingSelectors(domainString));
134 139
135 #ifdef SUPPORT_DOM_TRAVERSER 140 #ifdef SUPPORT_DOM_TRAVERSER
136 m_traverser->ClearCache(); 141 m_traverser->ClearCache();
137 #endif 142 #endif
138 } 143 }
139 144
140 void CPluginTabBase::OnDownloadComplete(IWebBrowser2* browser) 145 void CPluginTabBase::OnDownloadComplete(IWebBrowser2* browser)
141 { 146 {
142 #ifdef SUPPORT_DOM_TRAVERSER 147 #ifdef SUPPORT_DOM_TRAVERSER
143 m_traverser->TraverseDocument(browser, GetDocumentDomain(), GetDocumentUrl()); 148 m_traverser->TraverseDocument(browser, GetDocumentDomain(), GetDocumentUrl());
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 CString domain; 260 CString domain;
256 261
257 m_criticalSection.Lock(); 262 m_criticalSection.Lock();
258 { 263 {
259 m_documentUrl = url; 264 m_documentUrl = url;
260 m_documentDomain = CPluginClient::ExtractDomain(url); 265 m_documentDomain = CPluginClient::ExtractDomain(url);
261 266
262 domain = m_documentDomain; 267 domain = m_documentDomain;
263 } 268 }
264 m_criticalSection.Unlock(); 269 m_criticalSection.Unlock();
265
266 #ifdef SUPPORT_WHITELIST
267 CPluginSettings::GetInstance()->AddDomainToHistory(domain);
268 #endif
269 } 270 }
270 271
271 CString CPluginTabBase::GetDocumentUrl() 272 CString CPluginTabBase::GetDocumentUrl()
272 { 273 {
273 CString url; 274 CString url;
274 275
275 m_criticalSection.Lock(); 276 m_criticalSection.Lock();
276 { 277 {
277 url = m_documentUrl; 278 url = m_documentUrl;
278 } 279 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 client->ClearWhiteListCache(); 406 client->ClearWhiteListCache();
406 isChanged = true; 407 isChanged = true;
407 } 408 }
408 #endif // SUPPORT_WHITELIST 409 #endif // SUPPORT_WHITELIST
409 410
410 #ifdef SUPPORT_FILTER 411 #ifdef SUPPORT_FILTER
411 int newFilterVersion = settings->GetTabVersion(SETTING_TAB_FILTER_VERSIO N); 412 int newFilterVersion = settings->GetTabVersion(SETTING_TAB_FILTER_VERSIO N);
412 if (s_filterVersion != newFilterVersion) 413 if (s_filterVersion != newFilterVersion)
413 { 414 {
414 s_filterVersion = newFilterVersion; 415 s_filterVersion = newFilterVersion;
415 client->LoadFilters();
416 isChanged = true; 416 isChanged = true;
417 } 417 }
418 #endif 418 #endif
419 if (isChanged) 419 if (isChanged)
420 { 420 {
421 tab->m_plugin->UpdateStatusBar(); 421 tab->m_plugin->UpdateStatusBar();
422 } 422 }
423 423
424 tab->m_isActivated = false; 424 tab->m_isActivated = false;
425 } 425 }
(...skipping 14 matching lines...) Expand all
440 440
441 // Non-hanging sleep 441 // Non-hanging sleep
442 Sleep(50); 442 Sleep(50);
443 } 443 }
444 444
445 tabLoopIteration++; 445 tabLoopIteration++;
446 } 446 }
447 447
448 return 0; 448 return 0;
449 } 449 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld