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 #include "content/child/notifications/notification_manager.h" | 5 #include "content/child/notifications/notification_manager.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 active_page_notifications_.erase(iter.first); | 127 active_page_notifications_.erase(iter.first); |
128 return; | 128 return; |
129 } | 129 } |
130 | 130 |
131 // It should not be possible for Blink to call close() on a Notification which | 131 // It should not be possible for Blink to call close() on a Notification which |
132 // does not exist in either the pending or active notification lists. | 132 // does not exist in either the pending or active notification lists. |
133 NOTREACHED(); | 133 NOTREACHED(); |
134 } | 134 } |
135 | 135 |
136 void NotificationManager::closePersistent( | 136 void NotificationManager::closePersistent( |
| 137 const blink::WebSerializedOrigin& origin, |
| 138 const blink::WebString& persistent_notification_id) { |
| 139 thread_safe_sender_->Send(new PlatformNotificationHostMsg_ClosePersistent( |
| 140 GURL(origin.string()), |
| 141 base::UTF16ToUTF8(persistent_notification_id))); |
| 142 } |
| 143 |
| 144 void NotificationManager::closePersistent( |
137 const blink::WebString& persistent_notification_id) { | 145 const blink::WebString& persistent_notification_id) { |
138 thread_safe_sender_->Send(new PlatformNotificationHostMsg_ClosePersistent( | 146 closePersistent(blink::WebSerializedOrigin(), persistent_notification_id); |
139 base::UTF16ToUTF8(persistent_notification_id))); | |
140 } | 147 } |
141 | 148 |
142 void NotificationManager::notifyDelegateDestroyed( | 149 void NotificationManager::notifyDelegateDestroyed( |
143 blink::WebNotificationDelegate* delegate) { | 150 blink::WebNotificationDelegate* delegate) { |
144 if (pending_notifications_.CancelPageNotificationFetches(delegate)) | 151 if (pending_notifications_.CancelPageNotificationFetches(delegate)) |
145 return; | 152 return; |
146 | 153 |
147 for (auto& iter : active_page_notifications_) { | 154 for (auto& iter : active_page_notifications_) { |
148 if (iter.second != delegate) | 155 if (iter.second != delegate) |
149 continue; | 156 continue; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 GURL(origin.string()), | 236 GURL(origin.string()), |
230 icon, | 237 icon, |
231 ToPlatformNotificationData(notification_data))); | 238 ToPlatformNotificationData(notification_data))); |
232 | 239 |
233 // There currently isn't a case in which the promise would be rejected per | 240 // There currently isn't a case in which the promise would be rejected per |
234 // our implementation, so always resolve it here. | 241 // our implementation, so always resolve it here. |
235 callbacks->onSuccess(); | 242 callbacks->onSuccess(); |
236 } | 243 } |
237 | 244 |
238 } // namespace content | 245 } // namespace content |
OLD | NEW |