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 <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 bool OnMessageReceived(const IPC::Message& message); | 66 bool OnMessageReceived(const IPC::Message& message); |
67 | 67 |
68 private: | 68 private: |
69 NotificationManager( | 69 NotificationManager( |
70 ThreadSafeSender* thread_safe_sender, | 70 ThreadSafeSender* thread_safe_sender, |
71 base::SingleThreadTaskRunner* main_thread_task_runner, | 71 base::SingleThreadTaskRunner* main_thread_task_runner, |
72 NotificationDispatcher* notification_dispatcher); | 72 NotificationDispatcher* notification_dispatcher); |
73 | 73 |
74 // IPC message handlers. | 74 // IPC message handlers. |
75 void OnDidShow(int notification_id); | 75 void OnDidShow(int notification_id); |
| 76 void OnDidShowPersistent(int request_id, bool success); |
76 void OnDidClose(int notification_id); | 77 void OnDidClose(int notification_id); |
77 void OnDidClick(int notification_id); | 78 void OnDidClick(int notification_id); |
78 void OnDidGetNotifications( | 79 void OnDidGetNotifications( |
79 int request_id, | 80 int request_id, |
80 const std::vector<PersistentNotificationInfo>& notification_infos); | 81 const std::vector<PersistentNotificationInfo>& notification_infos); |
81 | 82 |
82 // To be called when a page notification is ready to be displayed. Will | 83 // To be called when a page notification is ready to be displayed. Will |
83 // inform the browser process about all available data. The |delegate|, | 84 // inform the browser process about all available data. The |delegate|, |
84 // owned by Blink, will be used to feed back events associated with the | 85 // owned by Blink, will be used to feed back events associated with the |
85 // notification to the JavaScript object. | 86 // notification to the JavaScript object. |
(...skipping 18 matching lines...) Expand all Loading... |
104 scoped_refptr<NotificationDispatcher> notification_dispatcher_; | 105 scoped_refptr<NotificationDispatcher> notification_dispatcher_; |
105 | 106 |
106 // Tracker which stores all pending Notifications, both page and persistent | 107 // Tracker which stores all pending Notifications, both page and persistent |
107 // ones, until all their associated resources have been fetched. | 108 // ones, until all their associated resources have been fetched. |
108 PendingNotificationsTracker pending_notifications_; | 109 PendingNotificationsTracker pending_notifications_; |
109 | 110 |
110 // Tracks pending requests for getting a list of notifications. | 111 // Tracks pending requests for getting a list of notifications. |
111 IDMap<blink::WebNotificationGetCallbacks, IDMapOwnPointer> | 112 IDMap<blink::WebNotificationGetCallbacks, IDMapOwnPointer> |
112 pending_get_notification_requests_; | 113 pending_get_notification_requests_; |
113 | 114 |
| 115 // Tracks pending requests for displaying persistent notifications. |
| 116 IDMap<blink::WebNotificationShowCallbacks, IDMapOwnPointer> |
| 117 pending_show_notification_requests_; |
| 118 |
114 // Map to store the delegate associated with a notification request Id. | 119 // Map to store the delegate associated with a notification request Id. |
115 std::map<int, blink::WebNotificationDelegate*> active_page_notifications_; | 120 std::map<int, blink::WebNotificationDelegate*> active_page_notifications_; |
116 | 121 |
117 DISALLOW_COPY_AND_ASSIGN(NotificationManager); | 122 DISALLOW_COPY_AND_ASSIGN(NotificationManager); |
118 }; | 123 }; |
119 | 124 |
120 } // namespace content | 125 } // namespace content |
121 | 126 |
122 #endif // CONTENT_CHILD_NOTIFICATIONS_NOTIFICATION_MANAGER_H_ | 127 #endif // CONTENT_CHILD_NOTIFICATIONS_NOTIFICATION_MANAGER_H_ |
OLD | NEW |