Left: | ||
Right: |
OLD | NEW |
---|---|
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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 } | 336 } |
337 | 337 |
338 std::vector<SubscriptionDescription> CAdblockPlusClient::GetListedSubscriptions( ) | 338 std::vector<SubscriptionDescription> CAdblockPlusClient::GetListedSubscriptions( ) |
339 { | 339 { |
340 Communication::InputBuffer response; | 340 Communication::InputBuffer response; |
341 if (!CallEngine(Communication::PROC_LISTED_SUBSCRIPTIONS, response)) | 341 if (!CallEngine(Communication::PROC_LISTED_SUBSCRIPTIONS, response)) |
342 return std::vector<SubscriptionDescription>(); | 342 return std::vector<SubscriptionDescription>(); |
343 return ReadSubscriptions(response); | 343 return ReadSubscriptions(response); |
344 } | 344 } |
345 | 345 |
346 // Returns true if Acceptable Ads are enabled, false otherwise. | |
347 bool CAdblockPlusClient::AcceptableAdsStatus() | |
Felix Dahlke
2014/06/30 17:24:04
How about IsAcceptableAdsEnabled()? That'd make th
| |
348 { | |
349 std::vector<SubscriptionDescription> subscriptions = GetListedSubscriptions(); | |
350 std::wstring aaUrl = GetPref(L"subscriptions_exceptionsurl", L""); | |
351 for (std::vector<SubscriptionDescription>::iterator subscription = subscriptio ns.begin(); subscription < subscriptions.end(); subscription ++) | |
Felix Dahlke
2014/06/30 17:24:04
!= for iterators, not <
Also no whitespace before
| |
352 { | |
353 if (subscription->url == aaUrl) | |
354 { | |
355 return true; | |
356 } | |
357 } | |
358 return false; | |
359 } | |
360 | |
346 void CAdblockPlusClient::SetSubscription(const std::wstring& url) | 361 void CAdblockPlusClient::SetSubscription(const std::wstring& url) |
347 { | 362 { |
348 Communication::OutputBuffer request; | 363 Communication::OutputBuffer request; |
349 request << Communication::PROC_SET_SUBSCRIPTION << ToUtf8String(url); | 364 request << Communication::PROC_SET_SUBSCRIPTION << ToUtf8String(url); |
350 CallEngine(request); | 365 CallEngine(request); |
351 } | 366 } |
352 | 367 |
368 void CAdblockPlusClient::AddSubscription(const std::wstring& url) | |
369 { | |
370 Communication::OutputBuffer request; | |
371 request << Communication::PROC_ADD_SUBSCRIPTION << ToUtf8String(url); | |
372 CallEngine(request); | |
373 } | |
374 | |
375 void CAdblockPlusClient::RemoveSubscription(const std::wstring& url) | |
376 { | |
377 Communication::OutputBuffer request; | |
378 request << Communication::PROC_REMOVE_SUBSCRIPTION << ToUtf8String(url); | |
379 CallEngine(request); | |
380 } | |
381 | |
382 | |
353 void CAdblockPlusClient::UpdateAllSubscriptions() | 383 void CAdblockPlusClient::UpdateAllSubscriptions() |
354 { | 384 { |
355 CallEngine(Communication::PROC_UPDATE_ALL_SUBSCRIPTIONS); | 385 CallEngine(Communication::PROC_UPDATE_ALL_SUBSCRIPTIONS); |
356 } | 386 } |
357 | 387 |
358 std::vector<std::wstring> CAdblockPlusClient::GetExceptionDomains() | 388 std::vector<std::wstring> CAdblockPlusClient::GetExceptionDomains() |
359 { | 389 { |
360 Communication::InputBuffer response; | 390 Communication::InputBuffer response; |
361 if (!CallEngine(Communication::PROC_GET_EXCEPTION_DOMAINS, response)) | 391 if (!CallEngine(Communication::PROC_GET_EXCEPTION_DOMAINS, response)) |
362 return std::vector<std::wstring>(); | 392 return std::vector<std::wstring>(); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
506 bool CAdblockPlusClient::TogglePluginEnabled() | 536 bool CAdblockPlusClient::TogglePluginEnabled() |
507 { | 537 { |
508 DEBUG_GENERAL("TogglePluginEnabled"); | 538 DEBUG_GENERAL("TogglePluginEnabled"); |
509 Communication::InputBuffer response; | 539 Communication::InputBuffer response; |
510 if (!CallEngine(Communication::PROC_TOGGLE_PLUGIN_ENABLED, response)) | 540 if (!CallEngine(Communication::PROC_TOGGLE_PLUGIN_ENABLED, response)) |
511 return false; | 541 return false; |
512 bool currentEnabledState; | 542 bool currentEnabledState; |
513 response >> currentEnabledState; | 543 response >> currentEnabledState; |
514 return currentEnabledState; | 544 return currentEnabledState; |
515 } | 545 } |
OLD | NEW |