OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/network_connection_handler.h" | 5 #include "chromeos/network/network_connection_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 NET_LOG_EVENT("VPN Is Configured", service_path); | 84 NET_LOG_EVENT("VPN Is Configured", service_path); |
85 } | 85 } |
86 return false; | 86 return false; |
87 } | 87 } |
88 | 88 |
89 std::string GetDefaultUserProfilePath(const NetworkState* network) { | 89 std::string GetDefaultUserProfilePath(const NetworkState* network) { |
90 if (!NetworkHandler::IsInitialized() || | 90 if (!NetworkHandler::IsInitialized() || |
91 (LoginState::IsInitialized() && | 91 (LoginState::IsInitialized() && |
92 !LoginState::Get()->UserHasNetworkProfile()) || | 92 !LoginState::Get()->UserHasNetworkProfile()) || |
93 (network && network->type() == shill::kTypeWifi && | 93 (network && network->type() == shill::kTypeWifi && |
94 network->security() == shill::kSecurityNone)) { | 94 network->security_class() == shill::kSecurityNone)) { |
95 return NetworkProfileHandler::GetSharedProfilePath(); | 95 return NetworkProfileHandler::GetSharedProfilePath(); |
96 } | 96 } |
97 const NetworkProfile* profile = | 97 const NetworkProfile* profile = |
98 NetworkHandler::Get()->network_profile_handler()->GetDefaultUserProfile(); | 98 NetworkHandler::Get()->network_profile_handler()->GetDefaultUserProfile(); |
99 return profile ? profile->path | 99 return profile ? profile->path |
100 : NetworkProfileHandler::GetSharedProfilePath(); | 100 : NetworkProfileHandler::GetSharedProfilePath(); |
101 } | 101 } |
102 | 102 |
103 } // namespace | 103 } // namespace |
104 | 104 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 // If 'passphrase_required' is still true, then the 'Passphrase' property | 360 // If 'passphrase_required' is still true, then the 'Passphrase' property |
361 // has not been set to a minimum length value. | 361 // has not been set to a minimum length value. |
362 bool passphrase_required = false; | 362 bool passphrase_required = false; |
363 service_properties.GetBooleanWithoutPathExpansion( | 363 service_properties.GetBooleanWithoutPathExpansion( |
364 shill::kPassphraseRequiredProperty, &passphrase_required); | 364 shill::kPassphraseRequiredProperty, &passphrase_required); |
365 if (passphrase_required) { | 365 if (passphrase_required) { |
366 ErrorCallbackForPendingRequest(service_path, kErrorPassphraseRequired); | 366 ErrorCallbackForPendingRequest(service_path, kErrorPassphraseRequired); |
367 return; | 367 return; |
368 } | 368 } |
369 | 369 |
370 std::string type, security; | 370 std::string type, security_class; |
371 service_properties.GetStringWithoutPathExpansion(shill::kTypeProperty, &type); | 371 service_properties.GetStringWithoutPathExpansion(shill::kTypeProperty, &type); |
372 service_properties.GetStringWithoutPathExpansion( | 372 service_properties.GetStringWithoutPathExpansion( |
373 shill::kSecurityProperty, &security); | 373 shill::kSecurityClassProperty, &security_class); |
374 bool connectable = false; | 374 bool connectable = false; |
375 service_properties.GetBooleanWithoutPathExpansion( | 375 service_properties.GetBooleanWithoutPathExpansion( |
376 shill::kConnectableProperty, &connectable); | 376 shill::kConnectableProperty, &connectable); |
377 | 377 |
378 // In case NetworkState was not available in ConnectToNetwork (e.g. it had | 378 // In case NetworkState was not available in ConnectToNetwork (e.g. it had |
379 // been recently configured), we need to check Connectable again. | 379 // been recently configured), we need to check Connectable again. |
380 if (connectable && type != shill::kTypeVPN) { | 380 if (connectable && type != shill::kTypeVPN) { |
381 // TODO(stevenjb): Shill needs to properly set Connectable for VPN. | 381 // TODO(stevenjb): Shill needs to properly set Connectable for VPN. |
382 CallShillConnect(service_path); | 382 CallShillConnect(service_path); |
383 return; | 383 return; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 // TODO(benchan): Modify shill to specify the authentication type via | 429 // TODO(benchan): Modify shill to specify the authentication type via |
430 // the kL2tpIpsecAuthenticationType property, so that Chrome doesn't need | 430 // the kL2tpIpsecAuthenticationType property, so that Chrome doesn't need |
431 // to deduce the authentication type based on the | 431 // to deduce the authentication type based on the |
432 // kL2tpIpsecClientCertIdProperty here (and also in VPNConfigView). | 432 // kL2tpIpsecClientCertIdProperty here (and also in VPNConfigView). |
433 if (!vpn_client_cert_id.empty() || | 433 if (!vpn_client_cert_id.empty() || |
434 cert_config_from_policy.client_cert_type != | 434 cert_config_from_policy.client_cert_type != |
435 onc::client_cert::kClientCertTypeNone) { | 435 onc::client_cert::kClientCertTypeNone) { |
436 client_cert_type = client_cert::CONFIG_TYPE_IPSEC; | 436 client_cert_type = client_cert::CONFIG_TYPE_IPSEC; |
437 } | 437 } |
438 } | 438 } |
439 } else if (type == shill::kTypeWifi && security == shill::kSecurity8021x) { | 439 } else if (type == shill::kTypeWifi && |
| 440 security_class == shill::kSecurity8021x) { |
440 client_cert_type = client_cert::CONFIG_TYPE_EAP; | 441 client_cert_type = client_cert::CONFIG_TYPE_EAP; |
441 } | 442 } |
442 | 443 |
443 base::DictionaryValue config_properties; | 444 base::DictionaryValue config_properties; |
444 if (client_cert_type != client_cert::CONFIG_TYPE_NONE) { | 445 if (client_cert_type != client_cert::CONFIG_TYPE_NONE) { |
445 // Note: if we get here then a certificate *may* be required, so we want | 446 // Note: if we get here then a certificate *may* be required, so we want |
446 // to ensure that certificates have loaded successfully before attempting | 447 // to ensure that certificates have loaded successfully before attempting |
447 // to connect. | 448 // to connect. |
448 | 449 |
449 // User must be logged in to connect to a network requiring a certificate. | 450 // User must be logged in to connect to a network requiring a certificate. |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 | 748 |
748 void NetworkConnectionHandler::HandleShillDisconnectSuccess( | 749 void NetworkConnectionHandler::HandleShillDisconnectSuccess( |
749 const std::string& service_path, | 750 const std::string& service_path, |
750 const base::Closure& success_callback) { | 751 const base::Closure& success_callback) { |
751 NET_LOG_EVENT("Disconnect Request Sent", service_path); | 752 NET_LOG_EVENT("Disconnect Request Sent", service_path); |
752 if (!success_callback.is_null()) | 753 if (!success_callback.is_null()) |
753 success_callback.Run(); | 754 success_callback.Run(); |
754 } | 755 } |
755 | 756 |
756 } // namespace chromeos | 757 } // namespace chromeos |
OLD | NEW |