Index: chrome/browser/notifications/notification_handler.h |
diff --git a/chrome/browser/notifications/notification_handler.h b/chrome/browser/notifications/notification_handler.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9104e20c285e1c16ec67b458aa372e2e05977328 |
--- /dev/null |
+++ b/chrome/browser/notifications/notification_handler.h |
@@ -0,0 +1,48 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_HANDLER_H_ |
+#define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_HANDLER_H_ |
+ |
+#include <memory> |
+#include <string> |
+ |
+#include "chrome/browser/notifications/notification_operation_common.h" |
+ |
+class Notification; |
+class Profile; |
+ |
+// Interface that enables the different kind of notifications |
+// to process operations coming from the user. |
+// Whenever a notification is clicked or closed or a button is pressed |
+// the right kind of NotificationHandler will deal with the operation. |
+class NotificationHandler { |
+ public: |
+ virtual ~NotificationHandler() {} |
+ |
+ // Handles a given |operation|, click, close etc. |
+ // This is only meant for user initiated actions. |
+ // For a notification with |notification_id| and a certain |profile|. |
+ virtual void HandleNotificationOperation( |
+ notification_operation_common::NotificationOperation operation, |
Peter Beverloo
2016/06/29 00:23:16
Could we instead just have multiple methods on the
Miguel Garcia
2016/07/05 13:54:50
Done.
|
+ Profile* profile, |
+ const std::string& origin, |
+ const std::string& notification_id, |
+ int action_index) = 0; |
+ |
+ // Registers a |Notification| object with this handler. |
+ virtual void RegisterNotification( |
Peter Beverloo
2016/06/29 00:23:16
This should be the displayer's responsibility. For
Miguel Garcia
2016/07/05 13:54:50
As agreed offline I moved to only storing the dele
|
+ const std::string& notification_id, |
+ std::unique_ptr<Notification> notification) = 0; |
+ |
+ // Meant for programatically closed notification. |
+ virtual void CloseNotification(Profile* profile, |
Peter Beverloo
2016/06/29 00:23:16
This should be a |by_user| boolean flag in the `On
Miguel Garcia
2016/07/05 13:54:50
Done.
|
+ const std::string& notification_id) = 0; |
+ |
+ // Return the kind of notifications the class knows how to handle. |
+ virtual notification_operation_common::NotificationHandlerType |
+ NotificationType() = 0; |
+}; |
+ |
+#endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_HANDLER_H_ |