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

Delta Between Two Patch Sets: src/plugin/AdblockPlusClient.cpp

Issue 4784041706389504: Issue 1183 - Fix Acceptable Ads hiding (Closed)
Left Patch Set: Created Aug. 8, 2014, 3:51 p.m.
Right Patch Set: More addressing comments Created Aug. 8, 2014, 4:54 p.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 | « src/plugin/AdblockPlusClient.h ('k') | src/plugin/PluginTabBase.cpp » ('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 #include "PluginSettings.h" 2 #include "PluginSettings.h"
3 #include "PluginSystem.h" 3 #include "PluginSystem.h"
4 #include "PluginFilter.h" 4 #include "PluginFilter.h"
5 #include "PluginClientFactory.h" 5 #include "PluginClientFactory.h"
6 #include "PluginMutex.h" 6 #include "PluginMutex.h"
7 #include "PluginClass.h" 7 #include "PluginClass.h"
8 8
9 #include "AdblockPlusClient.h" 9 #include "AdblockPlusClient.h"
10 10
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 if (!CallEngine(request, response)) 274 if (!CallEngine(request, response))
275 return false; 275 return false;
276 276
277 bool isWhitelisted; 277 bool isWhitelisted;
278 response >> isWhitelisted; 278 response >> isWhitelisted;
279 279
280 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" end").c_str()); 280 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" end").c_str());
281 return isWhitelisted; 281 return isWhitelisted;
282 } 282 }
283 283
284 bool CAdblockPlusClient::IsElemhideWhitelistedOnDomain(const std::wstring& url)
285 {
286 Communication::OutputBuffer request;
287 request << Communication::PROC_IS_ELEMHIDE_WHITELISTED_ON_URL << ToUtf8String( url);
288
289 Communication::InputBuffer response;
290 if (!CallEngine(request, response))
291 return false;
292
293 bool isWhitelisted;
294 response >> isWhitelisted;
295 return isWhitelisted;
296 }
297
284 int CAdblockPlusClient::GetIEVersion() 298 int CAdblockPlusClient::GetIEVersion()
285 { 299 {
286 //HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer 300 //HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer
287 HKEY hKey; 301 HKEY hKey;
288 LSTATUS status = RegOpenKey(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Interne t Explorer", &hKey); 302 LSTATUS status = RegOpenKey(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Interne t Explorer", &hKey);
289 if (status != 0) 303 if (status != 0)
290 { 304 {
291 return 0; 305 return 0;
292 } 306 }
293 DWORD type, cbData; 307 DWORD type, cbData;
294 BYTE version[50]; 308 BYTE version[50];
295 cbData = 50; 309 cbData = 50;
296 status = RegQueryValueEx(hKey, L"Version", NULL, &type, (BYTE*)version, &cbDat a); 310 status = RegQueryValueEx(hKey, L"Version", NULL, &type, (BYTE*)version, &cbDat a);
297 if (status != 0) 311 if (status != 0)
298 { 312 {
299 return 0; 313 return 0;
300 } 314 }
301 RegCloseKey(hKey); 315 RegCloseKey(hKey);
302 return (int)(version[0] - 48); 316 return (int)(version[0] - 48);
303 } 317 }
304 318
305 bool CAdblockPlusClient::Matches(const std::wstring& url, const std::wstring& co ntentType, const std::wstring& domain) 319 bool CAdblockPlusClient::Matches(const std::wstring& url, const std::wstring& co ntentType, const std::wstring& domain)
306 { 320 {
307 Communication::OutputBuffer request; 321 Communication::OutputBuffer request;
308 request << Communication::PROC_MATCHES << ToUtf8String(url) << ToUtf8String(co ntentType) << ToUtf8String(domain); 322 request << Communication::PROC_MATCHES << ToUtf8String(url) << ToUtf8String(co ntentType) << ToUtf8String(domain);
309
310 Communication::InputBuffer response;
311 if (!CallEngine(request, response))
312 return false;
313
314 bool match;
315 response >> match;
316 return match;
317 }
318
319 bool CAdblockPlusClient::HidingEnabledOnDomain(const std::wstring& domain)
320 {
321 Communication::OutputBuffer request;
322 request << Communication::PROC_HIDING_ENABLED_ON_DOMAIN << ToUtf8String(domain );
323 323
324 Communication::InputBuffer response; 324 Communication::InputBuffer response;
325 if (!CallEngine(request, response)) 325 if (!CallEngine(request, response))
326 return false; 326 return false;
327 327
328 bool match; 328 bool match;
329 response >> match; 329 response >> match;
330 return match; 330 return match;
331 } 331 }
332 332
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 DEBUG_GENERAL("CompareVersions"); 578 DEBUG_GENERAL("CompareVersions");
579 Communication::OutputBuffer request; 579 Communication::OutputBuffer request;
580 request << Communication::PROC_COMPARE_VERSIONS << ToUtf8String(v1) << ToUtf8S tring(v2); 580 request << Communication::PROC_COMPARE_VERSIONS << ToUtf8String(v1) << ToUtf8S tring(v2);
581 Communication::InputBuffer response; 581 Communication::InputBuffer response;
582 if (!CallEngine(request, response)) 582 if (!CallEngine(request, response))
583 return 0; 583 return 0;
584 int result; 584 int result;
585 response >> result; 585 response >> result;
586 return result; 586 return result;
587 } 587 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld