Chromium Code Reviews| Index: chromeos/network/policy_applicator.cc |
| diff --git a/chromeos/network/policy_applicator.cc b/chromeos/network/policy_applicator.cc |
| index 088cd469d6f204792aada673c07d2c9d2471ab99..f47ca908c4c2da9533f780b2f0df358132ea50cd 100644 |
| --- a/chromeos/network/policy_applicator.cc |
| +++ b/chromeos/network/policy_applicator.cc |
| @@ -172,8 +172,11 @@ void PolicyApplicator::GetEntryCallback( |
| const base::DictionaryValue* user_settings = |
| ui_data ? ui_data->user_settings() : NULL; |
| scoped_ptr<base::DictionaryValue> new_shill_properties = |
| - policy_util::CreateShillConfiguration( |
| - profile_, new_guid, new_policy, user_settings); |
| + policy_util::CreateShillConfiguration(profile_, |
| + new_guid, |
| + &global_network_config_, |
| + new_policy, |
| + user_settings); |
| // A new policy has to be applied to this profile entry. In order to keep |
| // implicit state of Shill like "connected successfully before", keep the |
| // entry if a policy is reapplied (e.g. after reboot) or is updated. |
| @@ -219,8 +222,8 @@ void PolicyApplicator::GetEntryCallback( |
| // The entry wasn't managed and doesn't match any current policy. Global |
| // network settings have to be applied. |
| base::DictionaryValue shill_properties_to_update; |
| - GetPropertiesForUnmanagedEntry(entry_properties, |
| - &shill_properties_to_update); |
| + policy_util::SetShillPropertiesForGlobalPolicy( |
| + entry_properties, &global_network_config_, &shill_properties_to_update); |
| if (shill_properties_to_update.empty()) { |
| VLOG(2) << "Ignore unmanaged entry."; |
| // Calling a SetProperties of Shill with an empty dictionary is a no op. |
| @@ -266,37 +269,6 @@ void PolicyApplicator::WriteNewShillConfiguration( |
| handler_->CreateConfigurationFromPolicy(shill_dictionary); |
| } |
| -void PolicyApplicator::GetPropertiesForUnmanagedEntry( |
|
pneubeck (no reviews)
2014/08/28 16:09:49
move to policy_util.cc SetShillPropertiesForGlobal
|
| - const base::DictionaryValue& entry_properties, |
| - base::DictionaryValue* properties_to_update) const { |
| - // kAllowOnlyPolicyNetworksToAutoconnect is currently the only global config. |
| - |
| - std::string type; |
| - entry_properties.GetStringWithoutPathExpansion(shill::kTypeProperty, &type); |
| - if (NetworkTypePattern::Ethernet().MatchesType(type)) |
| - return; // Autoconnect for Ethernet cannot be configured. |
| - |
| - // By default all networks are allowed to autoconnect. |
| - bool only_policy_autoconnect = false; |
| - global_network_config_.GetBooleanWithoutPathExpansion( |
| - ::onc::global_network_config::kAllowOnlyPolicyNetworksToAutoconnect, |
| - &only_policy_autoconnect); |
| - if (!only_policy_autoconnect) |
| - return; |
| - |
| - bool old_autoconnect = false; |
| - if (entry_properties.GetBooleanWithoutPathExpansion( |
| - shill::kAutoConnectProperty, &old_autoconnect) && |
| - !old_autoconnect) { |
| - // Autoconnect is already explictly disabled. No need to set it again. |
| - return; |
| - } |
| - // If autconnect is not explicitly set yet, it might automatically be enabled |
| - // by Shill. To prevent that, disable it explicitly. |
| - properties_to_update->SetBooleanWithoutPathExpansion( |
| - shill::kAutoConnectProperty, false); |
| -} |
| - |
| PolicyApplicator::~PolicyApplicator() { |
| ApplyRemainingPolicies(); |
| STLDeleteValues(&all_policies_); |
| @@ -331,15 +303,19 @@ void PolicyApplicator::ApplyRemainingPolicies() { |
| // remaining policies, new configurations have to be created. |
| for (std::set<std::string>::iterator it = remaining_policies_.begin(); |
| it != remaining_policies_.end(); ++it) { |
| - const base::DictionaryValue* policy = GetByGUID(all_policies_, *it); |
| - DCHECK(policy); |
| + const base::DictionaryValue* network_policy = GetByGUID(all_policies_, *it); |
| + DCHECK(network_policy); |
| VLOG(1) << "Creating new configuration managed by policy " << *it |
| << " in profile " << profile_.ToDebugString() << "."; |
| scoped_ptr<base::DictionaryValue> shill_dictionary = |
| - policy_util::CreateShillConfiguration(profile_, *it, policy, NULL); |
| - WriteNewShillConfiguration(*shill_dictionary, *policy, false); |
| + policy_util::CreateShillConfiguration(profile_, |
| + *it, |
| + &global_network_config_, |
| + network_policy, |
| + NULL /* no user settings */); |
| + WriteNewShillConfiguration(*shill_dictionary, *network_policy, false); |
| } |
| } |