| 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 CONTENT_CHILD_NOTIFICATIONS_NOTIFICATION_MANAGER_H_ | 5 #ifndef CONTENT_CHILD_NOTIFICATIONS_NOTIFICATION_MANAGER_H_ |
| 6 #define CONTENT_CHILD_NOTIFICATIONS_NOTIFICATION_MANAGER_H_ | 6 #define CONTENT_CHILD_NOTIFICATIONS_NOTIFICATION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 8 #include <map> | 11 #include <map> |
| 9 #include <set> | 12 #include <set> |
| 10 #include <vector> | 13 #include <vector> |
| 11 | 14 |
| 12 #include "base/id_map.h" | 15 #include "base/id_map.h" |
| 16 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 14 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
| 15 #include "content/child/notifications/notification_dispatcher.h" | 19 #include "content/child/notifications/notification_dispatcher.h" |
| 16 #include "content/child/notifications/pending_notifications_tracker.h" | 20 #include "content/child/notifications/pending_notifications_tracker.h" |
| 17 #include "content/common/platform_notification_messages.h" | 21 #include "content/common/platform_notification_messages.h" |
| 18 #include "content/public/child/worker_thread.h" | 22 #include "content/public/child/worker_thread.h" |
| 19 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati
onManager.h" | 23 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati
onManager.h" |
| 20 | 24 |
| 21 class SkBitmap; | 25 class SkBitmap; |
| 22 | 26 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 blink::WebNotificationDelegate* delegate, | 93 blink::WebNotificationDelegate* delegate, |
| 90 const SkBitmap& icon); | 94 const SkBitmap& icon); |
| 91 | 95 |
| 92 // To be called when a persistent notification is ready to be displayed. Will | 96 // To be called when a persistent notification is ready to be displayed. Will |
| 93 // inform the browser process about all available data. The |callbacks| will | 97 // inform the browser process about all available data. The |callbacks| will |
| 94 // be used to inform the Promise pending in Blink that the notification has | 98 // be used to inform the Promise pending in Blink that the notification has |
| 95 // been send to the browser process to be displayed. | 99 // been send to the browser process to be displayed. |
| 96 void DisplayPersistentNotification( | 100 void DisplayPersistentNotification( |
| 97 const blink::WebSecurityOrigin& origin, | 101 const blink::WebSecurityOrigin& origin, |
| 98 const blink::WebNotificationData& notification_data, | 102 const blink::WebNotificationData& notification_data, |
| 99 int64 service_worker_registration_id, | 103 int64_t service_worker_registration_id, |
| 100 scoped_ptr<blink::WebNotificationShowCallbacks> callbacks, | 104 scoped_ptr<blink::WebNotificationShowCallbacks> callbacks, |
| 101 const SkBitmap& icon); | 105 const SkBitmap& icon); |
| 102 | 106 |
| 103 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 107 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 104 scoped_refptr<NotificationDispatcher> notification_dispatcher_; | 108 scoped_refptr<NotificationDispatcher> notification_dispatcher_; |
| 105 | 109 |
| 106 // Tracker which stores all pending Notifications, both page and persistent | 110 // Tracker which stores all pending Notifications, both page and persistent |
| 107 // ones, until all their associated resources have been fetched. | 111 // ones, until all their associated resources have been fetched. |
| 108 PendingNotificationsTracker pending_notifications_; | 112 PendingNotificationsTracker pending_notifications_; |
| 109 | 113 |
| 110 // Tracks pending requests for getting a list of notifications. | 114 // Tracks pending requests for getting a list of notifications. |
| 111 IDMap<blink::WebNotificationGetCallbacks, IDMapOwnPointer> | 115 IDMap<blink::WebNotificationGetCallbacks, IDMapOwnPointer> |
| 112 pending_get_notification_requests_; | 116 pending_get_notification_requests_; |
| 113 | 117 |
| 114 // Tracks pending requests for displaying persistent notifications. | 118 // Tracks pending requests for displaying persistent notifications. |
| 115 IDMap<blink::WebNotificationShowCallbacks, IDMapOwnPointer> | 119 IDMap<blink::WebNotificationShowCallbacks, IDMapOwnPointer> |
| 116 pending_show_notification_requests_; | 120 pending_show_notification_requests_; |
| 117 | 121 |
| 118 // Map to store the delegate associated with a notification request Id. | 122 // Map to store the delegate associated with a notification request Id. |
| 119 std::map<int, blink::WebNotificationDelegate*> active_page_notifications_; | 123 std::map<int, blink::WebNotificationDelegate*> active_page_notifications_; |
| 120 | 124 |
| 121 DISALLOW_COPY_AND_ASSIGN(NotificationManager); | 125 DISALLOW_COPY_AND_ASSIGN(NotificationManager); |
| 122 }; | 126 }; |
| 123 | 127 |
| 124 } // namespace content | 128 } // namespace content |
| 125 | 129 |
| 126 #endif // CONTENT_CHILD_NOTIFICATIONS_NOTIFICATION_MANAGER_H_ | 130 #endif // CONTENT_CHILD_NOTIFICATIONS_NOTIFICATION_MANAGER_H_ |
| OLD | NEW |