OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/policy_util.h" | 5 #include "chromeos/network/policy_util.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/values.h" | 11 #include "base/values.h" |
11 #include "chromeos/network/network_profile.h" | 12 #include "chromeos/network/network_profile.h" |
12 #include "chromeos/network/network_ui_data.h" | 13 #include "chromeos/network/network_ui_data.h" |
13 #include "chromeos/network/onc/onc_merger.h" | 14 #include "chromeos/network/onc/onc_merger.h" |
14 #include "chromeos/network/onc/onc_normalizer.h" | 15 #include "chromeos/network/onc/onc_normalizer.h" |
15 #include "chromeos/network/onc/onc_signature.h" | 16 #include "chromeos/network/onc/onc_signature.h" |
16 #include "chromeos/network/onc/onc_translator.h" | 17 #include "chromeos/network/onc/onc_translator.h" |
17 #include "chromeos/network/onc/onc_utils.h" | 18 #include "chromeos/network/onc/onc_utils.h" |
18 #include "chromeos/network/shill_property_util.h" | 19 #include "chromeos/network/shill_property_util.h" |
19 #include "components/onc/onc_constants.h" | 20 #include "components/onc/onc_constants.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 158 |
158 bool autoconnect = false; | 159 bool autoconnect = false; |
159 network_dict->GetBooleanWithoutPathExpansion(autoconnect_key, &autoconnect); | 160 network_dict->GetBooleanWithoutPathExpansion(autoconnect_key, &autoconnect); |
160 return autoconnect; | 161 return autoconnect; |
161 } | 162 } |
162 | 163 |
163 base::DictionaryValue* GetOrCreateDictionary(const std::string& key, | 164 base::DictionaryValue* GetOrCreateDictionary(const std::string& key, |
164 base::DictionaryValue* dict) { | 165 base::DictionaryValue* dict) { |
165 base::DictionaryValue* inner_dict = NULL; | 166 base::DictionaryValue* inner_dict = NULL; |
166 if (!dict->GetDictionaryWithoutPathExpansion(key, &inner_dict)) { | 167 if (!dict->GetDictionaryWithoutPathExpansion(key, &inner_dict)) { |
167 inner_dict = new base::DictionaryValue; | 168 dict->SetWithoutPathExpansion(key, |
168 dict->SetWithoutPathExpansion(key, inner_dict); | 169 base::MakeUnique<base::DictionaryValue>()); |
| 170 dict->GetDictionaryWithoutPathExpansion(key, &inner_dict); |
169 } | 171 } |
170 return inner_dict; | 172 return inner_dict; |
171 } | 173 } |
172 | 174 |
173 base::DictionaryValue* GetOrCreateNestedDictionary( | 175 base::DictionaryValue* GetOrCreateNestedDictionary( |
174 const std::string& key1, | 176 const std::string& key1, |
175 const std::string& key2, | 177 const std::string& key2, |
176 base::DictionaryValue* dict) { | 178 base::DictionaryValue* dict) { |
177 base::DictionaryValue* inner_dict = GetOrCreateDictionary(key1, dict); | 179 base::DictionaryValue* inner_dict = GetOrCreateDictionary(key1, dict); |
178 return GetOrCreateDictionary(key2, inner_dict); | 180 return GetOrCreateDictionary(key2, inner_dict); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 for (auto it = policies.begin(); it != policies.end(); ++it) { | 404 for (auto it = policies.begin(); it != policies.end(); ++it) { |
403 if (IsPolicyMatching(*it->second, actual_network)) | 405 if (IsPolicyMatching(*it->second, actual_network)) |
404 return it->second.get(); | 406 return it->second.get(); |
405 } | 407 } |
406 return NULL; | 408 return NULL; |
407 } | 409 } |
408 | 410 |
409 } // namespace policy_util | 411 } // namespace policy_util |
410 | 412 |
411 } // namespace chromeos | 413 } // namespace chromeos |
OLD | NEW |