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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 int CurrentWorkerId() { | 30 int CurrentWorkerId() { |
31 return WorkerThread::GetCurrentId(); | 31 return WorkerThread::GetCurrentId(); |
32 } | 32 } |
33 | 33 |
34 // Checks whether |notification_data| specifies any non-empty resources that | 34 // Checks whether |notification_data| specifies any non-empty resources that |
35 // need to be fetched. | 35 // need to be fetched. |
36 bool HasResourcesToFetch(const blink::WebNotificationData& notification_data) { | 36 bool HasResourcesToFetch(const blink::WebNotificationData& notification_data) { |
37 if (!notification_data.icon.isEmpty()) | 37 if (!notification_data.icon.isEmpty()) |
38 return true; | 38 return true; |
| 39 if (!notification_data.badge.isEmpty()) |
| 40 return true; |
39 for (const auto& action : notification_data.actions) { | 41 for (const auto& action : notification_data.actions) { |
40 if (!action.icon.isEmpty()) | 42 if (!action.icon.isEmpty()) |
41 return true; | 43 return true; |
42 } | 44 } |
43 return false; | 45 return false; |
44 } | 46 } |
45 | 47 |
46 } // namespace | 48 } // namespace |
47 | 49 |
48 static base::LazyInstance<base::ThreadLocalPointer<NotificationManager>>::Leaky | 50 static base::LazyInstance<base::ThreadLocalPointer<NotificationManager>>::Leaky |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 // TODO(mkwst): This is potentially doing the wrong thing with unique | 366 // TODO(mkwst): This is potentially doing the wrong thing with unique |
365 // origins. Perhaps also 'file:', 'blob:' and 'filesystem:'. See | 367 // origins. Perhaps also 'file:', 'blob:' and 'filesystem:'. See |
366 // https://crbug.com/490074 for detail. | 368 // https://crbug.com/490074 for detail. |
367 thread_safe_sender_->Send(new PlatformNotificationHostMsg_ShowPersistent( | 369 thread_safe_sender_->Send(new PlatformNotificationHostMsg_ShowPersistent( |
368 request_id, service_worker_registration_id, | 370 request_id, service_worker_registration_id, |
369 blink::WebStringToGURL(origin.toString()), | 371 blink::WebStringToGURL(origin.toString()), |
370 ToPlatformNotificationData(notification_data), notification_resources)); | 372 ToPlatformNotificationData(notification_data), notification_resources)); |
371 } | 373 } |
372 | 374 |
373 } // namespace content | 375 } // namespace content |
OLD | NEW |