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: Created April 14, 2014, 7:01 a.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
Index: src/engine/Main.cpp
===================================================================
--- a/src/engine/Main.cpp
+++ b/src/engine/Main.cpp
@@ -114,13 +114,43 @@
std::string url;
request >> url;
+ AdblockPlus::JsValuePtr valuePtr = filterEngine->GetPref("subscriptions_exceptionsurl");
+ std::string aaUrl = "";
+ if (valuePtr->IsString())
+ {
+ aaUrl = valuePtr->AsString();
+ }
Eric 2014/06/25 14:34:15 Why the partial type enforcement? Is there any rea
Felix Dahlke 2014/06/30 17:24:04 I guess this is because the pref could be missing,
std::vector<AdblockPlus::SubscriptionPtr> subscriptions = filterEngine->GetListedSubscriptions();
+
+ // Remove all subscriptions, besides the Acceptable Ads
Felix Dahlke 2014/06/30 17:24:04 Wow, this is hacky. So we currently only support e
Oleksandr 2014/07/18 19:06:42 https://issues.adblockplus.org/ticket/1084 On 2014
for (size_t i = 0, count = subscriptions.size(); i < count; i++)
- subscriptions[i]->RemoveFromList();
+ {
+ if (subscriptions[i].get()->GetProperty("url")->AsString() != aaUrl)
Felix Dahlke 2014/06/30 17:24:04 Are you sure the .get() is required here? That sho
+ {
+ subscriptions[i]->RemoveFromList();
+ }
+ }
+
+ // Add new subscription
Felix Dahlke 2014/06/30 17:24:04 Kinda obvious IMHO :P
+ 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();

Powered by Google App Engine
This is Rietveld