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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 for (base::DictionaryValue::Iterator it(onc_object); !it.IsAtEnd(); | 75 for (base::DictionaryValue::Iterator it(onc_object); !it.IsAtEnd(); |
76 it.Advance()) { | 76 it.Advance()) { |
77 bool current_field_unknown = false; | 77 bool current_field_unknown = false; |
78 std::unique_ptr<base::Value> result_value = | 78 std::unique_ptr<base::Value> result_value = |
79 MapField(it.key(), object_signature, it.value(), ¤t_field_unknown, | 79 MapField(it.key(), object_signature, it.value(), ¤t_field_unknown, |
80 nested_error); | 80 nested_error); |
81 | 81 |
82 if (current_field_unknown) | 82 if (current_field_unknown) |
83 *found_unknown_field = true; | 83 *found_unknown_field = true; |
84 else if (result_value.get() != NULL) | 84 else if (result_value.get() != NULL) |
85 result->SetWithoutPathExpansion(it.key(), result_value.release()); | 85 result->SetWithoutPathExpansion(it.key(), std::move(result_value)); |
86 else | 86 else |
87 DCHECK(*nested_error); | 87 DCHECK(*nested_error); |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
91 std::unique_ptr<base::Value> Mapper::MapField( | 91 std::unique_ptr<base::Value> Mapper::MapField( |
92 const std::string& field_name, | 92 const std::string& field_name, |
93 const OncValueSignature& object_signature, | 93 const OncValueSignature& object_signature, |
94 const base::Value& onc_value, | 94 const base::Value& onc_value, |
95 bool* found_unknown_field, | 95 bool* found_unknown_field, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 std::unique_ptr<base::Value> Mapper::MapEntry( | 135 std::unique_ptr<base::Value> Mapper::MapEntry( |
136 int index, | 136 int index, |
137 const OncValueSignature& signature, | 137 const OncValueSignature& signature, |
138 const base::Value& onc_value, | 138 const base::Value& onc_value, |
139 bool* error) { | 139 bool* error) { |
140 return MapValue(signature, onc_value, error); | 140 return MapValue(signature, onc_value, error); |
141 } | 141 } |
142 | 142 |
143 } // namespace onc | 143 } // namespace onc |
144 } // namespace chromeos | 144 } // namespace chromeos |
OLD | NEW |