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

Side by Side Diff: content/browser/notifications/type_converters.cc

Issue 1904163002: Move Web Notifications to use Mojo Base URL: https://chromium.googlesource.com/chromium/src.git@skbitmap-blink
Patch Set: it works \o/ Created 4 years, 7 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 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 #include "skia/public/type_converters.h"
9 10
10 using blink::mojom::NotificationDirection; 11 using blink::mojom::NotificationDirection;
12 using blink::mojom::NotificationResourcesPtr;
13 using content::NotificationResources;
11 using content::PlatformNotificationData; 14 using content::PlatformNotificationData;
12 15
13 namespace mojo { 16 namespace mojo {
14 17
15 PlatformNotificationData 18 PlatformNotificationData
16 TypeConverter<PlatformNotificationData, blink::mojom::NotificationPtr>::Convert( 19 TypeConverter<PlatformNotificationData, blink::mojom::NotificationPtr>::Convert(
17 const blink::mojom::NotificationPtr& notification) { 20 const blink::mojom::NotificationPtr& notification) {
18 PlatformNotificationData notification_data; 21 PlatformNotificationData notification_data;
19 22
20 notification_data.title = base::UTF8ToUTF16(notification->title.get()); 23 notification_data.title = base::UTF8ToUTF16(notification->title.get());
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 action->icon = data_action.icon.spec(); 132 action->icon = data_action.icon.spec();
130 if (!data_action.placeholder.is_null()) 133 if (!data_action.placeholder.is_null())
131 action->placeholder = base::UTF16ToUTF8(data_action.placeholder.string()); 134 action->placeholder = base::UTF16ToUTF8(data_action.placeholder.string());
132 135
133 notification->actions.push_back(std::move(action)); 136 notification->actions.push_back(std::move(action));
134 } 137 }
135 138
136 return notification; 139 return notification;
137 } 140 }
138 141
142 NotificationResources
143 TypeConverter<NotificationResources, NotificationResourcesPtr>::Convert(
144 const NotificationResourcesPtr& notification_resources) {
145 NotificationResources resources;
146 resources.notification_icon = notification_resources->icon.To<SkBitmap>();
147 resources.badge = notification_resources->badge.To<SkBitmap>();
148
149 resources.action_icons.resize(notification_resources->action_icons.size());
150 for (size_t i = 0; i < notification_resources->action_icons.size(); ++i) {
151 resources.action_icons[i] =
152 notification_resources->action_icons[i].To<SkBitmap>();
153 }
154
155 return resources;
156 }
157
139 } // namespace mojo 158 } // namespace mojo
OLDNEW
« no previous file with comments | « content/browser/notifications/type_converters.h ('k') | content/browser/renderer_host/render_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698