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 |