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

Unified Diff: third_party/WebKit/Source/platform/payments/BlinkTypeConverters.cpp

Issue 1753543002: PaymentRequest Mojo bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@interface
Patch Set: Rename WebStuff into PlatformStuff Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/payments/BlinkTypeConverters.cpp
diff --git a/third_party/WebKit/Source/platform/payments/BlinkTypeConverters.cpp b/third_party/WebKit/Source/platform/payments/BlinkTypeConverters.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2e12edf8383511b56b009428a835f8bbbf39277f
--- /dev/null
+++ b/third_party/WebKit/Source/platform/payments/BlinkTypeConverters.cpp
@@ -0,0 +1,42 @@
+// Copyright 2016 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 "platform/payments/BlinkTypeConverters.h"
+
+#include "public/platform/WebString.h"
+
+namespace mojo {
+
+String TypeConverter<String, WTF::String>::Convert(const WTF::String& input)
+{
+ return String(blink::WebString(input).utf8());
+}
+
+WTF::String TypeConverter<WTF::String, String>::Convert(const String& input)
+{
+ return WTF::String(blink::WebString::fromUTF8(input.get()));
+}
+
+WTF::Vector<WTF::String> TypeConverter<WTF::Vector<WTF::String>, Array<String>>::Convert(
+ const Array<String>& input)
+{
+ WTF::Vector<WTF::String> output(input.size());
+
+ for (size_t i = 0; i < input.size(); ++i)
+ output[i] = input[i].To<WTF::String>();
+
+ return output;
+}
+
+Array<String> TypeConverter<Array<String>, WTF::Vector<WTF::String>>::Convert(const WTF::Vector<WTF::String>& input)
+{
+ Array<String> output(input.size());
+
+ for (size_t i = 0; i < input.size(); ++i)
+ output[i] = String::From(input[i]);
+
+ return output;
+}
+
+} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698