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

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

Issue 1235083006: CallbackPromiseAdapter types should be more compatible with WebCallbacks (2/3). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web-callbacks-3
Patch Set: Created 5 years, 4 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 <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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 284
285 void NotificationManager::OnDidGetNotifications( 285 void NotificationManager::OnDidGetNotifications(
286 int request_id, 286 int request_id,
287 const std::vector<PersistentNotificationInfo>& notification_infos) { 287 const std::vector<PersistentNotificationInfo>& notification_infos) {
288 blink::WebNotificationGetCallbacks* callbacks = 288 blink::WebNotificationGetCallbacks* callbacks =
289 pending_get_notification_requests_.Lookup(request_id); 289 pending_get_notification_requests_.Lookup(request_id);
290 DCHECK(callbacks); 290 DCHECK(callbacks);
291 if (!callbacks) 291 if (!callbacks)
292 return; 292 return;
293 293
294 scoped_ptr<blink::WebVector<blink::WebPersistentNotificationInfo>> 294 blink::WebVector<blink::WebPersistentNotificationInfo> notifications(
295 notifications(new blink::WebVector<blink::WebPersistentNotificationInfo>( 295 notification_infos.size());
296 notification_infos.size()));
297 296
298 for (size_t i = 0; i < notification_infos.size(); ++i) { 297 for (size_t i = 0; i < notification_infos.size(); ++i) {
299 blink::WebPersistentNotificationInfo web_notification_info; 298 blink::WebPersistentNotificationInfo web_notification_info;
300 web_notification_info.persistentId = notification_infos[i].first; 299 web_notification_info.persistentId = notification_infos[i].first;
301 web_notification_info.data = 300 web_notification_info.data =
302 ToWebNotificationData(notification_infos[i].second); 301 ToWebNotificationData(notification_infos[i].second);
303 302
304 (*notifications)[i] = web_notification_info; 303 notifications[i] = web_notification_info;
305 } 304 }
306 305
307 callbacks->onSuccess(notifications.release()); 306 callbacks->onSuccess(notifications);
308 307
309 pending_get_notification_requests_.Remove(request_id); 308 pending_get_notification_requests_.Remove(request_id);
310 } 309 }
311 310
312 void NotificationManager::DisplayPageNotification( 311 void NotificationManager::DisplayPageNotification(
313 const blink::WebSecurityOrigin& origin, 312 const blink::WebSecurityOrigin& origin,
314 const blink::WebNotificationData& notification_data, 313 const blink::WebNotificationData& notification_data,
315 blink::WebNotificationDelegate* delegate, 314 blink::WebNotificationDelegate* delegate,
316 const SkBitmap& icon) { 315 const SkBitmap& icon) {
317 int notification_id = 316 int notification_id =
(...skipping 24 matching lines...) Expand all
342 341
343 // TODO(mkwst): This is potentially doing the wrong thing with unique 342 // TODO(mkwst): This is potentially doing the wrong thing with unique
344 // origins. Perhaps also 'file:', 'blob:' and 'filesystem:'. See 343 // origins. Perhaps also 'file:', 'blob:' and 'filesystem:'. See
345 // https://crbug.com/490074 for detail. 344 // https://crbug.com/490074 for detail.
346 thread_safe_sender_->Send(new PlatformNotificationHostMsg_ShowPersistent( 345 thread_safe_sender_->Send(new PlatformNotificationHostMsg_ShowPersistent(
347 request_id, service_worker_registration_id, GURL(origin.toString()), icon, 346 request_id, service_worker_registration_id, GURL(origin.toString()), icon,
348 ToPlatformNotificationData(notification_data))); 347 ToPlatformNotificationData(notification_data)));
349 } 348 }
350 349
351 } // namespace content 350 } // namespace content
OLDNEW
« no previous file with comments | « content/child/geofencing/geofencing_dispatcher.cc ('k') | content/child/push_messaging/push_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698