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

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

Issue 5115380229996544: Issue 1104 - Cannot uncheck Disable on website option in tool bar (Closed)
Patch Set: Created March 4, 2015, 12:24 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 /* 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 { 252 {
253 bool isHidden; 253 bool isHidden;
254 m_criticalSectionFilter.Lock(); 254 m_criticalSectionFilter.Lock();
255 { 255 {
256 isHidden = filter && filter->IsElementHidden(tag, pEl, domain, indent); 256 isHidden = filter && filter->IsElementHidden(tag, pEl, domain, indent);
257 } 257 }
258 m_criticalSectionFilter.Unlock(); 258 m_criticalSectionFilter.Unlock();
259 return isHidden; 259 return isHidden;
260 } 260 }
261 261
262 bool CAdblockPlusClient::IsWhitelistedUrl(const std::wstring& url) 262 CAdblockPlusClient::ExceptionFilter CAdblockPlusClient::IsWhitelistedUrl(const s td::wstring& url)
263 { 263 {
264 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" start").c_str()); 264 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" start").c_str());
265 ExceptionFilter exceptionFilter;
265 Communication::OutputBuffer request; 266 Communication::OutputBuffer request;
266 request << Communication::PROC_IS_WHITELISTED_URL << ToUtf8String(url); 267 request << Communication::PROC_IS_WHITELISTED_URL << ToUtf8String(url);
267 268
268 Communication::InputBuffer response; 269 Communication::InputBuffer response;
269 if (!CallEngine(request, response)) 270 if (!CallEngine(request, response))
270 return false; 271 return exceptionFilter;
271 272
272 bool isWhitelisted; 273 response >> exceptionFilter.filterText;
273 response >> isWhitelisted;
274 274
275 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" end").c_str()); 275 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" end").c_str());
276 return isWhitelisted; 276 return exceptionFilter;
277 } 277 }
278 278
279 bool CAdblockPlusClient::IsElemhideWhitelistedOnDomain(const std::wstring& url) 279 bool CAdblockPlusClient::IsElemhideWhitelistedOnDomain(const std::wstring& url)
280 { 280 {
281 Communication::OutputBuffer request; 281 Communication::OutputBuffer request;
282 request << Communication::PROC_IS_ELEMHIDE_WHITELISTED_ON_URL << ToUtf8String( url); 282 request << Communication::PROC_IS_ELEMHIDE_WHITELISTED_ON_URL << ToUtf8String( url);
283 283
284 Communication::InputBuffer response; 284 Communication::InputBuffer response;
285 if (!CallEngine(request, response)) 285 if (!CallEngine(request, response))
286 return false; 286 return false;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 399
400 void CAdblockPlusClient::AddFilter(const std::wstring& text) 400 void CAdblockPlusClient::AddFilter(const std::wstring& text)
401 { 401 {
402 Communication::OutputBuffer request; 402 Communication::OutputBuffer request;
403 request << Communication::PROC_ADD_FILTER << ToUtf8String(text); 403 request << Communication::PROC_ADD_FILTER << ToUtf8String(text);
404 CallEngine(request); 404 CallEngine(request);
405 } 405 }
406 406
407 void CAdblockPlusClient::RemoveFilter(const std::wstring& text) 407 void CAdblockPlusClient::RemoveFilter(const std::wstring& text)
408 { 408 {
409 RemoveFilter(ToUtf8String(text));
410 }
411
412 void CAdblockPlusClient::RemoveFilter(const std::string& text)
413 {
409 Communication::OutputBuffer request; 414 Communication::OutputBuffer request;
410 request << Communication::PROC_REMOVE_FILTER << ToUtf8String(text); 415 request << Communication::PROC_REMOVE_FILTER << text;
411 CallEngine(request); 416 CallEngine(request);
412 } 417 }
413 418
414 void CAdblockPlusClient::SetPref(const std::wstring& name, const std::wstring& v alue) 419 void CAdblockPlusClient::SetPref(const std::wstring& name, const std::wstring& v alue)
415 { 420 {
416 Communication::OutputBuffer request; 421 Communication::OutputBuffer request;
417 request << Communication::PROC_SET_PREF << ToUtf8String(name) << ToUtf8String( value); 422 request << Communication::PROC_SET_PREF << ToUtf8String(name) << ToUtf8String( value);
418 CallEngine(request); 423 CallEngine(request);
419 } 424 }
420 425
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 DEBUG_GENERAL("CompareVersions"); 563 DEBUG_GENERAL("CompareVersions");
559 Communication::OutputBuffer request; 564 Communication::OutputBuffer request;
560 request << Communication::PROC_COMPARE_VERSIONS << ToUtf8String(v1) << ToUtf8S tring(v2); 565 request << Communication::PROC_COMPARE_VERSIONS << ToUtf8String(v1) << ToUtf8S tring(v2);
561 Communication::InputBuffer response; 566 Communication::InputBuffer response;
562 if (!CallEngine(request, response)) 567 if (!CallEngine(request, response))
563 return 0; 568 return 0;
564 int result; 569 int result;
565 response >> result; 570 response >> result;
566 return result; 571 return result;
567 } 572 }
OLDNEW

Powered by Google App Engine
This is Rietveld