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

Side by Side Diff: Shared/AdblockPlusClient.cpp

Issue 9998007: Initial libadblockplus integration (Closed)
Patch Set: More integration, reflecting latest libadblockplus changes Created April 9, 2013, 5:48 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
« no previous file with comments | « Shared/AdblockPlusClient.h ('k') | Shared/AdblockPlusDomTraverser.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginSettings.h" 3 #include "PluginSettings.h"
4 #include "PluginSystem.h" 4 #include "PluginSystem.h"
5 #include "PluginFilter.h" 5 #include "PluginFilter.h"
6 #include "PluginClientFactory.h" 6 #include "PluginClientFactory.h"
7 #include "PluginDictionary.h" 7 #include "PluginDictionary.h"
8 #include "PluginHttpRequest.h" 8 #include "PluginHttpRequest.h"
9 #include "PluginMutex.h" 9 #include "PluginMutex.h"
10 #include "PluginClass.h" 10 #include "PluginClass.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 s_instance = client; 42 s_instance = client;
43 } 43 }
44 44
45 instance = s_instance; 45 instance = s_instance;
46 } 46 }
47 s_criticalSectionLocal.Unlock(); 47 s_criticalSectionLocal.Unlock();
48 48
49 return instance; 49 return instance;
50 } 50 }
51 51
52 bool CAdblockPlusClient::LoadFilters()
53 {
54 return m_filter->LoadHideFilters(filterEngine->GetElementHidingRules());
55 }
56
57 AdblockPlus::FilterEngine* CAdblockPlusClient::GetFilterEngine() 52 AdblockPlus::FilterEngine* CAdblockPlusClient::GetFilterEngine()
58 { 53 {
59 return filterEngine.get(); 54 return filterEngine.get();
60 } 55 }
61 56
62 bool CAdblockPlusClient::ShouldBlock(CString src, int contentType, const CString & domain, bool addDebug) 57 bool CAdblockPlusClient::ShouldBlock(CString src, int contentType, const CString & domain, bool addDebug)
63 { 58 {
64 bool isBlocked = false; 59 bool isBlocked = false;
65 60
66 bool isCached = false; 61 bool isCached = false;
(...skipping 29 matching lines...) Expand all
96 m_cacheBlockedSources[src] = isBlocked; 91 m_cacheBlockedSources[src] = isBlocked;
97 } 92 }
98 m_criticalSectionCache.Unlock(); 93 m_criticalSectionCache.Unlock();
99 } 94 }
100 } 95 }
101 96
102 97
103 return isBlocked; 98 return isBlocked;
104 } 99 }
105 100
106 bool CAdblockPlusClient::IsElementHidden(const CString& tag, IHTMLElement* pEl, const CString& domain, const CString& indent) 101 bool CAdblockPlusClient::IsElementHidden(const CString& tag, IHTMLElement* pEl, const CString& domain, const CString& indent, CPluginFilter* filter)
107 { 102 {
108 bool isHidden; 103 bool isHidden;
109 m_criticalSectionFilter.Lock(); 104 m_criticalSectionFilter.Lock();
110 { 105 {
111 isHidden = m_filter.get() && m_filter->IsElementHidden(tag, pEl, domain, ind ent); 106 isHidden = filter && filter->IsElementHidden(tag, pEl, domain, indent);
112 } 107 }
113 m_criticalSectionFilter.Unlock(); 108 m_criticalSectionFilter.Unlock();
114 return isHidden; 109 return isHidden;
115 } 110 }
116 111
117 bool CAdblockPlusClient::IsUrlWhiteListed(const CString& url) 112 bool CAdblockPlusClient::IsUrlWhiteListed(const CString& url)
118 { 113 {
119 bool isWhitelisted = CPluginClientBase::IsUrlWhiteListed(url); 114 bool isWhitelisted = CPluginClientBase::IsUrlWhiteListed(url);
120 if (isWhitelisted == false && !url.IsEmpty()) 115 if (isWhitelisted == false && !url.IsEmpty())
121 { 116 {
(...skipping 25 matching lines...) Expand all
147 BYTE version[50]; 142 BYTE version[50];
148 cbData = 50; 143 cbData = 50;
149 status = RegQueryValueEx(hKey, L"Version", NULL, &type, (BYTE*)version, &cbDat a); 144 status = RegQueryValueEx(hKey, L"Version", NULL, &type, (BYTE*)version, &cbDat a);
150 if (status != 0) 145 if (status != 0)
151 { 146 {
152 return 0; 147 return 0;
153 } 148 }
154 RegCloseKey(hKey); 149 RegCloseKey(hKey);
155 return (int)(version[0] - 48); 150 return (int)(version[0] - 48);
156 } 151 }
OLDNEW
« no previous file with comments | « Shared/AdblockPlusClient.h ('k') | Shared/AdblockPlusDomTraverser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld