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

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

Issue 5171515343503360: Issue #41 - Bring method of determining IE version up to date (Closed)
Patch Set: Created July 30, 2014, 1 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 #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 int CAdblockPlusClient::GetIEVersion()
285 {
286 //HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer
287 HKEY hKey;
288 LSTATUS status = RegOpenKey(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Interne t Explorer", &hKey);
289 if (status != 0)
290 {
291 return 0;
292 }
293 DWORD type, cbData;
294 BYTE version[50];
295 cbData = 50;
296 status = RegQueryValueEx(hKey, L"Version", NULL, &type, (BYTE*)version, &cbDat a);
297 if (status != 0)
298 {
299 return 0;
300 }
301 RegCloseKey(hKey);
302 return (int)(version[0] - 48);
303 }
304
305 bool CAdblockPlusClient::Matches(const std::wstring& url, const std::wstring& co ntentType, const std::wstring& domain) 284 bool CAdblockPlusClient::Matches(const std::wstring& url, const std::wstring& co ntentType, const std::wstring& domain)
306 { 285 {
307 Communication::OutputBuffer request; 286 Communication::OutputBuffer request;
308 request << Communication::PROC_MATCHES << ToUtf8String(url) << ToUtf8String(co ntentType) << ToUtf8String(domain); 287 request << Communication::PROC_MATCHES << ToUtf8String(url) << ToUtf8String(co ntentType) << ToUtf8String(domain);
309 288
310 Communication::InputBuffer response; 289 Communication::InputBuffer response;
311 if (!CallEngine(request, response)) 290 if (!CallEngine(request, response))
312 return false; 291 return false;
313 292
314 bool match; 293 bool match;
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 Communication::OutputBuffer request; 529 Communication::OutputBuffer request;
551 request << Communication::PROC_GET_HOST << ToUtf8String(url); 530 request << Communication::PROC_GET_HOST << ToUtf8String(url);
552 531
553 Communication::InputBuffer response; 532 Communication::InputBuffer response;
554 if (!CallEngine(request, response)) 533 if (!CallEngine(request, response))
555 return L""; 534 return L"";
556 std::string host; 535 std::string host;
557 response >> host; 536 response >> host;
558 return ToUtf16String(host); 537 return ToUtf16String(host);
559 } 538 }
OLDNEW

Powered by Google App Engine
This is Rietveld