| 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 inner_dict = dict->SetDictionaryWithoutPathExpansion( |
| 168 dict->SetWithoutPathExpansion(key, inner_dict); | 169 key, base::MakeUnique<base::DictionaryValue>()); |
| 169 } | 170 } |
| 170 return inner_dict; | 171 return inner_dict; |
| 171 } | 172 } |
| 172 | 173 |
| 173 base::DictionaryValue* GetOrCreateNestedDictionary( | 174 base::DictionaryValue* GetOrCreateNestedDictionary( |
| 174 const std::string& key1, | 175 const std::string& key1, |
| 175 const std::string& key2, | 176 const std::string& key2, |
| 176 base::DictionaryValue* dict) { | 177 base::DictionaryValue* dict) { |
| 177 base::DictionaryValue* inner_dict = GetOrCreateDictionary(key1, dict); | 178 base::DictionaryValue* inner_dict = GetOrCreateDictionary(key1, dict); |
| 178 return GetOrCreateDictionary(key2, inner_dict); | 179 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) { | 403 for (auto it = policies.begin(); it != policies.end(); ++it) { |
| 403 if (IsPolicyMatching(*it->second, actual_network)) | 404 if (IsPolicyMatching(*it->second, actual_network)) |
| 404 return it->second.get(); | 405 return it->second.get(); |
| 405 } | 406 } |
| 406 return NULL; | 407 return NULL; |
| 407 } | 408 } |
| 408 | 409 |
| 409 } // namespace policy_util | 410 } // namespace policy_util |
| 410 | 411 |
| 411 } // namespace chromeos | 412 } // namespace chromeos |
| OLD | NEW |