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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 const ui::KeyEvent& key_event) { | 604 const ui::KeyEvent& key_event) { |
605 if (sender == passphrase_textfield_ && | 605 if (sender == passphrase_textfield_ && |
606 key_event.key_code() == ui::VKEY_RETURN) { | 606 key_event.key_code() == ui::VKEY_RETURN) { |
607 parent_->GetDialogClientView()->AcceptWindow(); | 607 parent_->GetDialogClientView()->AcceptWindow(); |
608 } | 608 } |
609 return false; | 609 return false; |
610 } | 610 } |
611 | 611 |
612 void WifiConfigView::ButtonPressed(views::Button* sender, | 612 void WifiConfigView::ButtonPressed(views::Button* sender, |
613 const ui::Event& event) { | 613 const ui::Event& event) { |
614 if (sender == passphrase_visible_button_) { | 614 if (sender == passphrase_visible_button_ && passphrase_textfield_) { |
615 if (passphrase_textfield_) { | 615 if (passphrase_textfield_->GetTextInputType() == ui::TEXT_INPUT_TYPE_TEXT) { |
616 passphrase_textfield_->SetObscured(!passphrase_textfield_->IsObscured()); | 616 passphrase_textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); |
617 passphrase_visible_button_->SetToggled( | 617 passphrase_visible_button_->SetToggled(false); |
618 !passphrase_textfield_->IsObscured()); | 618 } else { |
| 619 passphrase_textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_TEXT); |
| 620 passphrase_visible_button_->SetToggled(true); |
619 } | 621 } |
620 } else { | 622 } else { |
621 NOTREACHED(); | 623 NOTREACHED(); |
622 } | 624 } |
623 } | 625 } |
624 | 626 |
625 void WifiConfigView::OnSelectedIndexChanged(views::Combobox* combobox) { | 627 void WifiConfigView::OnSelectedIndexChanged(views::Combobox* combobox) { |
626 if (combobox == security_combobox_) { | 628 if (combobox == security_combobox_) { |
627 bool passphrase_enabled = PassphraseActive(); | 629 bool passphrase_enabled = PassphraseActive(); |
628 passphrase_label_->SetEnabled(passphrase_enabled); | 630 passphrase_label_->SetEnabled(passphrase_enabled); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing); | 931 column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing); |
930 // Password visible button / policy indicator. | 932 // Password visible button / policy indicator. |
931 column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 1, | 933 column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 1, |
932 views::GridLayout::USE_PREF, 0, kPasswordVisibleWidth); | 934 views::GridLayout::USE_PREF, 0, kPasswordVisibleWidth); |
933 | 935 |
934 // SSID input | 936 // SSID input |
935 layout->StartRow(0, column_view_set_id); | 937 layout->StartRow(0, column_view_set_id); |
936 layout->AddView(new views::Label(l10n_util::GetStringUTF16( | 938 layout->AddView(new views::Label(l10n_util::GetStringUTF16( |
937 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID))); | 939 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID))); |
938 if (!wifi) { | 940 if (!wifi) { |
939 ssid_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); | 941 ssid_textfield_ = new views::Textfield(); |
940 ssid_textfield_->SetController(this); | 942 ssid_textfield_->set_controller(this); |
941 ssid_textfield_->SetAccessibleName(l10n_util::GetStringUTF16( | 943 ssid_textfield_->SetAccessibleName(l10n_util::GetStringUTF16( |
942 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID)); | 944 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID)); |
943 layout->AddView(ssid_textfield_); | 945 layout->AddView(ssid_textfield_); |
944 } else { | 946 } else { |
945 views::Label* label = new views::Label(base::UTF8ToUTF16(wifi->name())); | 947 views::Label* label = new views::Label(base::UTF8ToUTF16(wifi->name())); |
946 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 948 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
947 layout->AddView(label); | 949 layout->AddView(label); |
948 } | 950 } |
949 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 951 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
950 | 952 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 layout->AddView( | 1021 layout->AddView( |
1020 new ControlledSettingIndicatorView(server_ca_cert_ui_data_)); | 1022 new ControlledSettingIndicatorView(server_ca_cert_ui_data_)); |
1021 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 1023 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
1022 | 1024 |
1023 // Subject Match | 1025 // Subject Match |
1024 layout->StartRow(0, column_view_set_id); | 1026 layout->StartRow(0, column_view_set_id); |
1025 base::string16 subject_match_label_text = l10n_util::GetStringUTF16( | 1027 base::string16 subject_match_label_text = l10n_util::GetStringUTF16( |
1026 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_SUBJECT_MATCH); | 1028 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_SUBJECT_MATCH); |
1027 subject_match_label_ = new views::Label(subject_match_label_text); | 1029 subject_match_label_ = new views::Label(subject_match_label_text); |
1028 layout->AddView(subject_match_label_); | 1030 layout->AddView(subject_match_label_); |
1029 subject_match_textfield_ = | 1031 subject_match_textfield_ = new views::Textfield(); |
1030 new views::Textfield(views::Textfield::STYLE_DEFAULT); | |
1031 subject_match_textfield_->SetAccessibleName(subject_match_label_text); | 1032 subject_match_textfield_->SetAccessibleName(subject_match_label_text); |
1032 subject_match_textfield_->SetController(this); | 1033 subject_match_textfield_->set_controller(this); |
1033 layout->AddView(subject_match_textfield_); | 1034 layout->AddView(subject_match_textfield_); |
1034 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 1035 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
1035 | 1036 |
1036 // User certificate | 1037 // User certificate |
1037 layout->StartRow(0, column_view_set_id); | 1038 layout->StartRow(0, column_view_set_id); |
1038 base::string16 user_cert_label_text = l10n_util::GetStringUTF16( | 1039 base::string16 user_cert_label_text = l10n_util::GetStringUTF16( |
1039 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT); | 1040 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT); |
1040 user_cert_label_ = new views::Label(user_cert_label_text); | 1041 user_cert_label_ = new views::Label(user_cert_label_text); |
1041 layout->AddView(user_cert_label_); | 1042 layout->AddView(user_cert_label_); |
1042 user_cert_combobox_model_.reset(new internal::UserCertComboboxModel(this)); | 1043 user_cert_combobox_model_.reset(new internal::UserCertComboboxModel(this)); |
1043 user_cert_combobox_ = new views::Combobox(user_cert_combobox_model_.get()); | 1044 user_cert_combobox_ = new views::Combobox(user_cert_combobox_model_.get()); |
1044 user_cert_combobox_->SetAccessibleName(user_cert_label_text); | 1045 user_cert_combobox_->SetAccessibleName(user_cert_label_text); |
1045 user_cert_label_->SetEnabled(false); | 1046 user_cert_label_->SetEnabled(false); |
1046 user_cert_combobox_->SetEnabled(false); | 1047 user_cert_combobox_->SetEnabled(false); |
1047 user_cert_combobox_->set_listener(this); | 1048 user_cert_combobox_->set_listener(this); |
1048 layout->AddView(user_cert_combobox_); | 1049 layout->AddView(user_cert_combobox_); |
1049 layout->AddView(new ControlledSettingIndicatorView(user_cert_ui_data_)); | 1050 layout->AddView(new ControlledSettingIndicatorView(user_cert_ui_data_)); |
1050 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 1051 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
1051 | 1052 |
1052 // Identity | 1053 // Identity |
1053 layout->StartRow(0, column_view_set_id); | 1054 layout->StartRow(0, column_view_set_id); |
1054 base::string16 identity_label_text = l10n_util::GetStringUTF16( | 1055 base::string16 identity_label_text = l10n_util::GetStringUTF16( |
1055 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY); | 1056 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY); |
1056 identity_label_ = new views::Label(identity_label_text); | 1057 identity_label_ = new views::Label(identity_label_text); |
1057 layout->AddView(identity_label_); | 1058 layout->AddView(identity_label_); |
1058 identity_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); | 1059 identity_textfield_ = new views::Textfield(); |
1059 identity_textfield_->SetAccessibleName(identity_label_text); | 1060 identity_textfield_->SetAccessibleName(identity_label_text); |
1060 identity_textfield_->SetController(this); | 1061 identity_textfield_->set_controller(this); |
1061 identity_textfield_->SetEnabled(identity_ui_data_.IsEditable()); | 1062 identity_textfield_->SetEnabled(identity_ui_data_.IsEditable()); |
1062 layout->AddView(identity_textfield_); | 1063 layout->AddView(identity_textfield_); |
1063 layout->AddView(new ControlledSettingIndicatorView(identity_ui_data_)); | 1064 layout->AddView(new ControlledSettingIndicatorView(identity_ui_data_)); |
1064 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 1065 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
1065 } | 1066 } |
1066 | 1067 |
1067 // Passphrase input | 1068 // Passphrase input |
1068 layout->StartRow(0, column_view_set_id); | 1069 layout->StartRow(0, column_view_set_id); |
1069 int label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE; | 1070 int label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE; |
1070 base::string16 passphrase_label_text = | 1071 base::string16 passphrase_label_text = |
1071 l10n_util::GetStringUTF16(label_text_id); | 1072 l10n_util::GetStringUTF16(label_text_id); |
1072 passphrase_label_ = new views::Label(passphrase_label_text); | 1073 passphrase_label_ = new views::Label(passphrase_label_text); |
1073 layout->AddView(passphrase_label_); | 1074 layout->AddView(passphrase_label_); |
1074 passphrase_textfield_ = new PassphraseTextfield(); | 1075 passphrase_textfield_ = new PassphraseTextfield(); |
1075 passphrase_textfield_->SetController(this); | 1076 passphrase_textfield_->set_controller(this); |
1076 // Disable passphrase input initially for other network. | 1077 // Disable passphrase input initially for other network. |
1077 passphrase_label_->SetEnabled(wifi); | 1078 passphrase_label_->SetEnabled(wifi); |
1078 passphrase_textfield_->SetEnabled(wifi && passphrase_ui_data_.IsEditable()); | 1079 passphrase_textfield_->SetEnabled(wifi && passphrase_ui_data_.IsEditable()); |
1079 passphrase_textfield_->SetAccessibleName(passphrase_label_text); | 1080 passphrase_textfield_->SetAccessibleName(passphrase_label_text); |
1080 layout->AddView(passphrase_textfield_); | 1081 layout->AddView(passphrase_textfield_); |
1081 | 1082 |
1082 if (passphrase_ui_data_.IsManaged()) { | 1083 if (passphrase_ui_data_.IsManaged()) { |
1083 layout->AddView(new ControlledSettingIndicatorView(passphrase_ui_data_)); | 1084 layout->AddView(new ControlledSettingIndicatorView(passphrase_ui_data_)); |
1084 } else { | 1085 } else { |
1085 // Password visible button. | 1086 // Password visible button. |
(...skipping 28 matching lines...) Expand all Loading... |
1114 | 1115 |
1115 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 1116 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
1116 | 1117 |
1117 if (show_8021x) { | 1118 if (show_8021x) { |
1118 // Anonymous identity | 1119 // Anonymous identity |
1119 layout->StartRow(0, column_view_set_id); | 1120 layout->StartRow(0, column_view_set_id); |
1120 identity_anonymous_label_ = | 1121 identity_anonymous_label_ = |
1121 new views::Label(l10n_util::GetStringUTF16( | 1122 new views::Label(l10n_util::GetStringUTF16( |
1122 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY_ANONYMOUS)); | 1123 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY_ANONYMOUS)); |
1123 layout->AddView(identity_anonymous_label_); | 1124 layout->AddView(identity_anonymous_label_); |
1124 identity_anonymous_textfield_ = new views::Textfield( | 1125 identity_anonymous_textfield_ = new views::Textfield(); |
1125 views::Textfield::STYLE_DEFAULT); | |
1126 identity_anonymous_label_->SetEnabled(false); | 1126 identity_anonymous_label_->SetEnabled(false); |
1127 identity_anonymous_textfield_->SetEnabled(false); | 1127 identity_anonymous_textfield_->SetEnabled(false); |
1128 identity_anonymous_textfield_->SetController(this); | 1128 identity_anonymous_textfield_->set_controller(this); |
1129 layout->AddView(identity_anonymous_textfield_); | 1129 layout->AddView(identity_anonymous_textfield_); |
1130 layout->AddView( | 1130 layout->AddView( |
1131 new ControlledSettingIndicatorView(identity_anonymous_ui_data_)); | 1131 new ControlledSettingIndicatorView(identity_anonymous_ui_data_)); |
1132 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 1132 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
1133 } | 1133 } |
1134 | 1134 |
1135 // Checkboxes. | 1135 // Checkboxes. |
1136 | 1136 |
1137 // Save credentials | 1137 // Save credentials |
1138 if (show_8021x) { | 1138 if (show_8021x) { |
(...skipping 208 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 |