OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_HANDLER_H_ |
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_HANDLER_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_HANDLER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 namespace base { | 11 namespace base { |
12 class NullableString16; | 12 class NullableString16; |
13 } | 13 } |
14 | 14 |
| 15 class NotificationDelegate; |
15 class Profile; | 16 class Profile; |
16 | 17 |
17 // Interface that enables the different kind of notifications to process | 18 // Interface that enables the different kind of notifications to process |
18 // operations coming from the user. | 19 // operations coming from the user. |
19 class NotificationHandler { | 20 class NotificationHandler { |
20 public: | 21 public: |
21 virtual ~NotificationHandler() {} | 22 virtual ~NotificationHandler() {} |
22 | 23 |
23 // Process notification close events. | 24 // Process notification close events. |
24 virtual void OnClose(Profile* profile, | 25 virtual void OnClose(Profile* profile, |
25 const std::string& origin, | 26 const std::string& origin, |
26 const std::string& notification_id, | 27 const std::string& notification_id, |
27 bool by_user) = 0; | 28 bool by_user) = 0; |
28 | 29 |
29 // Process cliks to a notification or its buttons, depending on | 30 // Process cliks to a notification or its buttons, depending on |
30 // |action_index|. | 31 // |action_index|. |
31 virtual void OnClick(Profile* profile, | 32 virtual void OnClick(Profile* profile, |
32 const std::string& origin, | 33 const std::string& origin, |
33 const std::string& notification_id, | 34 const std::string& notification_id, |
34 int action_index, | 35 int action_index, |
35 const base::NullableString16& reply) = 0; | 36 const base::NullableString16& reply) = 0; |
36 | 37 |
37 // Open notification settings. | 38 // Open notification settings. |
38 virtual void OpenSettings(Profile* profile) = 0; | 39 virtual void OpenSettings(Profile* profile) = 0; |
| 40 |
| 41 // Registers a |delegate| object with this handler. |
| 42 virtual void RegisterNotification(const std::string& notification_id, |
| 43 NotificationDelegate* delegate) = 0; |
39 }; | 44 }; |
40 | 45 |
41 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_HANDLER_H_ | 46 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_HANDLER_H_ |
OLD | NEW |