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> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 const OncValueSignature& array_signature, | 113 const OncValueSignature& array_signature, |
114 const base::ListValue& onc_array, | 114 const base::ListValue& onc_array, |
115 bool* nested_error) { | 115 bool* nested_error) { |
116 DCHECK(array_signature.onc_array_entry_signature != NULL) | 116 DCHECK(array_signature.onc_array_entry_signature != NULL) |
117 << "Found missing onc_array_entry_signature."; | 117 << "Found missing onc_array_entry_signature."; |
118 | 118 |
119 std::unique_ptr<base::ListValue> result_array(new base::ListValue); | 119 std::unique_ptr<base::ListValue> result_array(new base::ListValue); |
120 int original_index = 0; | 120 int original_index = 0; |
121 for (const auto& entry : onc_array) { | 121 for (const auto& entry : onc_array) { |
122 std::unique_ptr<base::Value> result_entry; | 122 std::unique_ptr<base::Value> result_entry; |
123 result_entry = MapEntry(original_index, | 123 result_entry = |
124 *array_signature.onc_array_entry_signature, | 124 MapEntry(original_index, *array_signature.onc_array_entry_signature, |
125 *entry, | 125 entry, nested_error); |
126 nested_error); | |
127 if (result_entry.get() != NULL) | 126 if (result_entry.get() != NULL) |
128 result_array->Append(std::move(result_entry)); | 127 result_array->Append(std::move(result_entry)); |
129 else | 128 else |
130 DCHECK(*nested_error); | 129 DCHECK(*nested_error); |
131 ++original_index; | 130 ++original_index; |
132 } | 131 } |
133 return result_array; | 132 return result_array; |
134 } | 133 } |
135 | 134 |
136 std::unique_ptr<base::Value> Mapper::MapEntry( | 135 std::unique_ptr<base::Value> Mapper::MapEntry( |
137 int index, | 136 int index, |
138 const OncValueSignature& signature, | 137 const OncValueSignature& signature, |
139 const base::Value& onc_value, | 138 const base::Value& onc_value, |
140 bool* error) { | 139 bool* error) { |
141 return MapValue(signature, onc_value, error); | 140 return MapValue(signature, onc_value, error); |
142 } | 141 } |
143 | 142 |
144 } // namespace onc | 143 } // namespace onc |
145 } // namespace chromeos | 144 } // namespace chromeos |
OLD | NEW |