Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: content/child/notifications/notification_manager.cc

Issue 2151993002: [WebAPKs] Plumb service worker scope to notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into notification_scope Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698