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" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chromeos/network/onc/onc_signature.h" | 12 #include "chromeos/network/onc/onc_signature.h" |
13 | 13 |
14 namespace chromeos { | 14 namespace chromeos { |
15 namespace onc { | 15 namespace onc { |
16 | 16 |
17 Mapper::Mapper() { | 17 Mapper::Mapper() { |
18 } | 18 } |
19 | 19 |
20 Mapper::~Mapper() { | 20 Mapper::~Mapper() { |
21 } | 21 } |
22 | 22 |
23 std::unique_ptr<base::Value> Mapper::MapValue( | 23 std::unique_ptr<base::Value> Mapper::MapValue( |
24 const OncValueSignature& signature, | 24 const OncValueSignature& signature, |
25 const base::Value& onc_value, | 25 const base::Value& onc_value, |
26 bool* error) { | 26 bool* error) { |
27 std::unique_ptr<base::Value> result_value; | 27 std::unique_ptr<base::Value> result_value; |
28 switch (onc_value.GetType()) { | 28 switch (onc_value.GetType()) { |
29 case base::Value::TYPE_DICTIONARY: { | 29 case base::Value::Type::DICTIONARY: { |
30 const base::DictionaryValue* dict = NULL; | 30 const base::DictionaryValue* dict = NULL; |
31 onc_value.GetAsDictionary(&dict); | 31 onc_value.GetAsDictionary(&dict); |
32 result_value = MapObject(signature, *dict, error); | 32 result_value = MapObject(signature, *dict, error); |
33 break; | 33 break; |
34 } | 34 } |
35 case base::Value::TYPE_LIST: { | 35 case base::Value::Type::LIST: { |
36 const base::ListValue* list = NULL; | 36 const base::ListValue* list = NULL; |
37 onc_value.GetAsList(&list); | 37 onc_value.GetAsList(&list); |
38 result_value = MapArray(signature, *list, error); | 38 result_value = MapArray(signature, *list, error); |
39 break; | 39 break; |
40 } | 40 } |
41 default: { | 41 default: { |
42 result_value = MapPrimitive(signature, onc_value, error); | 42 result_value = MapPrimitive(signature, onc_value, error); |
43 break; | 43 break; |
44 } | 44 } |
45 } | 45 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 std::unique_ptr<base::Value> Mapper::MapEntry( | 136 std::unique_ptr<base::Value> Mapper::MapEntry( |
137 int index, | 137 int index, |
138 const OncValueSignature& signature, | 138 const OncValueSignature& signature, |
139 const base::Value& onc_value, | 139 const base::Value& onc_value, |
140 bool* error) { | 140 bool* error) { |
141 return MapValue(signature, onc_value, error); | 141 return MapValue(signature, onc_value, error); |
142 } | 142 } |
143 | 143 |
144 } // namespace onc | 144 } // namespace onc |
145 } // namespace chromeos | 145 } // namespace chromeos |
OLD | NEW |