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

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

Issue 1057573002: Implement the ability to get all notifications in Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-db-Integrate
Patch Set: Created 5 years, 8 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 "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 DCHECK(callbacks); 273 DCHECK(callbacks);
274 if (!callbacks) 274 if (!callbacks)
275 return; 275 return;
276 276
277 scoped_ptr<blink::WebVector<blink::WebPersistentNotificationInfo>> 277 scoped_ptr<blink::WebVector<blink::WebPersistentNotificationInfo>>
278 notifications(new blink::WebVector<blink::WebPersistentNotificationInfo>( 278 notifications(new blink::WebVector<blink::WebPersistentNotificationInfo>(
279 notification_infos.size())); 279 notification_infos.size()));
280 280
281 for (size_t i = 0; i < notification_infos.size(); ++i) { 281 for (size_t i = 0; i < notification_infos.size(); ++i) {
282 blink::WebPersistentNotificationInfo web_notification_info; 282 blink::WebPersistentNotificationInfo web_notification_info;
283
284 // TODO(peter): Stop converting the notification id to a string when the
285 // Blink API has been updated to support integral ids.
283 web_notification_info.persistentNotificationId = 286 web_notification_info.persistentNotificationId =
284 blink::WebString::fromUTF8(notification_infos[i].first); 287 base::Int64ToString16(notification_infos[i].first);
285 web_notification_info.data = 288 web_notification_info.data =
286 ToWebNotificationData(notification_infos[i].second); 289 ToWebNotificationData(notification_infos[i].second);
287 290
288 (*notifications)[i] = web_notification_info; 291 (*notifications)[i] = web_notification_info;
289 } 292 }
290 293
291 callbacks->onSuccess(notifications.release()); 294 callbacks->onSuccess(notifications.release());
292 295
293 pending_get_notification_requests_.Remove(request_id); 296 pending_get_notification_requests_.Remove(request_id);
294 } 297 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 thread_safe_sender_->Send( 330 thread_safe_sender_->Send(
328 new PlatformNotificationHostMsg_ShowPersistent( 331 new PlatformNotificationHostMsg_ShowPersistent(
329 request_id, 332 request_id,
330 service_worker_registration_id, 333 service_worker_registration_id,
331 GURL(origin.string()), 334 GURL(origin.string()),
332 icon, 335 icon,
333 ToPlatformNotificationData(notification_data))); 336 ToPlatformNotificationData(notification_data)));
334 } 337 }
335 338
336 } // namespace content 339 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698