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

Unified Diff: include/AdblockPlus/FilterEngine.h

Issue 5797488346791936: Issue 1107 - Support notifications (Closed)
Patch Set: Created Jan. 19, 2015, 12:50 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 | « include/AdblockPlus.h ('k') | include/AdblockPlus/JsEngine.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/AdblockPlus/FilterEngine.h
diff --git a/include/AdblockPlus/FilterEngine.h b/include/AdblockPlus/FilterEngine.h
index b81433f5c9bf1b540cf837f6df1a1662bc623454..e256b3c3a5c50de65d0bee266ebb897efe1d2483 100644
--- a/include/AdblockPlus/FilterEngine.h
+++ b/include/AdblockPlus/FilterEngine.h
@@ -24,6 +24,7 @@
#include <vector>
#include <AdblockPlus/JsEngine.h>
#include <AdblockPlus/JsValue.h>
+#include <AdblockPlus/Notification.h>
#include "tr1_memory.h"
@@ -237,6 +238,52 @@ namespace AdblockPlus
std::vector<SubscriptionPtr> FetchAvailableSubscriptions() const;
/**
+ * Creates new Notification(see `Notification`) object.
+ * @param type Type of the notification.
+ * @param id Id of the newly created notification.
+ * @return New Notification instance.
+ */
+ std::tr1::shared_ptr<Notification> CreateNotification(NotificationType type,
+ const std::string& id) const;
Wladimir Palant 2015/01/21 13:48:28 Why do we need this in the public API? Shouldn't n
sergei 2015/01/21 15:58:55 It is for local notifications. @Felix
Wladimir Palant 2015/01/21 19:23:18 What kind of local notifications? If the client ap
+
+ /**
+ * Determines which notification is to be shown next.
+ * @param url URL to match notifications to (optional).
+ * @return Notification to be shown, or null if there is no any.
+ */
+ std::tr1::shared_ptr<Notification> GetNextNotificationToShow(
+ const std::string& url = std::string());
+
+ /**
+ * Localizes the texts of the supplied notification.
+ * @param notification Notification to translate.
+ * @param locale The target locale (optional, defaults to the
+ * application locale)
Wladimir Palant 2015/01/21 13:48:28 Do we need this parameter at all? When would it ma
sergei 2015/01/21 15:58:55 1. The javascript notifications API has this argum
Wladimir Palant 2015/01/21 19:23:18 Yes, and it is already unused there. All the more
Felix Dahlke 2015/01/22 03:31:08 Agreed. I actually think we should remove it from
sergei 2015/01/22 14:08:15 I've removed locale for notification texts.
+ * @return the translated texts.
+ */
+ NotificationTexts GetNotificationTexts(
+ const std::tr1::shared_ptr<Notification>& notification,
+ const std::string& locale = std::string()) const;
Wladimir Palant 2015/01/21 13:48:28 Why isn't this a methods of the Notification class
sergei 2015/01/21 15:58:55 1. GetNotificationTexts is moved into Notification
Wladimir Palant 2015/01/21 19:23:18 What kind of flexibility? If we have a Notificatio
Felix Dahlke 2015/01/22 03:31:08 Agreed - there is no notification object in that s
sergei 2015/01/22 14:08:15 MarkAsShown is moved into Notification class. Just
+
+ /**
+ * Adds a local notification.
+ * @param value The notification to add
+ */
+ void AddNotification(const std::tr1::shared_ptr<Notification>& value);
Wladimir Palant 2015/01/21 13:48:28 Why do we need an API to add "local" notifications
sergei 2015/01/21 15:58:55 I guess it is designed for the cases when we can d
Felix Dahlke 2015/01/22 03:31:08 You're right Sergei, the question notification is
+
+ /**
+ * Removes an existing local notification.
+ * @param notification The notification to remove.
+ */
+ void RemoveNotification(const std::tr1::shared_ptr<Notification>& value);
+
+ /**
+ * Marks the notification as shown.
+ * @param notificationId The notification ID.
+ */
+ void MarkNotificationAsShown(const std::string& notificationId);
+
+ /**
* Checks if any active filter matches the supplied URL.
* @param url URL to match.
* @param contentType Content type of the requested resource.
« no previous file with comments | « include/AdblockPlus.h ('k') | include/AdblockPlus/JsEngine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld