| Index: chrome/browser/chromeos/net/onc_utils.cc
|
| diff --git a/chrome/browser/chromeos/net/onc_utils.cc b/chrome/browser/chromeos/net/onc_utils.cc
|
| index 22361d5d99e4558d92012572fb675a73a8e209e0..453db61d2c69926149743ed0654f6e560cc8c351 100644
|
| --- a/chrome/browser/chromeos/net/onc_utils.cc
|
| +++ b/chrome/browser/chromeos/net/onc_utils.cc
|
| @@ -264,6 +264,62 @@ const base::DictionaryValue* GetNetworkConfigByGUID(
|
| return NULL;
|
| }
|
|
|
| +const base::DictionaryValue* GetNetworkConfigForEthernetWithoutEAP(
|
| + const base::ListValue& network_configs) {
|
| + VLOG(2) << "Search for ethernet policy without EAP.";
|
| + for (base::ListValue::const_iterator it = network_configs.begin();
|
| + it != network_configs.end(); ++it) {
|
| + const base::DictionaryValue* network = NULL;
|
| + (*it)->GetAsDictionary(&network);
|
| +
|
| + std::string type;
|
| + network->GetStringWithoutPathExpansion(onc::network_config::kType, &type);
|
| + if (type != onc::network_type::kEthernet)
|
| + continue;
|
| +
|
| + const base::DictionaryValue* ethernet = NULL;
|
| + network->GetDictionaryWithoutPathExpansion(onc::network_config::kEthernet,
|
| + ðernet);
|
| +
|
| + std::string auth;
|
| + ethernet->GetStringWithoutPathExpansion(onc::ethernet::kAuthentication,
|
| + &auth);
|
| + if (auth == onc::ethernet::kNone)
|
| + return network;
|
| + }
|
| + return NULL;
|
| +}
|
| +
|
| +const base::DictionaryValue* GetNetworkConfigForNetworkFromOnc(
|
| + const base::ListValue& network_configs,
|
| + const NetworkStateBase& network) {
|
| + // In all cases except Ethernet, we use the GUID of |network|.
|
| + if (!network.Matches(NetworkTypePattern::Ethernet()))
|
| + return GetNetworkConfigByGUID(network_configs, network.guid());
|
| +
|
| + // Ethernet is always shared and thus cannot store a GUID per user. Thus we
|
| + // search for any Ethernet policy intead of a matching GUID.
|
| + // EthernetEAP service contains only the EAP parameters and stores the GUID of
|
| + // the respective ONC policy. The EthernetEAP service itself is however never
|
| + // in state "connected". An EthernetEAP policy must be applied, if an Ethernet
|
| + // service is connected using the EAP parameters.
|
| + const FavoriteState* ethernet_eap = NULL;
|
| + if (NetworkHandler::IsInitialized()) {
|
| + ethernet_eap =
|
| + NetworkHandler::Get()->network_state_handler()->GetEAPForEthernet(
|
| + &network);
|
| + }
|
| +
|
| + // The GUID associated with the EthernetEAP service refers to the ONC policy
|
| + // with "Authentication: 8021X".
|
| + if (ethernet_eap)
|
| + return GetNetworkConfigByGUID(network_configs, ethernet_eap->guid());
|
| +
|
| + // Otherwise, EAP is not used and instead the Ethernet policy with
|
| + // "Authentication: None" applies.
|
| + return GetNetworkConfigForEthernetWithoutEAP(network_configs);
|
| +}
|
| +
|
| const base::DictionaryValue* GetPolicyForNetworkFromPref(
|
| const PrefService* pref_service,
|
| const char* pref_name,
|
| @@ -301,7 +357,7 @@ const base::DictionaryValue* GetPolicyForNetworkFromPref(
|
| onc_policy_value->GetAsList(&onc_policy);
|
| DCHECK(onc_policy);
|
|
|
| - return GetNetworkConfigByGUID(*onc_policy, network.guid());
|
| + return GetNetworkConfigForNetworkFromOnc(*onc_policy, network);
|
| }
|
|
|
| } // namespace
|
|
|