Index: src/FilterEngine.cpp |
diff --git a/src/FilterEngine.cpp b/src/FilterEngine.cpp |
index 3d4770dfe98ca93df67a5bbdcd97d3cf551996e0..9efb59edf89983ea96a177e57331cb5fe5a7e2c0 100644 |
--- a/src/FilterEngine.cpp |
+++ b/src/FilterEngine.cpp |
@@ -257,6 +257,50 @@ std::vector<SubscriptionPtr> FilterEngine::FetchAvailableSubscriptions() const |
return result; |
} |
+std::tr1::shared_ptr<Notification> FilterEngine::CreateNotification(NotificationType type, const std::string& id) const |
+{ |
+ return std::tr1::make_shared<Notification>(type, id, jsEngine->NewObject(), Notification::PrivateCtrArg()); |
+} |
+ |
+std::tr1::shared_ptr<Notification> FilterEngine::GetNextNotificationToShow(const std::string& url /*= std::string()*/) |
+{ |
+ JsValuePtr func = jsEngine->Evaluate("API.getNextNotificationToShow"); |
+ if (!func) |
+ { |
+ return std::tr1::shared_ptr<Notification>(); |
+ } |
+ JsValueList params; |
+ if (!url.empty()) |
+ { |
+ params.push_back(jsEngine->NewValue(url)); |
+ } |
+ return Notification::JsValueToNotification(func->Call(params)); |
+} |
+ |
+void FilterEngine::AddNotification(const std::tr1::shared_ptr<Notification>& value) |
+{ |
+ JsValuePtr func = jsEngine->Evaluate("API.addNotification"); |
+ if (!func) |
+ { |
+ return; |
+ } |
+ JsValueList params; |
+ params.push_back(value); |
+ func->Call(params); |
+} |
+ |
+void FilterEngine::RemoveNotification(const std::tr1::shared_ptr<Notification>& value) |
+{ |
+ JsValuePtr func = jsEngine->Evaluate("API.removeNotification"); |
+ if (!func) |
+ { |
+ return; |
+ } |
+ JsValueList params; |
+ params.push_back(value); |
+ func->Call(params); |
+} |
+ |
AdblockPlus::FilterPtr FilterEngine::Matches(const std::string& url, |
ContentType contentType, |
const std::string& documentUrl) const |