| 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 <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 int request_id = | 154 int request_id = |
| 155 notification_dispatcher_->GenerateNotificationId(CurrentWorkerId()); | 155 notification_dispatcher_->GenerateNotificationId(CurrentWorkerId()); |
| 156 | 156 |
| 157 pending_get_notification_requests_.AddWithID(callbacks, request_id); | 157 pending_get_notification_requests_.AddWithID(callbacks, request_id); |
| 158 | 158 |
| 159 thread_safe_sender_->Send( | 159 thread_safe_sender_->Send( |
| 160 new PlatformNotificationHostMsg_GetNotifications( | 160 new PlatformNotificationHostMsg_GetNotifications( |
| 161 request_id, | 161 request_id, |
| 162 service_worker_registration_id, | 162 service_worker_registration_id, |
| 163 origin, | 163 origin, |
| 164 base::UTF16ToUTF8(filter_tag))); | 164 base::UTF16ToUTF8(base::StringPiece16(filter_tag)))); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void NotificationManager::close(blink::WebNotificationDelegate* delegate) { | 167 void NotificationManager::close(blink::WebNotificationDelegate* delegate) { |
| 168 if (pending_notifications_.CancelPageNotificationFetches(delegate)) | 168 if (pending_notifications_.CancelPageNotificationFetches(delegate)) |
| 169 return; | 169 return; |
| 170 | 170 |
| 171 for (auto& iter : active_page_notifications_) { | 171 for (auto& iter : active_page_notifications_) { |
| 172 if (iter.second != delegate) | 172 if (iter.second != delegate) |
| 173 continue; | 173 continue; |
| 174 | 174 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 337 |
| 338 // TODO(mkwst): This is potentially doing the wrong thing with unique | 338 // TODO(mkwst): This is potentially doing the wrong thing with unique |
| 339 // origins. Perhaps also 'file:', 'blob:' and 'filesystem:'. See | 339 // origins. Perhaps also 'file:', 'blob:' and 'filesystem:'. See |
| 340 // https://crbug.com/490074 for detail. | 340 // https://crbug.com/490074 for detail. |
| 341 thread_safe_sender_->Send(new PlatformNotificationHostMsg_ShowPersistent( | 341 thread_safe_sender_->Send(new PlatformNotificationHostMsg_ShowPersistent( |
| 342 request_id, service_worker_registration_id, GURL(origin.toString()), icon, | 342 request_id, service_worker_registration_id, GURL(origin.toString()), icon, |
| 343 ToPlatformNotificationData(notification_data))); | 343 ToPlatformNotificationData(notification_data))); |
| 344 } | 344 } |
| 345 | 345 |
| 346 } // namespace content | 346 } // namespace content |
| OLD | NEW |