OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/options/wifi_config_view.h" | 5 #include "chrome/browser/chromeos/options/wifi_config_view.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 if (service_path_.empty()) { | 672 if (service_path_.empty()) { |
673 // TODO(stevenjb): Support modifying existing EAP configurations. | 673 // TODO(stevenjb): Support modifying existing EAP configurations. |
674 // Will probably wait to do this in WebUI instead. | 674 // Will probably wait to do this in WebUI instead. |
675 properties.SetStringWithoutPathExpansion( | 675 properties.SetStringWithoutPathExpansion( |
676 shill::kTypeProperty, shill::kTypeWifi); | 676 shill::kTypeProperty, shill::kTypeWifi); |
677 shill_property_util::SetSSID(GetSsid(), &properties); | 677 shill_property_util::SetSSID(GetSsid(), &properties); |
678 properties.SetStringWithoutPathExpansion( | 678 properties.SetStringWithoutPathExpansion( |
679 shill::kModeProperty, shill::kModeManaged); | 679 shill::kModeProperty, shill::kModeManaged); |
680 properties.SetBooleanWithoutPathExpansion( | 680 properties.SetBooleanWithoutPathExpansion( |
681 shill::kSaveCredentialsProperty, GetSaveCredentials()); | 681 shill::kSaveCredentialsProperty, GetSaveCredentials()); |
682 std::string security = shill::kSecurityNone; | 682 std::string security_class = shill::kSecurityNone; |
683 if (!eap_method_combobox_) { | 683 if (!eap_method_combobox_) { |
684 switch (security_combobox_->selected_index()) { | 684 switch (security_combobox_->selected_index()) { |
685 case SECURITY_INDEX_NONE: | 685 case SECURITY_INDEX_NONE: |
686 security = shill::kSecurityNone; | 686 security_class = shill::kSecurityNone; |
687 break; | 687 break; |
688 case SECURITY_INDEX_WEP: | 688 case SECURITY_INDEX_WEP: |
689 security = shill::kSecurityWep; | 689 security_class = shill::kSecurityWep; |
690 break; | 690 break; |
691 case SECURITY_INDEX_PSK: | 691 case SECURITY_INDEX_PSK: |
692 security = shill::kSecurityPsk; | 692 security_class = shill::kSecurityPsk; |
693 break; | 693 break; |
694 } | 694 } |
695 std::string passphrase = GetPassphrase(); | 695 std::string passphrase = GetPassphrase(); |
696 if (!passphrase.empty()) { | 696 if (!passphrase.empty()) { |
697 properties.SetStringWithoutPathExpansion( | 697 properties.SetStringWithoutPathExpansion( |
698 shill::kPassphraseProperty, GetPassphrase()); | 698 shill::kPassphraseProperty, GetPassphrase()); |
699 } | 699 } |
700 } else { | 700 } else { |
701 security = shill::kSecurity8021x; | 701 security_class = shill::kSecurity8021x; |
702 SetEapProperties(&properties, false /* not configured */); | 702 SetEapProperties(&properties, false /* not configured */); |
703 } | 703 } |
704 properties.SetStringWithoutPathExpansion( | 704 properties.SetStringWithoutPathExpansion( |
705 shill::kSecurityProperty, security); | 705 shill::kSecurityClassProperty, security_class); |
706 | 706 |
707 // Configure and connect to network. | 707 // Configure and connect to network. |
708 ui::NetworkConnect::Get()->CreateConfigurationAndConnect(&properties, | 708 ui::NetworkConnect::Get()->CreateConfigurationAndConnect(&properties, |
709 share_network); | 709 share_network); |
710 } else { | 710 } else { |
711 if (!network) { | 711 if (!network) { |
712 // Shill no longer knows about this network (edge case). | 712 // Shill no longer knows about this network (edge case). |
713 // TODO(stevenjb): Add notification for this. | 713 // TODO(stevenjb): Add notification for this. |
714 NET_LOG_ERROR("Network not found", service_path_); | 714 NET_LOG_ERROR("Network not found", service_path_); |
715 return true; // Close dialog | 715 return true; // Close dialog |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 shill::kEapCaCertPemProperty, pem_list); | 892 shill::kEapCaCertPemProperty, pem_list); |
893 } | 893 } |
894 | 894 |
895 void WifiConfigView::Cancel() { | 895 void WifiConfigView::Cancel() { |
896 } | 896 } |
897 | 897 |
898 void WifiConfigView::Init(bool show_8021x) { | 898 void WifiConfigView::Init(bool show_8021x) { |
899 const NetworkState* network = GetNetworkState(); | 899 const NetworkState* network = GetNetworkState(); |
900 if (network) { | 900 if (network) { |
901 if (network->type() == shill::kTypeWifi) { | 901 if (network->type() == shill::kTypeWifi) { |
902 if (network->security() == shill::kSecurity8021x) | 902 if (network->security_class() == shill::kSecurity8021x) |
903 show_8021x = true; | 903 show_8021x = true; |
904 } else if (network->type() == shill::kTypeEthernet) { | 904 } else if (network->type() == shill::kTypeEthernet) { |
905 show_8021x = true; | 905 show_8021x = true; |
906 } else { | 906 } else { |
907 NOTREACHED() << "Unexpected network type for WifiConfigView: " | 907 NOTREACHED() << "Unexpected network type for WifiConfigView: " |
908 << network->type() << " Path: " << service_path_; | 908 << network->type() << " Path: " << service_path_; |
909 } | 909 } |
910 ParseEAPUIProperty(&eap_method_ui_data_, network, ::onc::eap::kOuter); | 910 ParseEAPUIProperty(&eap_method_ui_data_, network, ::onc::eap::kOuter); |
911 ParseEAPUIProperty(&phase_2_auth_ui_data_, network, ::onc::eap::kInner); | 911 ParseEAPUIProperty(&phase_2_auth_ui_data_, network, ::onc::eap::kInner); |
912 ParseEAPUIProperty( | 912 ParseEAPUIProperty( |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 void WifiConfigView::ParseEAPUIProperty(NetworkPropertyUIData* property_ui_data, | 1379 void WifiConfigView::ParseEAPUIProperty(NetworkPropertyUIData* property_ui_data, |
1380 const NetworkState* network, | 1380 const NetworkState* network, |
1381 const std::string& key) { | 1381 const std::string& key) { |
1382 std::string onc_tag = network->type() == shill::kTypeEthernet | 1382 std::string onc_tag = network->type() == shill::kTypeEthernet |
1383 ? ::onc::ethernet::kEAP | 1383 ? ::onc::ethernet::kEAP |
1384 : ::onc::wifi::kEAP; | 1384 : ::onc::wifi::kEAP; |
1385 ParseUIProperty(property_ui_data, network, onc_tag + '.' + key); | 1385 ParseUIProperty(property_ui_data, network, onc_tag + '.' + key); |
1386 } | 1386 } |
1387 | 1387 |
1388 } // namespace chromeos | 1388 } // namespace chromeos |
OLD | NEW |