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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 return ssid_textfield_; | 394 return ssid_textfield_; |
395 else if (eap_method_combobox_) | 395 else if (eap_method_combobox_) |
396 return eap_method_combobox_; | 396 return eap_method_combobox_; |
397 else if (passphrase_textfield_ && passphrase_textfield_->enabled()) | 397 else if (passphrase_textfield_ && passphrase_textfield_->enabled()) |
398 return passphrase_textfield_; | 398 return passphrase_textfield_; |
399 else | 399 else |
400 return NULL; | 400 return NULL; |
401 } | 401 } |
402 | 402 |
403 bool WifiConfigView::CanLogin() { | 403 bool WifiConfigView::CanLogin() { |
404 static const size_t kMinWirelessPasswordLen = 5; | 404 static const size_t kMinPSKPasswordLen = 5; |
405 | 405 |
406 // We either have an existing network or the user entered an SSID. | 406 // We either have an existing network or the user entered an SSID. |
407 if (service_path_.empty() && GetSsid().empty()) | 407 if (service_path_.empty() && GetSsid().empty()) |
408 return false; | 408 return false; |
409 | 409 |
410 // If the network requires a passphrase, make sure it is the right length. | 410 // If a non-EAP network requires a passphrase, ensure it is the right length. |
411 if (passphrase_textfield_ != NULL && | 411 if (passphrase_textfield_ != NULL && |
412 passphrase_textfield_->enabled() && | 412 passphrase_textfield_->enabled() && |
413 !passphrase_textfield_->show_fake() && | 413 !passphrase_textfield_->show_fake() && |
414 passphrase_textfield_->text().length() < kMinWirelessPasswordLen) | 414 !eap_method_combobox_ && |
| 415 passphrase_textfield_->text().length() < kMinPSKPasswordLen) |
415 return false; | 416 return false; |
416 | 417 |
417 // If we're using EAP, we must have a method. | 418 // If we're using EAP, we must have a method. |
418 if (eap_method_combobox_ && | 419 if (eap_method_combobox_ && |
419 eap_method_combobox_->selected_index() == EAP_METHOD_INDEX_NONE) | 420 eap_method_combobox_->selected_index() == EAP_METHOD_INDEX_NONE) |
420 return false; | 421 return false; |
421 | 422 |
422 // Block login if certs are required but user has none. | 423 // Block login if certs are required but user has none. |
423 if (UserCertRequired() && (!HaveUserCerts() || !IsUserCertValid())) | 424 if (UserCertRequired() && (!HaveUserCerts() || !IsUserCertValid())) |
424 return false; | 425 return false; |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 void WifiConfigView::ParseEAPUIProperty(NetworkPropertyUIData* property_ui_data, | 1380 void WifiConfigView::ParseEAPUIProperty(NetworkPropertyUIData* property_ui_data, |
1380 const NetworkState* network, | 1381 const NetworkState* network, |
1381 const std::string& key) { | 1382 const std::string& key) { |
1382 std::string onc_tag = network->type() == shill::kTypeEthernet | 1383 std::string onc_tag = network->type() == shill::kTypeEthernet |
1383 ? ::onc::ethernet::kEAP | 1384 ? ::onc::ethernet::kEAP |
1384 : ::onc::wifi::kEAP; | 1385 : ::onc::wifi::kEAP; |
1385 ParseUIProperty(property_ui_data, network, onc_tag + '.' + key); | 1386 ParseUIProperty(property_ui_data, network, onc_tag + '.' + key); |
1386 } | 1387 } |
1387 | 1388 |
1388 } // namespace chromeos | 1389 } // namespace chromeos |
OLD | NEW |