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

Unified Diff: src/engine/Main.cpp

Issue 5338025085108224: Support Acceptable Ads (Closed)
Patch Set: Missing negation fix Created July 18, 2014, 7:39 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « locales/uk.ini ('k') | src/plugin/AdblockPlus.rc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/engine/Main.cpp
===================================================================
--- a/src/engine/Main.cpp
+++ b/src/engine/Main.cpp
@@ -114,13 +114,42 @@
std::string url;
request >> url;
+ AdblockPlus::JsValuePtr valuePtr = filterEngine->GetPref("subscriptions_exceptionsurl");
+ std::string aaUrl = "";
+ if (!valuePtr->IsNull())
+ {
+ aaUrl = valuePtr->AsString();
+ }
std::vector<AdblockPlus::SubscriptionPtr> subscriptions = filterEngine->GetListedSubscriptions();
+
+ // Remove all subscriptions, besides the Acceptable Ads
for (size_t i = 0, count = subscriptions.size(); i < count; i++)
- subscriptions[i]->RemoveFromList();
+ {
+ if (subscriptions[i]->GetProperty("url")->AsString() != aaUrl)
+ {
+ subscriptions[i]->RemoveFromList();
+ }
+ }
filterEngine->GetSubscription(url)->AddToList();
break;
}
+ case Communication::PROC_ADD_SUBSCRIPTION:
+ {
+ std::string url;
+ request >> url;
+
+ filterEngine->GetSubscription(url)->AddToList();
+ break;
+ }
+ case Communication::PROC_REMOVE_SUBSCRIPTION:
+ {
+ std::string url;
+ request >> url;
+
+ filterEngine->GetSubscription(url)->RemoveFromList();
+ break;
+ }
case Communication::PROC_UPDATE_ALL_SUBSCRIPTIONS:
{
std::vector<AdblockPlus::SubscriptionPtr> subscriptions = filterEngine->GetListedSubscriptions();
« no previous file with comments | « locales/uk.ini ('k') | src/plugin/AdblockPlus.rc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld