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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 // If 'passphrase_required' is still true, then the 'Passphrase' property | 361 // If 'passphrase_required' is still true, then the 'Passphrase' property |
362 // has not been set to a minimum length value. | 362 // has not been set to a minimum length value. |
363 bool passphrase_required = false; | 363 bool passphrase_required = false; |
364 service_properties.GetBooleanWithoutPathExpansion( | 364 service_properties.GetBooleanWithoutPathExpansion( |
365 shill::kPassphraseRequiredProperty, &passphrase_required); | 365 shill::kPassphraseRequiredProperty, &passphrase_required); |
366 if (passphrase_required) { | 366 if (passphrase_required) { |
367 ErrorCallbackForPendingRequest(service_path, kErrorPassphraseRequired); | 367 ErrorCallbackForPendingRequest(service_path, kErrorPassphraseRequired); |
368 return; | 368 return; |
369 } | 369 } |
370 | 370 |
371 std::string type, security; | 371 std::string type, security_class; |
372 service_properties.GetStringWithoutPathExpansion(shill::kTypeProperty, &type); | 372 service_properties.GetStringWithoutPathExpansion(shill::kTypeProperty, &type); |
373 service_properties.GetStringWithoutPathExpansion( | 373 service_properties.GetStringWithoutPathExpansion( |
374 shill::kSecurityProperty, &security); | 374 shill::kSecurityClassProperty, &security_class); |
375 bool connectable = false; | 375 bool connectable = false; |
376 service_properties.GetBooleanWithoutPathExpansion( | 376 service_properties.GetBooleanWithoutPathExpansion( |
377 shill::kConnectableProperty, &connectable); | 377 shill::kConnectableProperty, &connectable); |
378 | 378 |
379 // In case NetworkState was not available in ConnectToNetwork (e.g. it had | 379 // In case NetworkState was not available in ConnectToNetwork (e.g. it had |
380 // been recently configured), we need to check Connectable again. | 380 // been recently configured), we need to check Connectable again. |
381 if (connectable && type != shill::kTypeVPN) { | 381 if (connectable && type != shill::kTypeVPN) { |
382 // TODO(stevenjb): Shill needs to properly set Connectable for VPN. | 382 // TODO(stevenjb): Shill needs to properly set Connectable for VPN. |
383 CallShillConnect(service_path); | 383 CallShillConnect(service_path); |
384 return; | 384 return; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 // TODO(benchan): Modify shill to specify the authentication type via | 430 // TODO(benchan): Modify shill to specify the authentication type via |
431 // the kL2tpIpsecAuthenticationType property, so that Chrome doesn't need | 431 // the kL2tpIpsecAuthenticationType property, so that Chrome doesn't need |
432 // to deduce the authentication type based on the | 432 // to deduce the authentication type based on the |
433 // kL2tpIpsecClientCertIdProperty here (and also in VPNConfigView). | 433 // kL2tpIpsecClientCertIdProperty here (and also in VPNConfigView). |
434 if (!vpn_client_cert_id.empty() || | 434 if (!vpn_client_cert_id.empty() || |
435 cert_config_from_policy.client_cert_type != | 435 cert_config_from_policy.client_cert_type != |
436 onc::client_cert::kClientCertTypeNone) { | 436 onc::client_cert::kClientCertTypeNone) { |
437 client_cert_type = client_cert::CONFIG_TYPE_IPSEC; | 437 client_cert_type = client_cert::CONFIG_TYPE_IPSEC; |
438 } | 438 } |
439 } | 439 } |
440 } else if (type == shill::kTypeWifi && security == shill::kSecurity8021x) { | 440 } else if (type == shill::kTypeWifi && |
| 441 security_class == shill::kSecurity8021x) { |
441 client_cert_type = client_cert::CONFIG_TYPE_EAP; | 442 client_cert_type = client_cert::CONFIG_TYPE_EAP; |
442 } | 443 } |
443 | 444 |
444 base::DictionaryValue config_properties; | 445 base::DictionaryValue config_properties; |
445 if (client_cert_type != client_cert::CONFIG_TYPE_NONE) { | 446 if (client_cert_type != client_cert::CONFIG_TYPE_NONE) { |
446 // Note: if we get here then a certificate *may* be required, so we want | 447 // Note: if we get here then a certificate *may* be required, so we want |
447 // to ensure that certificates have loaded successfully before attempting | 448 // to ensure that certificates have loaded successfully before attempting |
448 // to connect. | 449 // to connect. |
449 | 450 |
450 // User must be logged in to connect to a network requiring a certificate. | 451 // 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... |
748 | 749 |
749 void NetworkConnectionHandler::HandleShillDisconnectSuccess( | 750 void NetworkConnectionHandler::HandleShillDisconnectSuccess( |
750 const std::string& service_path, | 751 const std::string& service_path, |
751 const base::Closure& success_callback) { | 752 const base::Closure& success_callback) { |
752 NET_LOG_EVENT("Disconnect Request Sent", service_path); | 753 NET_LOG_EVENT("Disconnect Request Sent", service_path); |
753 if (!success_callback.is_null()) | 754 if (!success_callback.is_null()) |
754 success_callback.Run(); | 755 success_callback.Run(); |
755 } | 756 } |
756 | 757 |
757 } // namespace chromeos | 758 } // namespace chromeos |
OLD | NEW |