Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(712)

Side by Side Diff: chromeos/network/network_connection_handler.cc

Issue 788633003: chromeos networking: move from security to securityclass property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@local-master
Patch Set: rebase, resolve conflicts, update new test data (shill_wifi_dhcp.json) Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromeos/network/network_cert_migrator_unittest.cc ('k') | chromeos/network/network_state.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
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
OLDNEW
« no previous file with comments | « chromeos/network/network_cert_migrator_unittest.cc ('k') | chromeos/network/network_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698