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

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

Issue 11292028: Status bar menu added (Closed)
Left Patch Set: Created July 29, 2013, 5:25 a.m.
Right Patch Set: Comments addressed Created Aug. 5, 2013, 1:13 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/AdblockPlus.rc ('k') | src/plugin/PluginClass.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 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 "PluginMutex.h" 7 #include "PluginMutex.h"
8 #include "PluginClass.h" 8 #include "PluginClass.h"
9 9
10 #include "AdblockPlusClient.h" 10 #include "AdblockPlusClient.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 m_criticalSectionFilter.Unlock(); 215 m_criticalSectionFilter.Unlock();
216 return isHidden; 216 return isHidden;
217 } 217 }
218 218
219 bool CAdblockPlusClient::IsWhitelistedUrl(const std::wstring& url) 219 bool CAdblockPlusClient::IsWhitelistedUrl(const std::wstring& url)
220 { 220 {
221 Communication::OutputBuffer request; 221 Communication::OutputBuffer request;
222 request << Communication::PROC_IS_WHITELISTED_URL << ToUtf8String(url); 222 request << Communication::PROC_IS_WHITELISTED_URL << ToUtf8String(url);
223 223
224 Communication::InputBuffer response; 224 Communication::InputBuffer response;
225 if (!CallEngine(request, response)) return false; 225 if (!CallEngine(request, response))
226 return false;
226 227
227 bool isWhitelisted; 228 bool isWhitelisted;
228 response >> isWhitelisted; 229 response >> isWhitelisted;
229 return isWhitelisted; 230 return isWhitelisted;
230 } 231 }
231 232
232 int CAdblockPlusClient::GetIEVersion() 233 int CAdblockPlusClient::GetIEVersion()
233 { 234 {
234 //HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer 235 //HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer
235 HKEY hKey; 236 HKEY hKey;
(...skipping 13 matching lines...) Expand all
249 RegCloseKey(hKey); 250 RegCloseKey(hKey);
250 return (int)(version[0] - 48); 251 return (int)(version[0] - 48);
251 } 252 }
252 253
253 bool CAdblockPlusClient::Matches(const std::wstring& url, const std::wstring& co ntentType, const std::wstring& domain) 254 bool CAdblockPlusClient::Matches(const std::wstring& url, const std::wstring& co ntentType, const std::wstring& domain)
254 { 255 {
255 Communication::OutputBuffer request; 256 Communication::OutputBuffer request;
256 request << Communication::PROC_MATCHES << ToUtf8String(url) << ToUtf8String(co ntentType) << ToUtf8String(domain); 257 request << Communication::PROC_MATCHES << ToUtf8String(url) << ToUtf8String(co ntentType) << ToUtf8String(domain);
257 258
258 Communication::InputBuffer response; 259 Communication::InputBuffer response;
259 if (!CallEngine(request, response)) return false; 260 if (!CallEngine(request, response))
261 return false;
260 262
261 bool match; 263 bool match;
262 response >> match; 264 response >> match;
263 return match; 265 return match;
264 } 266 }
265 267
266 std::vector<std::wstring> CAdblockPlusClient::GetElementHidingSelectors(const st d::wstring& domain) 268 std::vector<std::wstring> CAdblockPlusClient::GetElementHidingSelectors(const st d::wstring& domain)
267 { 269 {
268 Communication::OutputBuffer request; 270 Communication::OutputBuffer request;
269 request << Communication::PROC_GET_ELEMHIDE_SELECTORS << ToUtf8String(domain); 271 request << Communication::PROC_GET_ELEMHIDE_SELECTORS << ToUtf8String(domain);
270 272
271 Communication::InputBuffer response; 273 Communication::InputBuffer response;
272 if (!CallEngine(request, response)) return std::vector<std::wstring>(); 274 if (!CallEngine(request, response))
275 return std::vector<std::wstring>();
273 return ReadStrings(response); 276 return ReadStrings(response);
274 } 277 }
275 278
276 std::vector<SubscriptionDescription> CAdblockPlusClient::FetchAvailableSubscript ions() 279 std::vector<SubscriptionDescription> CAdblockPlusClient::FetchAvailableSubscript ions()
277 { 280 {
278 Communication::InputBuffer response; 281 Communication::InputBuffer response;
279 if (!CallEngine(Communication::PROC_AVAILABLE_SUBSCRIPTIONS, response)) return std::vector<SubscriptionDescription>(); 282 if (!CallEngine(Communication::PROC_AVAILABLE_SUBSCRIPTIONS, response))
283 return std::vector<SubscriptionDescription>();
280 return ReadSubscriptions(response); 284 return ReadSubscriptions(response);
281 } 285 }
282 286
283 std::vector<SubscriptionDescription> CAdblockPlusClient::GetListedSubscriptions( ) 287 std::vector<SubscriptionDescription> CAdblockPlusClient::GetListedSubscriptions( )
284 { 288 {
285 Communication::InputBuffer response; 289 Communication::InputBuffer response;
286 if (!CallEngine(Communication::PROC_LISTED_SUBSCRIPTIONS, response)) return st d::vector<SubscriptionDescription>(); 290 if (!CallEngine(Communication::PROC_LISTED_SUBSCRIPTIONS, response))
291 return std::vector<SubscriptionDescription>();
287 return ReadSubscriptions(response); 292 return ReadSubscriptions(response);
288 } 293 }
289 294
290 void CAdblockPlusClient::SetSubscription(const std::wstring& url) 295 void CAdblockPlusClient::SetSubscription(const std::wstring& url)
291 { 296 {
292 Communication::OutputBuffer request; 297 Communication::OutputBuffer request;
293 request << Communication::PROC_SET_SUBSCRIPTION << ToUtf8String(url); 298 request << Communication::PROC_SET_SUBSCRIPTION << ToUtf8String(url);
294 CallEngine(request); 299 CallEngine(request);
295 } 300 }
296 301
297 void CAdblockPlusClient::UpdateAllSubscriptions() 302 void CAdblockPlusClient::UpdateAllSubscriptions()
298 { 303 {
299 CallEngine(Communication::PROC_UPDATE_ALL_SUBSCRIPTIONS); 304 CallEngine(Communication::PROC_UPDATE_ALL_SUBSCRIPTIONS);
300 } 305 }
301 306
302 std::vector<std::wstring> CAdblockPlusClient::GetExceptionDomains() 307 std::vector<std::wstring> CAdblockPlusClient::GetExceptionDomains()
303 { 308 {
304 Communication::InputBuffer response; 309 Communication::InputBuffer response;
305 if (!CallEngine(Communication::PROC_GET_EXCEPTION_DOMAINS, response)) return s td::vector<std::wstring>(); 310 if (!CallEngine(Communication::PROC_GET_EXCEPTION_DOMAINS, response))
311 return std::vector<std::wstring>();
306 return ReadStrings(response); 312 return ReadStrings(response);
307 } 313 }
308 314
309 bool CAdblockPlusClient::IsFirstRun() 315 bool CAdblockPlusClient::IsFirstRun()
310 { 316 {
311 Communication::InputBuffer response; 317 Communication::InputBuffer response;
312 if (!CallEngine(Communication::PROC_IS_FIRST_RUN_ACTION_NEEDED, response)) ret urn false; 318 if (!CallEngine(Communication::PROC_IS_FIRST_RUN_ACTION_NEEDED, response)) ret urn false;
313 bool res; 319 bool res;
314 response >> res; 320 response >> res;
315 return res; 321 return res;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 std::wstring CAdblockPlusClient::GetPref(const std::wstring& name, const wchar_t * defaultValue) 358 std::wstring CAdblockPlusClient::GetPref(const std::wstring& name, const wchar_t * defaultValue)
353 { 359 {
354 return GetPref(name, std::wstring(defaultValue)); 360 return GetPref(name, std::wstring(defaultValue));
355 } 361 }
356 std::wstring CAdblockPlusClient::GetPref(const std::wstring& name, const std::ws tring& defaultValue) 362 std::wstring CAdblockPlusClient::GetPref(const std::wstring& name, const std::ws tring& defaultValue)
357 { 363 {
358 Communication::OutputBuffer request; 364 Communication::OutputBuffer request;
359 request << Communication::PROC_GET_PREF << ToUtf8String(name); 365 request << Communication::PROC_GET_PREF << ToUtf8String(name);
360 366
361 Communication::InputBuffer response; 367 Communication::InputBuffer response;
362 if (!CallEngine(request, response)) return defaultValue; 368 if (!CallEngine(request, response))
369 return defaultValue;
363 bool success; 370 bool success;
364 response >> success; 371 response >> success;
365 if (success) 372 if (success)
366 { 373 {
367 std::string value; 374 std::string value;
368 response >> value; 375 response >> value;
369 return ToUtf16String(value); 376 return ToUtf16String(value);
370 } 377 }
371 else 378 else
372 return defaultValue; 379 return defaultValue;
373 } 380 }
374 381
375 bool CAdblockPlusClient::GetPref(const std::wstring& name, bool defaultValue) 382 bool CAdblockPlusClient::GetPref(const std::wstring& name, bool defaultValue)
376 { 383 {
377 Communication::OutputBuffer request; 384 Communication::OutputBuffer request;
378 request << Communication::PROC_GET_PREF << ToUtf8String(name); 385 request << Communication::PROC_GET_PREF << ToUtf8String(name);
379 386
380 Communication::InputBuffer response; 387 Communication::InputBuffer response;
381 if (!CallEngine(request, response)) return defaultValue; 388 if (!CallEngine(request, response))
389 return defaultValue;
382 bool success; 390 bool success;
383 response >> success; 391 response >> success;
384 if (success) 392 if (success)
385 { 393 {
386 bool value; 394 bool value;
387 response >> value; 395 response >> value;
388 return value; 396 return value;
389 } 397 }
390 else 398 else
391 return defaultValue; 399 return defaultValue;
392 } 400 }
393 int64_t CAdblockPlusClient::GetPref(const std::wstring& name, int64_t defaultVal ue) 401 int64_t CAdblockPlusClient::GetPref(const std::wstring& name, int64_t defaultVal ue)
394 { 402 {
395 Communication::OutputBuffer request; 403 Communication::OutputBuffer request;
396 request << Communication::PROC_GET_PREF << ToUtf8String(name); 404 request << Communication::PROC_GET_PREF << ToUtf8String(name);
397 405
398 Communication::InputBuffer response; 406 Communication::InputBuffer response;
399 if (!CallEngine(request, response)) return defaultValue; 407 if (!CallEngine(request, response))
400 bool success; 408 return defaultValue;
409 bool success;
401 response >> success; 410 response >> success;
402 if (success) 411 if (success)
403 { 412 {
404 int64_t value; 413 int64_t value;
405 response >> value; 414 response >> value;
406 return value; 415 return value;
407 } 416 }
408 else 417 else
409 return defaultValue; 418 return defaultValue;
410 } 419 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld