OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/child/notifications/notification_data_conversions.h" |
| 6 |
| 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "third_party/WebKit/public/platform/WebString.h" |
| 9 #include "third_party/WebKit/public/platform/WebURL.h" |
| 10 |
| 11 using blink::WebNotificationData; |
| 12 |
| 13 namespace content { |
| 14 |
| 15 PlatformNotificationData ToPlatformNotificationData( |
| 16 const WebNotificationData& web_data) { |
| 17 PlatformNotificationData platform_data; |
| 18 platform_data.title = web_data.title; |
| 19 platform_data.direction = |
| 20 web_data.direction == WebNotificationData::DirectionLeftToRight |
| 21 ? PlatformNotificationData::NotificationDirectionLeftToRight |
| 22 : PlatformNotificationData::NotificationDirectionRightToLeft; |
| 23 platform_data.lang = base::UTF16ToUTF8(web_data.lang); |
| 24 platform_data.body = web_data.body; |
| 25 platform_data.tag = web_data.tag; |
| 26 platform_data.icon = GURL(web_data.icon.string()); |
| 27 |
| 28 return platform_data; |
| 29 } |
| 30 |
| 31 WebNotificationData ToWebNotificationData( |
| 32 const PlatformNotificationData& platform_data) { |
| 33 WebNotificationData web_data; |
| 34 web_data.title = platform_data.title; |
| 35 web_data.direction = |
| 36 platform_data.direction == |
| 37 PlatformNotificationData::NotificationDirectionLeftToRight |
| 38 ? WebNotificationData::DirectionLeftToRight |
| 39 : WebNotificationData::DirectionRightToLeft; |
| 40 web_data.lang = blink::WebString::fromUTF8(platform_data.lang); |
| 41 web_data.body = platform_data.body; |
| 42 web_data.tag = platform_data.tag; |
| 43 web_data.icon = blink::WebURL(platform_data.icon); |
| 44 |
| 45 return web_data; |
| 46 } |
| 47 |
| 48 } // namespace content |
OLD | NEW |