OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/browser/notifications/type_converters.h" | 5 #include "content/browser/notifications/type_converters.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 | 9 |
10 using blink::mojom::NotificationDirection; | 10 using blink::mojom::NotificationDirection; |
(...skipping 18 matching lines...) Expand all Loading... |
29 PlatformNotificationData::DIRECTION_RIGHT_TO_LEFT; | 29 PlatformNotificationData::DIRECTION_RIGHT_TO_LEFT; |
30 break; | 30 break; |
31 case NotificationDirection::AUTO: | 31 case NotificationDirection::AUTO: |
32 notification_data.direction = PlatformNotificationData::DIRECTION_AUTO; | 32 notification_data.direction = PlatformNotificationData::DIRECTION_AUTO; |
33 break; | 33 break; |
34 } | 34 } |
35 | 35 |
36 notification_data.lang = notification->lang; | 36 notification_data.lang = notification->lang; |
37 notification_data.body = base::UTF8ToUTF16(notification->body.get()); | 37 notification_data.body = base::UTF8ToUTF16(notification->body.get()); |
38 notification_data.tag = notification->tag; | 38 notification_data.tag = notification->tag; |
| 39 notification_data.image = GURL(notification->image.get()); |
39 notification_data.icon = GURL(notification->icon.get()); | 40 notification_data.icon = GURL(notification->icon.get()); |
40 notification_data.badge = GURL(notification->badge.get()); | 41 notification_data.badge = GURL(notification->badge.get()); |
41 | 42 |
42 for (uint32_t vibration : notification->vibration_pattern) | 43 for (uint32_t vibration : notification->vibration_pattern) |
43 notification_data.vibration_pattern.push_back(static_cast<int>(vibration)); | 44 notification_data.vibration_pattern.push_back(static_cast<int>(vibration)); |
44 | 45 |
45 notification_data.timestamp = base::Time::FromJsTime(notification->timestamp); | 46 notification_data.timestamp = base::Time::FromJsTime(notification->timestamp); |
46 notification_data.renotify = notification->renotify; | 47 notification_data.renotify = notification->renotify; |
47 notification_data.silent = notification->silent; | 48 notification_data.silent = notification->silent; |
48 notification_data.require_interaction = notification->require_interaction; | 49 notification_data.require_interaction = notification->require_interaction; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 notification->direction = NotificationDirection::RIGHT_TO_LEFT; | 92 notification->direction = NotificationDirection::RIGHT_TO_LEFT; |
92 break; | 93 break; |
93 case PlatformNotificationData::DIRECTION_AUTO: | 94 case PlatformNotificationData::DIRECTION_AUTO: |
94 notification->direction = NotificationDirection::AUTO; | 95 notification->direction = NotificationDirection::AUTO; |
95 break; | 96 break; |
96 } | 97 } |
97 | 98 |
98 notification->lang = notification_data.lang; | 99 notification->lang = notification_data.lang; |
99 notification->body = base::UTF16ToUTF8(notification_data.body); | 100 notification->body = base::UTF16ToUTF8(notification_data.body); |
100 notification->tag = notification_data.tag; | 101 notification->tag = notification_data.tag; |
| 102 notification->image = notification_data.image.spec(); |
101 notification->icon = notification_data.icon.spec(); | 103 notification->icon = notification_data.icon.spec(); |
102 notification->badge = notification_data.badge.spec(); | 104 notification->badge = notification_data.badge.spec(); |
103 | 105 |
104 for (int vibration : notification_data.vibration_pattern) | 106 for (int vibration : notification_data.vibration_pattern) |
105 notification->vibration_pattern.push_back(static_cast<uint32_t>(vibration)); | 107 notification->vibration_pattern.push_back(static_cast<uint32_t>(vibration)); |
106 | 108 |
107 notification->timestamp = notification_data.timestamp.ToJsTime(); | 109 notification->timestamp = notification_data.timestamp.ToJsTime(); |
108 notification->renotify = notification_data.renotify; | 110 notification->renotify = notification_data.renotify; |
109 notification->silent = notification_data.silent; | 111 notification->silent = notification_data.silent; |
110 notification->require_interaction = notification_data.require_interaction; | 112 notification->require_interaction = notification_data.require_interaction; |
(...skipping 19 matching lines...) Expand all Loading... |
130 if (!data_action.placeholder.is_null()) | 132 if (!data_action.placeholder.is_null()) |
131 action->placeholder = base::UTF16ToUTF8(data_action.placeholder.string()); | 133 action->placeholder = base::UTF16ToUTF8(data_action.placeholder.string()); |
132 | 134 |
133 notification->actions.push_back(std::move(action)); | 135 notification->actions.push_back(std::move(action)); |
134 } | 136 } |
135 | 137 |
136 return notification; | 138 return notification; |
137 } | 139 } |
138 | 140 |
139 } // namespace mojo | 141 } // namespace mojo |
OLD | NEW |