| 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 <utility> | 7 #include <utility> |
| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // renaming the method in the NotificationDispatcher if this makes sense. | 131 // renaming the method in the NotificationDispatcher if this makes sense. |
| 132 int request_id = | 132 int request_id = |
| 133 notification_dispatcher_->GenerateNotificationId(CurrentWorkerId()); | 133 notification_dispatcher_->GenerateNotificationId(CurrentWorkerId()); |
| 134 | 134 |
| 135 pending_show_notification_requests_.AddWithID(owned_callbacks.release(), | 135 pending_show_notification_requests_.AddWithID(owned_callbacks.release(), |
| 136 request_id); | 136 request_id); |
| 137 | 137 |
| 138 // TODO(mkwst): This is potentially doing the wrong thing with unique | 138 // TODO(mkwst): This is potentially doing the wrong thing with unique |
| 139 // origins. Perhaps also 'file:', 'blob:' and 'filesystem:'. See | 139 // origins. Perhaps also 'file:', 'blob:' and 'filesystem:'. See |
| 140 // https://crbug.com/490074 for detail. | 140 // https://crbug.com/490074 for detail. |
| 141 thread_safe_sender_->Send(new PlatformNotificationHostMsg_ShowPersistent( | 141 PlatformNotificationHostMsg_ShowPersistent_Params params; |
| 142 request_id, service_worker_registration_id, | 142 params.request_id = request_id; |
| 143 blink::WebStringToGURL(origin.toString()), | 143 params.service_worker_registration_id = service_worker_registration_id; |
| 144 ToPlatformNotificationData(notification_data), | 144 params.service_worker_scope = service_worker_registration->scope(); |
| 145 ToNotificationResources(std::move(notification_resources)))); | 145 params.origin = blink::WebStringToGURL(origin.toString()); |
| 146 params.notification_data = ToPlatformNotificationData(notification_data); |
| 147 params.notification_resources = |
| 148 ToNotificationResources(std::move(notification_resources)); |
| 149 thread_safe_sender_->Send( |
| 150 new PlatformNotificationHostMsg_ShowPersistent(params)); |
| 146 } | 151 } |
| 147 | 152 |
| 148 void NotificationManager::getNotifications( | 153 void NotificationManager::getNotifications( |
| 149 const blink::WebString& filter_tag, | 154 const blink::WebString& filter_tag, |
| 150 blink::WebServiceWorkerRegistration* service_worker_registration, | 155 blink::WebServiceWorkerRegistration* service_worker_registration, |
| 151 blink::WebNotificationGetCallbacks* callbacks) { | 156 blink::WebNotificationGetCallbacks* callbacks) { |
| 152 DCHECK(service_worker_registration); | 157 DCHECK(service_worker_registration); |
| 153 DCHECK(callbacks); | 158 DCHECK(callbacks); |
| 154 | 159 |
| 155 WebServiceWorkerRegistrationImpl* service_worker_registration_impl = | 160 WebServiceWorkerRegistrationImpl* service_worker_registration_impl = |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 291 |
| 287 notifications[i] = web_notification_info; | 292 notifications[i] = web_notification_info; |
| 288 } | 293 } |
| 289 | 294 |
| 290 callbacks->onSuccess(notifications); | 295 callbacks->onSuccess(notifications); |
| 291 | 296 |
| 292 pending_get_notification_requests_.Remove(request_id); | 297 pending_get_notification_requests_.Remove(request_id); |
| 293 } | 298 } |
| 294 | 299 |
| 295 } // namespace content | 300 } // namespace content |
| OLD | NEW |