| 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 #ifndef SKY_VIEWER_CONVERTERS_BASIC_TYPES_H_ | |
| 6 #define SKY_VIEWER_CONVERTERS_BASIC_TYPES_H_ | |
| 7 | |
| 8 #include "mojo/public/cpp/bindings/array.h" | |
| 9 #include "mojo/public/cpp/bindings/type_converter.h" | |
| 10 #include "sky/engine/public/platform/WebVector.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 class WebString; | |
| 14 } | |
| 15 | |
| 16 namespace mojo { | |
| 17 class String; | |
| 18 | |
| 19 template<> | |
| 20 struct TypeConverter<String, blink::WebString> { | |
| 21 static String Convert(const blink::WebString& str); | |
| 22 }; | |
| 23 template<> | |
| 24 struct TypeConverter<blink::WebString, String> { | |
| 25 static blink::WebString Convert(const String& str); | |
| 26 }; | |
| 27 | |
| 28 template<typename T, typename U> | |
| 29 struct TypeConverter<Array<T>, blink::WebVector<U> > { | |
| 30 static Array<T> Convert(const blink::WebVector<U>& vector) { | |
| 31 Array<T> array(vector.size()); | |
| 32 for (size_t i = 0; i < vector.size(); ++i) | |
| 33 array[i] = TypeConverter<T, U>::Convert(vector[i]); | |
| 34 return array.Pass(); | |
| 35 } | |
| 36 }; | |
| 37 | |
| 38 } // namespace mojo | |
| 39 | |
| 40 #endif // SKY_VIEWER_CONVERTERS_BASIC_TYPES_H_ | |
| OLD | NEW |