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

Unified Diff: src/FilterEngine.cpp

Issue 29366747: Issue 4657 - Add Acceptable Ads API (Closed)
Patch Set: Created Dec. 2, 2016, 4:27 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
Index: src/FilterEngine.cpp
diff --git a/src/FilterEngine.cpp b/src/FilterEngine.cpp
index 9b5662a052a0d81444bb40a93d80c0823d0242e6..0a5bf83915a2f62808ef3ed8f77c84152ba920e1 100644
--- a/src/FilterEngine.cpp
+++ b/src/FilterEngine.cpp
@@ -129,6 +129,12 @@ bool Subscription::IsUpdating()
return result->AsBool();
}
+bool Subscription::IsAA()
+{
+ JsContext context(jsEngine);
+ return jsEngine->Evaluate("API.isAASubscription")->Call(*shared_from_this())->AsBool();
+}
+
bool Subscription::operator==(const Subscription& subscription) const
{
return GetProperty("url")->AsString() == subscription.GetProperty("url")->AsString();
@@ -271,6 +277,21 @@ std::vector<SubscriptionPtr> FilterEngine::FetchAvailableSubscriptions() const
return result;
}
+void FilterEngine::SetAAEnabled(bool enabled)
+{
+ jsEngine->Evaluate("API.setAASubscriptionEnabled")->Call(*jsEngine->NewValue(enabled));
Eric 2016/12/05 14:40:58 Why is there a context instantiated at line 134 bu
sergei 2017/03/17 15:55:25 JsContext context(jsEngine); is removed on line 13
+}
+
+bool FilterEngine::IsAAEnabled() const
+{
+ return jsEngine->Evaluate("API.isAASubscriptionEnabled()")->AsBool();
+}
+
+std::string FilterEngine::GetAAURL() const
+{
+ return GetPref("subscriptions_exceptionsurl")->AsString();
+}
+
void FilterEngine::ShowNextNotification(const std::string& url)
{
JsValuePtr func = jsEngine->Evaluate("API.showNextNotification");

Powered by Google App Engine
This is Rietveld