Chromium Code Reviews| Index: chrome/browser/notifications/notification_display_service.h |
| diff --git a/chrome/browser/notifications/notification_display_service.h b/chrome/browser/notifications/notification_display_service.h |
| index 92cf5ece841ca2d46495260c1e2cef23531108a9..68a3062296554cb07627cbd114d30c15d067605b 100644 |
| --- a/chrome/browser/notifications/notification_display_service.h |
| +++ b/chrome/browser/notifications/notification_display_service.h |
| @@ -5,6 +5,7 @@ |
| #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DISPLAY_SERVICE_H_ |
| #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_DISPLAY_SERVICE_H_ |
| +#include <map> |
| #include <memory> |
| #include <set> |
| #include <string> |
| @@ -14,7 +15,12 @@ |
| #include "chrome/browser/notifications/notification_common.h" |
| #include "components/keyed_service/core/keyed_service.h" |
| +namespace base { |
| +class NullableString16; |
| +} |
| + |
| class Notification; |
| +class NotificationHandler; |
| class Profile; |
| // Profile-bound service that enables notifications to be displayed and |
| @@ -28,8 +34,8 @@ class NotificationDisplayService : public KeyedService { |
| using DisplayedNotificationsCallback = |
| base::Callback<void(std::unique_ptr<std::set<std::string>>, |
| bool /* supports_synchronization */)>; |
| - NotificationDisplayService() {} |
| - ~NotificationDisplayService() override {} |
| + explicit NotificationDisplayService(Profile* profile); |
| + ~NotificationDisplayService() override; |
| // Displays the |notification| identified by |notification_id|. |
| virtual void Display(NotificationCommon::Type notification_type, |
| @@ -44,7 +50,29 @@ class NotificationDisplayService : public KeyedService { |
| // invokes |callback| with the result once known. |
| virtual void GetDisplayed(const DisplayedNotificationsCallback& callback) = 0; |
| + // Used to propagate back events (click, close...). |
|
Peter Beverloo
2017/06/01 11:32:46
Used by who? Now that the service has two categori
Miguel Garcia
2017/06/02 15:02:55
Done.
|
| + virtual void ProcessNotificationOperation( |
|
Peter Beverloo
2017/06/01 11:32:46
Drop "virtual"?
Miguel Garcia
2017/06/02 15:02:55
Done.
|
| + NotificationCommon::Operation operation, |
| + NotificationCommon::Type notification_type, |
| + const std::string& origin, |
| + const std::string& notification_id, |
| + int action_index, |
| + const base::NullableString16& reply); |
| + |
| + protected: |
| + NotificationHandler* GetNotificationHandler( |
| + NotificationCommon::Type notification_type); |
| + |
| private: |
| + // Registers an implementation object to handle notification operations |
| + // for |notification_type|. |
| + void AddNotificationHandler(NotificationCommon::Type notification_type, |
| + std::unique_ptr<NotificationHandler> handler); |
|
Peter Beverloo
2017/06/01 11:32:46
We'd move this to the factory, right? That'd requi
Miguel Garcia
2017/06/02 15:02:55
Yeah right now we are still adding the handlers in
|
| + |
| + std::map<NotificationCommon::Type, std::unique_ptr<NotificationHandler>> |
| + notification_handlers_; |
| + Profile* profile_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(NotificationDisplayService); |
| }; |