| 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 "ash/system/chromeos/network/network_connect.h" | 7 #include "ash/system/chromeos/network/network_connect.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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 static const size_t kMinWirelessPasswordLen = 5; | 400 static const size_t kMinWirelessPasswordLen = 5; |
| 401 | 401 |
| 402 // We either have an existing wifi network or the user entered an SSID. | 402 // We either have an existing wifi network or the user entered an SSID. |
| 403 if (service_path_.empty() && GetSsid().empty()) | 403 if (service_path_.empty() && GetSsid().empty()) |
| 404 return false; | 404 return false; |
| 405 | 405 |
| 406 // If the network requires a passphrase, make sure it is the right length. | 406 // If the network requires a passphrase, make sure it is the right length. |
| 407 if (passphrase_textfield_ != NULL && | 407 if (passphrase_textfield_ != NULL && |
| 408 passphrase_textfield_->enabled() && | 408 passphrase_textfield_->enabled() && |
| 409 !passphrase_textfield_->show_fake() && | 409 !passphrase_textfield_->show_fake() && |
| 410 passphrase_textfield_->text().length() < kMinWirelessPasswordLen) | 410 passphrase_textfield_->GetText().length() < kMinWirelessPasswordLen) |
| 411 return false; | 411 return false; |
| 412 | 412 |
| 413 // If we're using EAP, we must have a method. | 413 // If we're using EAP, we must have a method. |
| 414 if (eap_method_combobox_ && | 414 if (eap_method_combobox_ && |
| 415 eap_method_combobox_->selected_index() == EAP_METHOD_INDEX_NONE) | 415 eap_method_combobox_->selected_index() == EAP_METHOD_INDEX_NONE) |
| 416 return false; | 416 return false; |
| 417 | 417 |
| 418 // Block login if certs are required but user has none. | 418 // Block login if certs are required but user has none. |
| 419 if (UserCertRequired() && (!HaveUserCerts() || !IsUserCertValid())) | 419 if (UserCertRequired() && (!HaveUserCerts() || !IsUserCertValid())) |
| 420 return false; | 420 return false; |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 } | 725 } |
| 726 ash::network_connect::ConfigureNetworkAndConnect( | 726 ash::network_connect::ConfigureNetworkAndConnect( |
| 727 service_path_, properties, share_network); | 727 service_path_, properties, share_network); |
| 728 } | 728 } |
| 729 return true; // dialog will be closed | 729 return true; // dialog will be closed |
| 730 } | 730 } |
| 731 | 731 |
| 732 std::string WifiConfigView::GetSsid() const { | 732 std::string WifiConfigView::GetSsid() const { |
| 733 std::string result; | 733 std::string result; |
| 734 if (ssid_textfield_ != NULL) { | 734 if (ssid_textfield_ != NULL) { |
| 735 std::string untrimmed = base::UTF16ToUTF8(ssid_textfield_->text()); | 735 std::string untrimmed = base::UTF16ToUTF8(ssid_textfield_->GetText()); |
| 736 TrimWhitespaceASCII(untrimmed, TRIM_ALL, &result); | 736 TrimWhitespaceASCII(untrimmed, TRIM_ALL, &result); |
| 737 } | 737 } |
| 738 return result; | 738 return result; |
| 739 } | 739 } |
| 740 | 740 |
| 741 std::string WifiConfigView::GetPassphrase() const { | 741 std::string WifiConfigView::GetPassphrase() const { |
| 742 std::string result; | 742 std::string result; |
| 743 if (passphrase_textfield_ != NULL) | 743 if (passphrase_textfield_ != NULL) |
| 744 result = base::UTF16ToUTF8(passphrase_textfield_->text()); | 744 result = base::UTF16ToUTF8(passphrase_textfield_->GetText()); |
| 745 return result; | 745 return result; |
| 746 } | 746 } |
| 747 | 747 |
| 748 bool WifiConfigView::GetSaveCredentials() const { | 748 bool WifiConfigView::GetSaveCredentials() const { |
| 749 if (!save_credentials_checkbox_) | 749 if (!save_credentials_checkbox_) |
| 750 return true; // share networks by default (e.g. non 8021x). | 750 return true; // share networks by default (e.g. non 8021x). |
| 751 return save_credentials_checkbox_->checked(); | 751 return save_credentials_checkbox_->checked(); |
| 752 } | 752 } |
| 753 | 753 |
| 754 bool WifiConfigView::GetShareNetwork(bool share_default) const { | 754 bool WifiConfigView::GetShareNetwork(bool share_default) const { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 } | 813 } |
| 814 | 814 |
| 815 bool WifiConfigView::GetEapUseSystemCas() const { | 815 bool WifiConfigView::GetEapUseSystemCas() const { |
| 816 DCHECK(server_ca_cert_combobox_); | 816 DCHECK(server_ca_cert_combobox_); |
| 817 // Only use system CAs if the first item ("Default") is selected. | 817 // Only use system CAs if the first item ("Default") is selected. |
| 818 return server_ca_cert_combobox_->selected_index() == 0; | 818 return server_ca_cert_combobox_->selected_index() == 0; |
| 819 } | 819 } |
| 820 | 820 |
| 821 std::string WifiConfigView::GetEapSubjectMatch() const { | 821 std::string WifiConfigView::GetEapSubjectMatch() const { |
| 822 DCHECK(subject_match_textfield_); | 822 DCHECK(subject_match_textfield_); |
| 823 return base::UTF16ToUTF8(subject_match_textfield_->text()); | 823 return base::UTF16ToUTF8(subject_match_textfield_->GetText()); |
| 824 } | 824 } |
| 825 | 825 |
| 826 std::string WifiConfigView::GetEapClientCertPkcs11Id() const { | 826 std::string WifiConfigView::GetEapClientCertPkcs11Id() const { |
| 827 DCHECK(user_cert_combobox_); | 827 DCHECK(user_cert_combobox_); |
| 828 if (!HaveUserCerts() || !UserCertActive()) { | 828 if (!HaveUserCerts() || !UserCertActive()) { |
| 829 return std::string(); // No certificate selected or not required. | 829 return std::string(); // No certificate selected or not required. |
| 830 } else { | 830 } else { |
| 831 // Certificates are listed in the order they appear in the model. | 831 // Certificates are listed in the order they appear in the model. |
| 832 int index = user_cert_combobox_->selected_index(); | 832 int index = user_cert_combobox_->selected_index(); |
| 833 return CertLibrary::Get()->GetCertPkcs11IdAt( | 833 return CertLibrary::Get()->GetCertPkcs11IdAt( |
| 834 CertLibrary::CERT_TYPE_USER, index); | 834 CertLibrary::CERT_TYPE_USER, index); |
| 835 } | 835 } |
| 836 } | 836 } |
| 837 | 837 |
| 838 std::string WifiConfigView::GetEapIdentity() const { | 838 std::string WifiConfigView::GetEapIdentity() const { |
| 839 DCHECK(identity_textfield_); | 839 DCHECK(identity_textfield_); |
| 840 return base::UTF16ToUTF8(identity_textfield_->text()); | 840 return base::UTF16ToUTF8(identity_textfield_->GetText()); |
| 841 } | 841 } |
| 842 | 842 |
| 843 std::string WifiConfigView::GetEapAnonymousIdentity() const { | 843 std::string WifiConfigView::GetEapAnonymousIdentity() const { |
| 844 DCHECK(identity_anonymous_textfield_); | 844 DCHECK(identity_anonymous_textfield_); |
| 845 return base::UTF16ToUTF8(identity_anonymous_textfield_->text()); | 845 return base::UTF16ToUTF8(identity_anonymous_textfield_->GetText()); |
| 846 } | 846 } |
| 847 | 847 |
| 848 void WifiConfigView::SetEapProperties(base::DictionaryValue* properties) { | 848 void WifiConfigView::SetEapProperties(base::DictionaryValue* properties) { |
| 849 properties->SetStringWithoutPathExpansion( | 849 properties->SetStringWithoutPathExpansion( |
| 850 shill::kEapIdentityProperty, GetEapIdentity()); | 850 shill::kEapIdentityProperty, GetEapIdentity()); |
| 851 properties->SetStringWithoutPathExpansion( | 851 properties->SetStringWithoutPathExpansion( |
| 852 shill::kEapMethodProperty, GetEapMethod()); | 852 shill::kEapMethodProperty, GetEapMethod()); |
| 853 properties->SetStringWithoutPathExpansion( | 853 properties->SetStringWithoutPathExpansion( |
| 854 shill::kEapPhase2AuthProperty, GetEapPhase2Auth()); | 854 shill::kEapPhase2AuthProperty, GetEapPhase2Auth()); |
| 855 properties->SetStringWithoutPathExpansion( | 855 properties->SetStringWithoutPathExpansion( |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 void WifiConfigView::ParseWiFiEAPUIProperty( | 1347 void WifiConfigView::ParseWiFiEAPUIProperty( |
| 1348 NetworkPropertyUIData* property_ui_data, | 1348 NetworkPropertyUIData* property_ui_data, |
| 1349 const NetworkState* network, | 1349 const NetworkState* network, |
| 1350 const std::string& key) { | 1350 const std::string& key) { |
| 1351 ParseWiFiUIProperty( | 1351 ParseWiFiUIProperty( |
| 1352 property_ui_data, network, | 1352 property_ui_data, network, |
| 1353 base::StringPrintf("%s.%s", ::onc::wifi::kEAP, key.c_str())); | 1353 base::StringPrintf("%s.%s", ::onc::wifi::kEAP, key.c_str())); |
| 1354 } | 1354 } |
| 1355 | 1355 |
| 1356 } // namespace chromeos | 1356 } // namespace chromeos |
| OLD | NEW |