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/lib/clone_equals_util.h" |
11 #include "mojo/public/cpp/bindings/map_traits.h" | 12 #include "mojo/public/cpp/bindings/map_traits.h" |
12 #include "mojo/public/cpp/bindings/struct_traits.h" | 13 #include "mojo/public/cpp/bindings/struct_traits.h" |
13 #include "mojo/public/cpp/bindings/union_traits.h" | 14 #include "mojo/public/cpp/bindings/union_traits.h" |
14 | 15 |
15 namespace mojo { | 16 namespace mojo { |
16 | 17 |
| 18 namespace internal { |
| 19 |
| 20 template <> |
| 21 struct CloneTraits<std::unique_ptr<base::DictionaryValue>, false> { |
| 22 static std::unique_ptr<base::DictionaryValue> Clone( |
| 23 const std::unique_ptr<base::DictionaryValue>& input); |
| 24 }; |
| 25 |
| 26 } // namespace internal |
| 27 |
17 template <> | 28 template <> |
18 struct ArrayTraits<base::ListValue> { | 29 struct ArrayTraits<base::ListValue> { |
19 using Element = std::unique_ptr<base::Value>; | 30 using Element = std::unique_ptr<base::Value>; |
20 using ConstIterator = base::ListValue::const_iterator; | 31 using ConstIterator = base::ListValue::const_iterator; |
21 | 32 |
22 static size_t GetSize(const base::ListValue& input) { | 33 static size_t GetSize(const base::ListValue& input) { |
23 return input.GetSize(); | 34 return input.GetSize(); |
24 } | 35 } |
25 | 36 |
26 static ConstIterator GetBegin(const base::ListValue& input) { | 37 static ConstIterator GetBegin(const base::ListValue& input) { |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 base::Value>::dictionary_value(*value); | 252 base::Value>::dictionary_value(*value); |
242 } | 253 } |
243 | 254 |
244 static bool Read(common::mojom::ValueDataView data, | 255 static bool Read(common::mojom::ValueDataView data, |
245 std::unique_ptr<base::Value>* value); | 256 std::unique_ptr<base::Value>* value); |
246 }; | 257 }; |
247 | 258 |
248 } // namespace mojo | 259 } // namespace mojo |
249 | 260 |
250 #endif // MOJO_COMMON_VALUES_STRUCT_TRAITS_H_ | 261 #endif // MOJO_COMMON_VALUES_STRUCT_TRAITS_H_ |
OLD | NEW |