OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chromeos/network/onc/onc_mapper.h" | 5 #include "chromeos/network/onc/onc_mapper.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
9 #include "base/values.h" | 11 #include "base/values.h" |
10 #include "chromeos/network/onc/onc_signature.h" | 12 #include "chromeos/network/onc/onc_signature.h" |
11 | 13 |
12 namespace chromeos { | 14 namespace chromeos { |
13 namespace onc { | 15 namespace onc { |
14 | 16 |
15 Mapper::Mapper() { | 17 Mapper::Mapper() { |
16 } | 18 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 118 |
117 std::unique_ptr<base::ListValue> result_array(new base::ListValue); | 119 std::unique_ptr<base::ListValue> result_array(new base::ListValue); |
118 int original_index = 0; | 120 int original_index = 0; |
119 for (const auto& entry : onc_array) { | 121 for (const auto& entry : onc_array) { |
120 std::unique_ptr<base::Value> result_entry; | 122 std::unique_ptr<base::Value> result_entry; |
121 result_entry = MapEntry(original_index, | 123 result_entry = MapEntry(original_index, |
122 *array_signature.onc_array_entry_signature, | 124 *array_signature.onc_array_entry_signature, |
123 *entry, | 125 *entry, |
124 nested_error); | 126 nested_error); |
125 if (result_entry.get() != NULL) | 127 if (result_entry.get() != NULL) |
126 result_array->Append(result_entry.release()); | 128 result_array->Append(std::move(result_entry)); |
127 else | 129 else |
128 DCHECK(*nested_error); | 130 DCHECK(*nested_error); |
129 ++original_index; | 131 ++original_index; |
130 } | 132 } |
131 return result_array; | 133 return result_array; |
132 } | 134 } |
133 | 135 |
134 std::unique_ptr<base::Value> Mapper::MapEntry( | 136 std::unique_ptr<base::Value> Mapper::MapEntry( |
135 int index, | 137 int index, |
136 const OncValueSignature& signature, | 138 const OncValueSignature& signature, |
137 const base::Value& onc_value, | 139 const base::Value& onc_value, |
138 bool* error) { | 140 bool* error) { |
139 return MapValue(signature, onc_value, error); | 141 return MapValue(signature, onc_value, error); |
140 } | 142 } |
141 | 143 |
142 } // namespace onc | 144 } // namespace onc |
143 } // namespace chromeos | 145 } // namespace chromeos |
OLD | NEW |