| 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_applicator.h" | 5 #include "chromeos/network/policy_applicator.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 dbus::ObjectPath(profile_.path), | 202 dbus::ObjectPath(profile_.path), |
| 203 entry, | 203 entry, |
| 204 base::Bind(&base::DoNothing), | 204 base::Bind(&base::DoNothing), |
| 205 base::Bind(&LogErrorMessage, FROM_HERE)); | 205 base::Bind(&LogErrorMessage, FROM_HERE)); |
| 206 } | 206 } |
| 207 | 207 |
| 208 void PolicyApplicator::CreateAndWriteNewShillConfiguration( | 208 void PolicyApplicator::CreateAndWriteNewShillConfiguration( |
| 209 const std::string& guid, | 209 const std::string& guid, |
| 210 const base::DictionaryValue& policy, | 210 const base::DictionaryValue& policy, |
| 211 const base::DictionaryValue* user_settings) { | 211 const base::DictionaryValue* user_settings) { |
| 212 // Ethernet (non EAP) settings, like GUID or UIData, cannot be stored per |
| 213 // user. Abort in that case. |
| 214 std::string type; |
| 215 policy.GetStringWithoutPathExpansion(onc::network_config::kType, &type); |
| 216 if (type == onc::network_type::kEthernet && |
| 217 profile_.type() == NetworkProfile::TYPE_USER) { |
| 218 const base::DictionaryValue* ethernet = NULL; |
| 219 policy.GetDictionaryWithoutPathExpansion(onc::network_config::kEthernet, |
| 220 ðernet); |
| 221 std::string auth; |
| 222 ethernet->GetStringWithoutPathExpansion(onc::ethernet::kAuthentication, |
| 223 &auth); |
| 224 if (auth == onc::ethernet::kNone) |
| 225 return; |
| 226 } |
| 227 |
| 212 scoped_ptr<base::DictionaryValue> shill_dictionary = | 228 scoped_ptr<base::DictionaryValue> shill_dictionary = |
| 213 policy_util::CreateShillConfiguration( | 229 policy_util::CreateShillConfiguration( |
| 214 profile_, guid, &policy, user_settings); | 230 profile_, guid, &policy, user_settings); |
| 215 handler_->CreateConfigurationFromPolicy(*shill_dictionary); | 231 handler_->CreateConfigurationFromPolicy(*shill_dictionary); |
| 216 } | 232 } |
| 217 | 233 |
| 218 PolicyApplicator::~PolicyApplicator() { | 234 PolicyApplicator::~PolicyApplicator() { |
| 219 ApplyRemainingPolicies(); | 235 ApplyRemainingPolicies(); |
| 220 STLDeleteValues(&all_policies_); | 236 STLDeleteValues(&all_policies_); |
| 221 } | 237 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 242 | 258 |
| 243 VLOG(1) << "Creating new configuration managed by policy " << *it | 259 VLOG(1) << "Creating new configuration managed by policy " << *it |
| 244 << " in profile " << profile_.ToDebugString() << "."; | 260 << " in profile " << profile_.ToDebugString() << "."; |
| 245 | 261 |
| 246 CreateAndWriteNewShillConfiguration( | 262 CreateAndWriteNewShillConfiguration( |
| 247 *it, *policy, NULL /* no user settings */); | 263 *it, *policy, NULL /* no user settings */); |
| 248 } | 264 } |
| 249 } | 265 } |
| 250 | 266 |
| 251 } // namespace chromeos | 267 } // namespace chromeos |
| OLD | NEW |