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

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

Issue 5447868882092032: Issue 1793 - check whether the frame is whitelisted before injecting CSS (Closed)
Patch Set: use SID_SWebBrowserApp as service ID Created Nov. 20, 2015, 10:09 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 | « src/plugin/AdblockPlusClient.h ('k') | src/plugin/PluginTabBase.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 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 { 217 {
218 bool isHidden; 218 bool isHidden;
219 m_criticalSectionFilter.Lock(); 219 m_criticalSectionFilter.Lock();
220 { 220 {
221 isHidden = filter && filter->IsElementHidden(tag, pEl, domain, indent); 221 isHidden = filter && filter->IsElementHidden(tag, pEl, domain, indent);
222 } 222 }
223 m_criticalSectionFilter.Unlock(); 223 m_criticalSectionFilter.Unlock();
224 return isHidden; 224 return isHidden;
225 } 225 }
226 226
227 bool CAdblockPlusClient::IsWhitelistedUrl(const std::wstring& url) 227 bool CAdblockPlusClient::IsWhitelistedUrl(const std::wstring& url, const std::ve ctor<std::string>& frameHierarchy)
228 { 228 {
229 return !GetWhitelistingFilter(url).empty(); 229 return !GetWhitelistingFilter(url, frameHierarchy).empty();
230 } 230 }
231 231
232 std::string CAdblockPlusClient::GetWhitelistingFilter(const std::wstring& url) 232 std::string CAdblockPlusClient::GetWhitelistingFilter(const std::wstring& url, c onst std::vector<std::string>& frameHierarchy)
233 { 233 {
234 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" start").c_str()); 234 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" start").c_str());
235 Communication::OutputBuffer request; 235 Communication::OutputBuffer request;
236 request << Communication::PROC_GET_WHITELISTING_FITER << ToUtf8String(url); 236 request << Communication::PROC_GET_WHITELISTING_FITER << ToUtf8String(url) << frameHierarchy;
237 237
238 Communication::InputBuffer response; 238 Communication::InputBuffer response;
239 if (!CallEngine(request, response)) 239 if (!CallEngine(request, response))
240 return ""; 240 return "";
241 241
242 std::string filterText; 242 std::string filterText;
243 response >> filterText; 243 response >> filterText;
244 244
245 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" end").c_str()); 245 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" end").c_str());
246 return filterText; 246 return filterText;
247 } 247 }
248 248
249 bool CAdblockPlusClient::IsElemhideWhitelistedOnDomain(const std::wstring& url) 249 bool CAdblockPlusClient::IsElemhideWhitelistedOnDomain(const std::wstring& url, const std::vector<std::string>& frameHierarchy)
250 { 250 {
251 Communication::OutputBuffer request; 251 Communication::OutputBuffer request;
252 request << Communication::PROC_IS_ELEMHIDE_WHITELISTED_ON_URL << ToUtf8String( url); 252 request << Communication::PROC_IS_ELEMHIDE_WHITELISTED_ON_URL << ToUtf8String( url) << frameHierarchy;
253 253
254 Communication::InputBuffer response; 254 Communication::InputBuffer response;
255 if (!CallEngine(request, response)) 255 if (!CallEngine(request, response))
256 return false; 256 return false;
257 257
258 bool isWhitelisted; 258 bool isWhitelisted;
259 response >> isWhitelisted; 259 response >> isWhitelisted;
260 return isWhitelisted; 260 return isWhitelisted;
261 } 261 }
262 262
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 DEBUG_GENERAL("CompareVersions"); 533 DEBUG_GENERAL("CompareVersions");
534 Communication::OutputBuffer request; 534 Communication::OutputBuffer request;
535 request << Communication::PROC_COMPARE_VERSIONS << ToUtf8String(v1) << ToUtf8S tring(v2); 535 request << Communication::PROC_COMPARE_VERSIONS << ToUtf8String(v1) << ToUtf8S tring(v2);
536 Communication::InputBuffer response; 536 Communication::InputBuffer response;
537 if (!CallEngine(request, response)) 537 if (!CallEngine(request, response))
538 return 0; 538 return 0;
539 int result; 539 int result;
540 response >> result; 540 response >> result;
541 return result; 541 return result;
542 } 542 }
OLDNEW
« no previous file with comments | « src/plugin/AdblockPlusClient.h ('k') | src/plugin/PluginTabBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld