OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ |
6 #define CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 static PlatformNotificationServiceImpl* GetInstance(); | 33 static PlatformNotificationServiceImpl* GetInstance(); |
34 | 34 |
35 // To be called when a persistent notification has been clicked on. The | 35 // To be called when a persistent notification has been clicked on. The |
36 // Service Worker associated with the registration will be started if | 36 // Service Worker associated with the registration will be started if |
37 // needed, on which the event will be fired. Must be called on the UI thread. | 37 // needed, on which the event will be fired. Must be called on the UI thread. |
38 void OnPersistentNotificationClick( | 38 void OnPersistentNotificationClick( |
39 content::BrowserContext* browser_context, | 39 content::BrowserContext* browser_context, |
40 int64_t persistent_notification_id, | 40 int64_t persistent_notification_id, |
41 const GURL& origin) const; | 41 const GURL& origin) const; |
42 | 42 |
| 43 // To be called when a persistent notification has been closed. The data |
| 44 // associated with the notification has to be pruned from the database in this |
| 45 // case, to make sure that it continues to be in sync. Must be called on the |
| 46 // UI thread. |
| 47 void OnPersistentNotificationClose( |
| 48 content::BrowserContext* browser_context, |
| 49 int64_t persistent_notification_id, |
| 50 const GURL& origin) const; |
| 51 |
43 // Returns the Notification UI Manager through which notifications can be | 52 // Returns the Notification UI Manager through which notifications can be |
44 // displayed to the user. Can be overridden for testing. | 53 // displayed to the user. Can be overridden for testing. |
45 NotificationUIManager* GetNotificationUIManager() const; | 54 NotificationUIManager* GetNotificationUIManager() const; |
46 | 55 |
47 // content::PlatformNotificationService implementation. | 56 // content::PlatformNotificationService implementation. |
48 blink::WebNotificationPermission CheckPermissionOnUIThread( | 57 blink::WebNotificationPermission CheckPermissionOnUIThread( |
49 content::BrowserContext* browser_context, | 58 content::BrowserContext* browser_context, |
50 const GURL& origin, | 59 const GURL& origin, |
51 int render_process_id) override; | 60 int render_process_id) override; |
52 blink::WebNotificationPermission CheckPermissionOnIOThread( | 61 blink::WebNotificationPermission CheckPermissionOnIOThread( |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 NotificationUIManager* notification_ui_manager_for_tests_; | 123 NotificationUIManager* notification_ui_manager_for_tests_; |
115 | 124 |
116 // Mapping between a persistent notification id and the id of the associated | 125 // Mapping between a persistent notification id and the id of the associated |
117 // message_center::Notification object. Must only be used on the UI thread. | 126 // message_center::Notification object. Must only be used on the UI thread. |
118 std::map<int64_t, std::string> persistent_notifications_; | 127 std::map<int64_t, std::string> persistent_notifications_; |
119 | 128 |
120 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationServiceImpl); | 129 DISALLOW_COPY_AND_ASSIGN(PlatformNotificationServiceImpl); |
121 }; | 130 }; |
122 | 131 |
123 #endif // CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ | 132 #endif // CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ |
OLD | NEW |