| 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 12 matching lines...) Expand all Loading... |
| 23 namespace content { | 23 namespace content { |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 int CurrentWorkerId() { | 26 int CurrentWorkerId() { |
| 27 return WorkerThread::GetCurrentId(); | 27 return WorkerThread::GetCurrentId(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 NotificationResources ToNotificationResources( | 30 NotificationResources ToNotificationResources( |
| 31 std::unique_ptr<blink::WebNotificationResources> web_resources) { | 31 std::unique_ptr<blink::WebNotificationResources> web_resources) { |
| 32 NotificationResources resources; | 32 NotificationResources resources; |
| 33 resources.image = web_resources->image; |
| 33 resources.notification_icon = web_resources->icon; | 34 resources.notification_icon = web_resources->icon; |
| 34 resources.badge = web_resources->badge; | 35 resources.badge = web_resources->badge; |
| 35 for (const auto& action_icon : web_resources->actionIcons) | 36 for (const auto& action_icon : web_resources->actionIcons) |
| 36 resources.action_icons.push_back(action_icon); | 37 resources.action_icons.push_back(action_icon); |
| 37 return resources; | 38 return resources; |
| 38 } | 39 } |
| 39 | 40 |
| 40 } // namespace | 41 } // namespace |
| 41 | 42 |
| 42 static base::LazyInstance<base::ThreadLocalPointer<NotificationManager>>::Leaky | 43 static base::LazyInstance<base::ThreadLocalPointer<NotificationManager>>::Leaky |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 287 |
| 287 notifications[i] = web_notification_info; | 288 notifications[i] = web_notification_info; |
| 288 } | 289 } |
| 289 | 290 |
| 290 callbacks->onSuccess(notifications); | 291 callbacks->onSuccess(notifications); |
| 291 | 292 |
| 292 pending_get_notification_requests_.Remove(request_id); | 293 pending_get_notification_requests_.Remove(request_id); |
| 293 } | 294 } |
| 294 | 295 |
| 295 } // namespace content | 296 } // namespace content |
| OLD | NEW |