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 #include "base/memory/ptr_util.h" | 5 #include "base/memory/ptr_util.h" |
6 #include "mojo/common/values_struct_traits.h" | 6 #include "mojo/common/values_struct_traits.h" |
7 | 7 |
8 namespace mojo { | 8 namespace mojo { |
9 | 9 |
10 bool StructTraits<common::mojom::ListValueDataView, | 10 bool StructTraits<common::mojom::ListValueDataView, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 auto result = base::MakeUnique<base::DictionaryValue>(); | 51 auto result = base::MakeUnique<base::DictionaryValue>(); |
52 result->MergeDictionary(input.get()); | 52 result->MergeDictionary(input.get()); |
53 return result; | 53 return result; |
54 } | 54 } |
55 | 55 |
56 bool UnionTraits<common::mojom::ValueDataView, std::unique_ptr<base::Value>>:: | 56 bool UnionTraits<common::mojom::ValueDataView, std::unique_ptr<base::Value>>:: |
57 Read(common::mojom::ValueDataView data, | 57 Read(common::mojom::ValueDataView data, |
58 std::unique_ptr<base::Value>* value_out) { | 58 std::unique_ptr<base::Value>* value_out) { |
59 switch (data.tag()) { | 59 switch (data.tag()) { |
60 case common::mojom::ValueDataView::Tag::NULL_VALUE: { | 60 case common::mojom::ValueDataView::Tag::NULL_VALUE: { |
61 *value_out = base::Value::CreateNullValue(); | 61 *value_out = base::MakeUnique<base::Value>(); |
62 return true; | 62 return true; |
63 } | 63 } |
64 case common::mojom::ValueDataView::Tag::BOOL_VALUE: { | 64 case common::mojom::ValueDataView::Tag::BOOL_VALUE: { |
65 *value_out = base::MakeUnique<base::Value>(data.bool_value()); | 65 *value_out = base::MakeUnique<base::Value>(data.bool_value()); |
66 return true; | 66 return true; |
67 } | 67 } |
68 case common::mojom::ValueDataView::Tag::INT_VALUE: { | 68 case common::mojom::ValueDataView::Tag::INT_VALUE: { |
69 *value_out = base::MakeUnique<base::Value>(data.int_value()); | 69 *value_out = base::MakeUnique<base::Value>(data.int_value()); |
70 return true; | 70 return true; |
71 } | 71 } |
(...skipping 28 matching lines...) Expand all Loading... |
100 if (!data.ReadListValue(&list_value)) | 100 if (!data.ReadListValue(&list_value)) |
101 return false; | 101 return false; |
102 *value_out = std::move(list_value); | 102 *value_out = std::move(list_value); |
103 return true; | 103 return true; |
104 } | 104 } |
105 } | 105 } |
106 return false; | 106 return false; |
107 } | 107 } |
108 | 108 |
109 } // namespace mojo | 109 } // namespace mojo |
OLD | NEW |