OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MOJO_COMMON_VALUES_STRUCT_TRAITS_H_ | 5 #ifndef MOJO_COMMON_VALUES_STRUCT_TRAITS_H_ |
6 #define MOJO_COMMON_VALUES_STRUCT_TRAITS_H_ | 6 #define MOJO_COMMON_VALUES_STRUCT_TRAITS_H_ |
7 | 7 |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "mojo/common/values.mojom.h" | 9 #include "mojo/common/values.mojom.h" |
10 #include "mojo/public/cpp/bindings/array_traits.h" | 10 #include "mojo/public/cpp/bindings/array_traits.h" |
11 #include "mojo/public/cpp/bindings/clone_traits.h" | 11 #include "mojo/public/cpp/bindings/clone_traits.h" |
12 #include "mojo/public/cpp/bindings/map_traits.h" | 12 #include "mojo/public/cpp/bindings/map_traits.h" |
13 #include "mojo/public/cpp/bindings/struct_traits.h" | 13 #include "mojo/public/cpp/bindings/struct_traits.h" |
14 #include "mojo/public/cpp/bindings/union_traits.h" | 14 #include "mojo/public/cpp/bindings/union_traits.h" |
15 | 15 |
16 namespace mojo { | 16 namespace mojo { |
17 | 17 |
18 template <> | 18 template <> |
19 struct ArrayTraits<base::ListValue> { | 19 struct ArrayTraits<base::ListValue> { |
20 using Element = base::Value; | 20 using Element = std::unique_ptr<base::Value>; |
21 using ConstIterator = base::ListValue::const_iterator; | 21 using ConstIterator = base::ListValue::const_iterator; |
22 | 22 |
23 static size_t GetSize(const base::ListValue& input) { | 23 static size_t GetSize(const base::ListValue& input) { |
24 return input.GetSize(); | 24 return input.GetSize(); |
25 } | 25 } |
26 | 26 |
27 static ConstIterator GetBegin(const base::ListValue& input) { | 27 static ConstIterator GetBegin(const base::ListValue& input) { |
28 return input.begin(); | 28 return input.begin(); |
29 } | 29 } |
30 | 30 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 base::Value>::dictionary_value(*value); | 248 base::Value>::dictionary_value(*value); |
249 } | 249 } |
250 | 250 |
251 static bool Read(common::mojom::ValueDataView data, | 251 static bool Read(common::mojom::ValueDataView data, |
252 std::unique_ptr<base::Value>* value); | 252 std::unique_ptr<base::Value>* value); |
253 }; | 253 }; |
254 | 254 |
255 } // namespace mojo | 255 } // namespace mojo |
256 | 256 |
257 #endif // MOJO_COMMON_VALUES_STRUCT_TRAITS_H_ | 257 #endif // MOJO_COMMON_VALUES_STRUCT_TRAITS_H_ |
OLD | NEW |