| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/chromeos/cros/cros_library.h" | 9 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 10 #include "chrome/browser/chromeos/cros/network_library.h" | 10 #include "chrome/browser/chromeos/cros/network_library.h" |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 key_event.key_code() == ui::VKEY_RETURN) { | 501 key_event.key_code() == ui::VKEY_RETURN) { |
| 502 parent_->GetDialogClientView()->AcceptWindow(); | 502 parent_->GetDialogClientView()->AcceptWindow(); |
| 503 } | 503 } |
| 504 return false; | 504 return false; |
| 505 } | 505 } |
| 506 | 506 |
| 507 void WifiConfigView::ButtonPressed(views::Button* sender, | 507 void WifiConfigView::ButtonPressed(views::Button* sender, |
| 508 const views::Event& event) { | 508 const views::Event& event) { |
| 509 if (sender == passphrase_visible_button_) { | 509 if (sender == passphrase_visible_button_) { |
| 510 if (passphrase_textfield_) { | 510 if (passphrase_textfield_) { |
| 511 passphrase_textfield_->SetPassword(!passphrase_textfield_->IsPassword()); | 511 bool obscure = !passphrase_textfield_->IsObscured(); |
| 512 passphrase_visible_button_->SetToggled( | 512 passphrase_textfield_->SetObscured(obscure); |
| 513 !passphrase_textfield_->IsPassword()); | 513 passphrase_visible_button_->SetToggled(!obscure); |
| 514 } | 514 } |
| 515 } else { | 515 } else { |
| 516 NOTREACHED(); | 516 NOTREACHED(); |
| 517 } | 517 } |
| 518 } | 518 } |
| 519 | 519 |
| 520 void WifiConfigView::ItemChanged(views::Combobox* combo_box, | 520 void WifiConfigView::ItemChanged(views::Combobox* combo_box, |
| 521 int prev_index, int new_index) { | 521 int prev_index, int new_index) { |
| 522 if (new_index == prev_index) | 522 if (new_index == prev_index) |
| 523 return; | 523 return; |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 902 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 903 } | 903 } |
| 904 | 904 |
| 905 // Passphrase input | 905 // Passphrase input |
| 906 layout->StartRow(0, column_view_set_id); | 906 layout->StartRow(0, column_view_set_id); |
| 907 int label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE; | 907 int label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE; |
| 908 passphrase_label_ = new views::Label( | 908 passphrase_label_ = new views::Label( |
| 909 l10n_util::GetStringUTF16(label_text_id)); | 909 l10n_util::GetStringUTF16(label_text_id)); |
| 910 layout->AddView(passphrase_label_); | 910 layout->AddView(passphrase_label_); |
| 911 passphrase_textfield_ = new views::Textfield( | 911 passphrase_textfield_ = new views::Textfield( |
| 912 views::Textfield::STYLE_PASSWORD); | 912 views::Textfield::STYLE_OBSCURED); |
| 913 passphrase_textfield_->SetController(this); | 913 passphrase_textfield_->SetController(this); |
| 914 if (wifi && !wifi->GetPassphrase().empty()) | 914 if (wifi && !wifi->GetPassphrase().empty()) |
| 915 passphrase_textfield_->SetText(UTF8ToUTF16(wifi->GetPassphrase())); | 915 passphrase_textfield_->SetText(UTF8ToUTF16(wifi->GetPassphrase())); |
| 916 // Disable passphrase input initially for other network. | 916 // Disable passphrase input initially for other network. |
| 917 if (!wifi) { | 917 if (!wifi) { |
| 918 passphrase_label_->SetEnabled(false); | 918 passphrase_label_->SetEnabled(false); |
| 919 passphrase_textfield_->SetEnabled(false); | 919 passphrase_textfield_->SetEnabled(false); |
| 920 } | 920 } |
| 921 passphrase_textfield_->SetAccessibleName(l10n_util::GetStringUTF16( | 921 passphrase_textfield_->SetAccessibleName(l10n_util::GetStringUTF16( |
| 922 label_text_id)); | 922 label_text_id)); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 // Set focus to a reasonable widget, depending on what we're showing. | 1129 // Set focus to a reasonable widget, depending on what we're showing. |
| 1130 if (ssid_textfield_) | 1130 if (ssid_textfield_) |
| 1131 ssid_textfield_->RequestFocus(); | 1131 ssid_textfield_->RequestFocus(); |
| 1132 else if (eap_method_combobox_) | 1132 else if (eap_method_combobox_) |
| 1133 eap_method_combobox_->RequestFocus(); | 1133 eap_method_combobox_->RequestFocus(); |
| 1134 else if (passphrase_textfield_ && passphrase_textfield_->IsEnabled()) | 1134 else if (passphrase_textfield_ && passphrase_textfield_->IsEnabled()) |
| 1135 passphrase_textfield_->RequestFocus(); | 1135 passphrase_textfield_->RequestFocus(); |
| 1136 } | 1136 } |
| 1137 | 1137 |
| 1138 } // namespace chromeos | 1138 } // namespace chromeos |
| OLD | NEW |