| 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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 if (sender == passphrase_textfield_ && | 487 if (sender == passphrase_textfield_ && |
| 488 key_event.key_code() == ui::VKEY_RETURN) { | 488 key_event.key_code() == ui::VKEY_RETURN) { |
| 489 parent_->GetDialogClientView()->AcceptWindow(); | 489 parent_->GetDialogClientView()->AcceptWindow(); |
| 490 } | 490 } |
| 491 return false; | 491 return false; |
| 492 } | 492 } |
| 493 | 493 |
| 494 void WifiConfigView::ButtonPressed(views::Button* sender, | 494 void WifiConfigView::ButtonPressed(views::Button* sender, |
| 495 const views::Event& event) { | 495 const views::Event& event) { |
| 496 if (sender == passphrase_visible_button_) { | 496 if (sender == passphrase_visible_button_) { |
| 497 if (passphrase_textfield_) | 497 if (passphrase_textfield_) { |
| 498 passphrase_textfield_->SetPassword(!passphrase_textfield_->IsPassword()); | 498 passphrase_textfield_->SetPassword(!passphrase_textfield_->IsPassword()); |
| 499 passphrase_visible_button_->SetToggled( |
| 500 !passphrase_textfield_->IsPassword()); |
| 501 } |
| 499 } else { | 502 } else { |
| 500 NOTREACHED(); | 503 NOTREACHED(); |
| 501 } | 504 } |
| 502 } | 505 } |
| 503 | 506 |
| 504 void WifiConfigView::ItemChanged(views::Combobox* combo_box, | 507 void WifiConfigView::ItemChanged(views::Combobox* combo_box, |
| 505 int prev_index, int new_index) { | 508 int prev_index, int new_index) { |
| 506 if (new_index == prev_index) | 509 if (new_index == prev_index) |
| 507 return; | 510 return; |
| 508 if (combo_box == security_combobox_) { | 511 if (combo_box == security_combobox_) { |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 passphrase_textfield_->SetText(UTF8ToUTF16(wifi->GetPassphrase())); | 868 passphrase_textfield_->SetText(UTF8ToUTF16(wifi->GetPassphrase())); |
| 866 // Disable passphrase input initially for other network. | 869 // Disable passphrase input initially for other network. |
| 867 if (!wifi) { | 870 if (!wifi) { |
| 868 passphrase_label_->SetEnabled(false); | 871 passphrase_label_->SetEnabled(false); |
| 869 passphrase_textfield_->SetEnabled(false); | 872 passphrase_textfield_->SetEnabled(false); |
| 870 } | 873 } |
| 871 passphrase_textfield_->SetAccessibleName(l10n_util::GetStringUTF16( | 874 passphrase_textfield_->SetAccessibleName(l10n_util::GetStringUTF16( |
| 872 label_text_id)); | 875 label_text_id)); |
| 873 layout->AddView(passphrase_textfield_); | 876 layout->AddView(passphrase_textfield_); |
| 874 // Password visible button. | 877 // Password visible button. |
| 875 passphrase_visible_button_ = new views::ImageButton(this); | 878 passphrase_visible_button_ = new views::ToggleImageButton(this); |
| 879 passphrase_visible_button_->SetTooltipText( |
| 880 UTF16ToWide(l10n_util::GetStringUTF16( |
| 881 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE_SHOW))); |
| 882 passphrase_visible_button_->SetToggledTooltipText( |
| 883 UTF16ToWide(l10n_util::GetStringUTF16( |
| 884 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE_HIDE))); |
| 876 passphrase_visible_button_->SetImage( | 885 passphrase_visible_button_->SetImage( |
| 877 views::ImageButton::BS_NORMAL, | 886 views::ImageButton::BS_NORMAL, |
| 878 ResourceBundle::GetSharedInstance(). | 887 ResourceBundle::GetSharedInstance(). |
| 879 GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE)); | 888 GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_OFF)); |
| 889 passphrase_visible_button_->SetImage( |
| 890 views::ImageButton::BS_HOT, |
| 891 ResourceBundle::GetSharedInstance(). |
| 892 GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_HOVER)); |
| 893 passphrase_visible_button_->SetToggledImage( |
| 894 views::ImageButton::BS_NORMAL, |
| 895 ResourceBundle::GetSharedInstance(). |
| 896 GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_ON)); |
| 880 passphrase_visible_button_->SetImageAlignment( | 897 passphrase_visible_button_->SetImageAlignment( |
| 881 views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); | 898 views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); |
| 882 layout->AddView(passphrase_visible_button_); | 899 layout->AddView(passphrase_visible_button_); |
| 883 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 900 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 884 | 901 |
| 885 if (show_8021x) { | 902 if (show_8021x) { |
| 886 // Anonymous identity | 903 // Anonymous identity |
| 887 layout->StartRow(0, column_view_set_id); | 904 layout->StartRow(0, column_view_set_id); |
| 888 identity_anonymous_label_ = | 905 identity_anonymous_label_ = |
| 889 new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( | 906 new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 // Set focus to a reasonable widget, depending on what we're showing. | 1070 // Set focus to a reasonable widget, depending on what we're showing. |
| 1054 if (ssid_textfield_) | 1071 if (ssid_textfield_) |
| 1055 ssid_textfield_->RequestFocus(); | 1072 ssid_textfield_->RequestFocus(); |
| 1056 else if (eap_method_combobox_) | 1073 else if (eap_method_combobox_) |
| 1057 eap_method_combobox_->RequestFocus(); | 1074 eap_method_combobox_->RequestFocus(); |
| 1058 else if (passphrase_textfield_ && passphrase_textfield_->IsEnabled()) | 1075 else if (passphrase_textfield_ && passphrase_textfield_->IsEnabled()) |
| 1059 passphrase_textfield_->RequestFocus(); | 1076 passphrase_textfield_->RequestFocus(); |
| 1060 } | 1077 } |
| 1061 | 1078 |
| 1062 } // namespace chromeos | 1079 } // namespace chromeos |
| OLD | NEW |