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

Unified Diff: content/child/notifications/notification_data_conversions.cc

Issue 794633002: Remove ShowDesktopNotificationHostMsgParams in favor of PlatformNotificationData. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: content/child/notifications/notification_data_conversions.cc
diff --git a/content/child/notifications/notification_data_conversions.cc b/content/child/notifications/notification_data_conversions.cc
new file mode 100644
index 0000000000000000000000000000000000000000..45f89cd861ef3fb26cfdd04af87f2e2df694b18b
--- /dev/null
+++ b/content/child/notifications/notification_data_conversions.cc
@@ -0,0 +1,48 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/child/notifications/notification_data_conversions.h"
+
+#include "base/strings/utf_string_conversions.h"
+#include "third_party/WebKit/public/platform/WebString.h"
+#include "third_party/WebKit/public/platform/WebURL.h"
+
+using blink::WebNotificationData;
+
+namespace content {
+
+PlatformNotificationData ToPlatformNotificationData(
+ const WebNotificationData& web_data) {
+ PlatformNotificationData platform_data;
+ platform_data.title = web_data.title;
+ platform_data.direction =
+ web_data.direction == WebNotificationData::DirectionLeftToRight
+ ? PlatformNotificationData::NotificationDirectionLeftToRight
+ : PlatformNotificationData::NotificationDirectionRightToLeft;
+ platform_data.lang = base::UTF16ToUTF8(web_data.lang);
+ platform_data.body = web_data.body;
+ platform_data.tag = web_data.tag;
+ platform_data.icon = GURL(web_data.icon.string());
+
+ return platform_data;
+}
+
+WebNotificationData ToWebNotificationData(
+ const PlatformNotificationData& platform_data) {
+ WebNotificationData web_data;
+ web_data.title = platform_data.title;
+ web_data.direction =
+ platform_data.direction ==
+ PlatformNotificationData::NotificationDirectionLeftToRight
+ ? WebNotificationData::DirectionLeftToRight
+ : WebNotificationData::DirectionRightToLeft;
+ web_data.lang = blink::WebString::fromUTF8(platform_data.lang);
+ web_data.body = platform_data.body;
+ web_data.tag = platform_data.tag;
+ web_data.icon = blink::WebURL(platform_data.icon);
+
+ return web_data;
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698