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> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 void OnDidClose(int notification_id); | 75 void OnDidClose(int notification_id); |
76 void OnDidClick(int notification_id); | 76 void OnDidClick(int notification_id); |
77 void OnDidGetNotifications( | 77 void OnDidGetNotifications( |
78 int request_id, | 78 int request_id, |
79 const std::vector<PersistentNotificationInfo>& notification_infos); | 79 const std::vector<PersistentNotificationInfo>& notification_infos); |
80 | 80 |
81 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 81 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
82 scoped_refptr<NotificationDispatcher> notification_dispatcher_; | 82 scoped_refptr<NotificationDispatcher> notification_dispatcher_; |
83 | 83 |
84 // Tracks pending requests for getting a list of notifications. | 84 // Tracks pending requests for getting a list of notifications. |
85 IDMap<blink::WebNotificationGetCallbacks, IDMapOwnPointer> | 85 IDMap<std::unique_ptr<blink::WebNotificationGetCallbacks>> |
86 pending_get_notification_requests_; | 86 pending_get_notification_requests_; |
87 | 87 |
88 // Tracks pending requests for displaying persistent notifications. | 88 // Tracks pending requests for displaying persistent notifications. |
89 IDMap<blink::WebNotificationShowCallbacks, IDMapOwnPointer> | 89 IDMap<std::unique_ptr<blink::WebNotificationShowCallbacks>> |
90 pending_show_notification_requests_; | 90 pending_show_notification_requests_; |
91 | 91 |
92 // Structure holding the information for active non-persistent notifications. | 92 // Structure holding the information for active non-persistent notifications. |
93 struct ActiveNotificationData { | 93 struct ActiveNotificationData { |
94 ActiveNotificationData() = default; | 94 ActiveNotificationData() = default; |
95 ActiveNotificationData(blink::WebNotificationDelegate* delegate, | 95 ActiveNotificationData(blink::WebNotificationDelegate* delegate, |
96 const GURL& origin, | 96 const GURL& origin, |
97 const std::string& tag); | 97 const std::string& tag); |
98 ~ActiveNotificationData(); | 98 ~ActiveNotificationData(); |
99 | 99 |
100 blink::WebNotificationDelegate* delegate = nullptr; | 100 blink::WebNotificationDelegate* delegate = nullptr; |
101 GURL origin; | 101 GURL origin; |
102 std::string tag; | 102 std::string tag; |
103 }; | 103 }; |
104 | 104 |
105 // Map to store the delegate associated with a notification request Id. | 105 // Map to store the delegate associated with a notification request Id. |
106 std::unordered_map<int, ActiveNotificationData> active_page_notifications_; | 106 std::unordered_map<int, ActiveNotificationData> active_page_notifications_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(NotificationManager); | 108 DISALLOW_COPY_AND_ASSIGN(NotificationManager); |
109 }; | 109 }; |
110 | 110 |
111 } // namespace content | 111 } // namespace content |
112 | 112 |
113 #endif // CONTENT_CHILD_NOTIFICATIONS_NOTIFICATION_MANAGER_H_ | 113 #endif // CONTENT_CHILD_NOTIFICATIONS_NOTIFICATION_MANAGER_H_ |
OLD | NEW |