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

Unified Diff: src/FilterEngine.cpp

Issue 29317074: Issue 2693 - Update adblockplus dependency (Closed)
Patch Set: Created June 18, 2015, 3:31 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 | « lib/prefs.js ('k') | test/Notification.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/FilterEngine.cpp
diff --git a/src/FilterEngine.cpp b/src/FilterEngine.cpp
index 96c4571fbf593f47041bd3415fc44d73f55da7f1..bbf4d5db0b2349cd5264ce6d4f69a01b1e4d191f 100644
--- a/src/FilterEngine.cpp
+++ b/src/FilterEngine.cpp
@@ -257,15 +257,30 @@ std::vector<SubscriptionPtr> FilterEngine::FetchAvailableSubscriptions() const
return result;
}
-NotificationPtr FilterEngine::GetNextNotificationToShow(const std::string& url)
+void FilterEngine::ShowNextNotification(const std::string& url)
{
- JsValuePtr func = jsEngine->Evaluate("API.getNextNotificationToShow");
+ JsValuePtr func = jsEngine->Evaluate("API.showNextNotification");
JsValueList params;
if (!url.empty())
{
params.push_back(jsEngine->NewValue(url));
}
- return Notification::JsValueToNotification(func->Call(params));
+ func->Call(params);
+}
+
+void FilterEngine::SetNotificationAvailableCallback(const NotificationAvailableCallback& value)
+{
+ if (!value)
+ return;
+
+ jsEngine->SetEventCallback("notificationAvailable",
+ std::tr1::bind(&FilterEngine::NotificationAvailable, this, value,
+ std::tr1::placeholders::_1));
+}
+
+void FilterEngine::RemoveNotificationAvailableCallback()
+{
+ jsEngine->RemoveEventCallback("notificationAvailable");
}
AdblockPlus::FilterPtr FilterEngine::Matches(const std::string& url,
@@ -414,6 +429,16 @@ void FilterEngine::FilterChanged(FilterEngine::FilterChangeCallback callback, Js
callback(action, item);
}
+void FilterEngine::NotificationAvailable(const NotificationAvailableCallback& callback,
+ const JsValueList& params)
+{
+ if (params.size() < 1)
+ return;
+
+ callback(Notification::JsValueToNotification(params[0]));
+}
+
+
int FilterEngine::CompareVersions(const std::string& v1, const std::string& v2)
{
JsValueList params;
« no previous file with comments | « lib/prefs.js ('k') | test/Notification.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld