| 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 Profile; | 15 class Profile; |
| 16 | 16 |
| 17 // Interface that enables the different kind of notifications to process | 17 // Interface that enables the different kind of notifications to process |
| 18 // operations coming from the user or decisions made by the underlying | 18 // operations coming from the user or decisions made by the underlying |
| 19 // notification type. | 19 // notification type. |
| 20 class NotificationHandler { | 20 class NotificationHandler { |
| 21 public: | 21 public: |
| 22 virtual ~NotificationHandler() {} | 22 virtual ~NotificationHandler() {} |
| 23 | 23 |
| 24 // Called after displaying a toast in case the caller needs some processing. |
| 24 virtual void OnShow(Profile* profile, const std::string& notification_id) = 0; | 25 virtual void OnShow(Profile* profile, const std::string& notification_id) = 0; |
| 25 | 26 |
| 26 // Process notification close events. | 27 // Process notification close events. |
| 27 virtual void OnClose(Profile* profile, | 28 virtual void OnClose(Profile* profile, |
| 28 const std::string& origin, | 29 const std::string& origin, |
| 29 const std::string& notification_id, | 30 const std::string& notification_id, |
| 30 bool by_user) = 0; | 31 bool by_user) = 0; |
| 31 | 32 |
| 32 // Process cliks to a notification or its buttons, depending on | 33 // Process cliks to a notification or its buttons, depending on |
| 33 // |action_index|. | 34 // |action_index|. |
| 34 virtual void OnClick(Profile* profile, | 35 virtual void OnClick(Profile* profile, |
| 35 const std::string& origin, | 36 const std::string& origin, |
| 36 const std::string& notification_id, | 37 const std::string& notification_id, |
| 37 int action_index, | 38 int action_index, |
| 38 const base::NullableString16& reply) = 0; | 39 const base::NullableString16& reply) = 0; |
| 39 | 40 |
| 40 // Open notification settings. | 41 // Open notification settings. |
| 41 virtual void OpenSettings(Profile* profile) = 0; | 42 virtual void OpenSettings(Profile* profile) = 0; |
| 43 |
| 44 // Whether a notification should be displayed if in full screen. This is |
| 45 // ignored by native notifications since the decision is made by the |
| 46 // underlying OS in that case. |
| 47 virtual bool ShouldDisplayOnFullScreen(Profile* profile, |
| 48 const std::string& origin) const = 0; |
| 42 }; | 49 }; |
| 43 | 50 |
| 44 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_HANDLER_H_ | 51 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_HANDLER_H_ |
| OLD | NEW |