Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_HANDLER_H_ | |
| 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_HANDLER_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "chrome/browser/notifications/notification_operation_common.h" | |
| 12 | |
| 13 class Notification; | |
| 14 class Profile; | |
| 15 | |
| 16 // Interface that enables the different kind of notifications | |
| 17 // to process operations coming from the user. | |
| 18 // Whenever a notification is clicked or closed or a button is pressed | |
| 19 // the right kind of NotificationHandler will deal with the operation. | |
| 20 class NotificationHandler { | |
| 21 public: | |
| 22 virtual ~NotificationHandler() {} | |
| 23 | |
| 24 // Handles a given |operation|, click, close etc. | |
| 25 // This is only meant for user initiated actions. | |
| 26 // For a notification with |notification_id| and a certain |profile|. | |
| 27 virtual void HandleNotificationOperation( | |
| 28 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.
| |
| 29 Profile* profile, | |
| 30 const std::string& origin, | |
| 31 const std::string& notification_id, | |
| 32 int action_index) = 0; | |
| 33 | |
| 34 // Registers a |Notification| object with this handler. | |
| 35 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
| |
| 36 const std::string& notification_id, | |
| 37 std::unique_ptr<Notification> notification) = 0; | |
| 38 | |
| 39 // Meant for programatically closed notification. | |
| 40 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.
| |
| 41 const std::string& notification_id) = 0; | |
| 42 | |
| 43 // Return the kind of notifications the class knows how to handle. | |
| 44 virtual notification_operation_common::NotificationHandlerType | |
| 45 NotificationType() = 0; | |
| 46 }; | |
| 47 | |
| 48 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_HANDLER_H_ | |
| OLD | NEW |