Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3843)

Unified Diff: chrome/browser/notifications/native_notification_display_service.h

Issue 2093953002: Introduce a new API to handle native notification clicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/notifications/native_notification_display_service.h
diff --git a/chrome/browser/notifications/native_notification_display_service.h b/chrome/browser/notifications/native_notification_display_service.h
index 37989383a1d846ec7f50254d7cc3ece8e25acc9b..0cb5cd95e189107084b7e706af91b8f40b76e980 100644
--- a/chrome/browser/notifications/native_notification_display_service.h
+++ b/chrome/browser/notifications/native_notification_display_service.h
@@ -5,12 +5,17 @@
#ifndef CHROME_BROWSER_NOTIFICATIONS_NATIVE_NOTIFICATION_DISPLAY_SERVICE_H_
#define CHROME_BROWSER_NOTIFICATIONS_NATIVE_NOTIFICATION_DISPLAY_SERVICE_H_
+#include <map>
+#include <memory>
#include <set>
#include <string>
+
#include "base/macros.h"
+#include "chrome/browser/notifications/notification_common.h"
#include "chrome/browser/notifications/notification_display_service.h"
class Notification;
+class NotificationHandler;
class NotificationPlatformBridge;
class Profile;
@@ -24,15 +29,38 @@ class NativeNotificationDisplayService : public NotificationDisplayService {
~NativeNotificationDisplayService() override;
// NotificationDisplayService implementation.
- void Display(const std::string& notification_id,
+ void Display(NotificationCommon::Type notification_type,
+ const std::string& notification_id,
const Notification& notification) override;
- void Close(const std::string& notification_id) override;
+ void Close(NotificationCommon::Type notification_type,
+ const std::string& notification_id) override;
bool GetDisplayed(std::set<std::string>* notifications) const override;
+
Peter Beverloo 2016/07/05 23:44:17 micro nit: no new line (the comment at 31 starts a
Miguel Garcia 2016/07/07 11:02:29 Done.
bool SupportsNotificationCenter() const override;
+ // Used by the notification bridge to propagate back events (click, close...)
+ void ProcessNotificationOperation(NotificationCommon::Operation operation,
+ NotificationCommon::Type notification_type,
+ const std::string& origin,
+ const std::string& notification_id,
+ int action_index);
+
+ // Registers an implementation object to handle notification operations
+ // for |notification_type|
+ void AddNotificationHandler(NotificationCommon::Type notification_type,
+ std::unique_ptr<NotificationHandler> handler);
+
+ // Removes an implementation added via |AddNotificationHandler|
Peter Beverloo 2016/07/05 23:44:17 nit: finish the comments with periods on lines 41,
Miguel Garcia 2016/07/07 11:02:29 Done.
+ void RemoveNotificationHandler(NotificationCommon::Type notification_type);
+
private:
+ NotificationHandler* GetNotificationHandler(
+ NotificationCommon::Type notification_type);
+
Profile* profile_;
NotificationPlatformBridge* notification_bridge_;
+ std::map<NotificationCommon::Type, std::unique_ptr<NotificationHandler>>
+ notification_handlers_;
DISALLOW_COPY_AND_ASSIGN(NativeNotificationDisplayService);
};

Powered by Google App Engine
This is Rietveld 408576698