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/wimax_config_view.h" | 5 #include "chrome/browser/chromeos/options/wimax_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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 const ui::KeyEvent& key_event) { | 122 const ui::KeyEvent& key_event) { |
123 if (sender == passphrase_textfield_ && | 123 if (sender == passphrase_textfield_ && |
124 key_event.key_code() == ui::VKEY_RETURN) { | 124 key_event.key_code() == ui::VKEY_RETURN) { |
125 parent_->GetDialogClientView()->AcceptWindow(); | 125 parent_->GetDialogClientView()->AcceptWindow(); |
126 } | 126 } |
127 return false; | 127 return false; |
128 } | 128 } |
129 | 129 |
130 void WimaxConfigView::ButtonPressed(views::Button* sender, | 130 void WimaxConfigView::ButtonPressed(views::Button* sender, |
131 const ui::Event& event) { | 131 const ui::Event& event) { |
132 if (sender == passphrase_visible_button_) { | 132 if (sender == passphrase_visible_button_ && passphrase_textfield_) { |
133 if (passphrase_textfield_) { | 133 if (passphrase_textfield_->GetTextInputType() == ui::TEXT_INPUT_TYPE_TEXT) { |
134 passphrase_textfield_->SetObscured(!passphrase_textfield_->IsObscured()); | 134 passphrase_textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); |
135 passphrase_visible_button_->SetToggled( | 135 passphrase_visible_button_->SetToggled(false); |
136 !passphrase_textfield_->IsObscured()); | 136 } else { |
| 137 passphrase_textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_TEXT); |
| 138 passphrase_visible_button_->SetToggled(true); |
137 } | 139 } |
138 } else { | 140 } else { |
139 NOTREACHED(); | 141 NOTREACHED(); |
140 } | 142 } |
141 } | 143 } |
142 | 144 |
143 bool WimaxConfigView::Login() { | 145 bool WimaxConfigView::Login() { |
144 const NetworkState* wimax = NetworkHandler::Get()->network_state_handler()-> | 146 const NetworkState* wimax = NetworkHandler::Get()->network_state_handler()-> |
145 GetNetworkState(service_path_); | 147 GetNetworkState(service_path_); |
146 if (!wimax) { | 148 if (!wimax) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 240 |
239 // Identity | 241 // Identity |
240 layout->StartRow(0, column_view_set_id); | 242 layout->StartRow(0, column_view_set_id); |
241 base::string16 identity_label_text = l10n_util::GetStringUTF16( | 243 base::string16 identity_label_text = l10n_util::GetStringUTF16( |
242 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY); | 244 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY); |
243 identity_label_ = new views::Label(identity_label_text); | 245 identity_label_ = new views::Label(identity_label_text); |
244 layout->AddView(identity_label_); | 246 layout->AddView(identity_label_); |
245 identity_textfield_ = new views::Textfield( | 247 identity_textfield_ = new views::Textfield( |
246 views::Textfield::STYLE_DEFAULT); | 248 views::Textfield::STYLE_DEFAULT); |
247 identity_textfield_->SetAccessibleName(identity_label_text); | 249 identity_textfield_->SetAccessibleName(identity_label_text); |
248 identity_textfield_->SetController(this); | 250 identity_textfield_->set_controller(this); |
249 identity_textfield_->SetEnabled(identity_ui_data_.IsEditable()); | 251 identity_textfield_->SetEnabled(identity_ui_data_.IsEditable()); |
250 layout->AddView(identity_textfield_); | 252 layout->AddView(identity_textfield_); |
251 layout->AddView(new ControlledSettingIndicatorView(identity_ui_data_)); | 253 layout->AddView(new ControlledSettingIndicatorView(identity_ui_data_)); |
252 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 254 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
253 | 255 |
254 // Passphrase input | 256 // Passphrase input |
255 layout->StartRow(0, column_view_set_id); | 257 layout->StartRow(0, column_view_set_id); |
256 base::string16 passphrase_label_text = l10n_util::GetStringUTF16( | 258 base::string16 passphrase_label_text = l10n_util::GetStringUTF16( |
257 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE); | 259 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE); |
258 passphrase_label_ = new views::Label(passphrase_label_text); | 260 passphrase_label_ = new views::Label(passphrase_label_text); |
259 layout->AddView(passphrase_label_); | 261 layout->AddView(passphrase_label_); |
260 passphrase_textfield_ = new views::Textfield( | 262 passphrase_textfield_ = new views::Textfield(); |
261 views::Textfield::STYLE_OBSCURED); | 263 passphrase_textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); |
262 passphrase_textfield_->SetController(this); | 264 passphrase_textfield_->set_controller(this); |
263 passphrase_label_->SetEnabled(true); | 265 passphrase_label_->SetEnabled(true); |
264 passphrase_textfield_->SetEnabled(passphrase_ui_data_.IsEditable()); | 266 passphrase_textfield_->SetEnabled(passphrase_ui_data_.IsEditable()); |
265 passphrase_textfield_->SetAccessibleName(passphrase_label_text); | 267 passphrase_textfield_->SetAccessibleName(passphrase_label_text); |
266 layout->AddView(passphrase_textfield_); | 268 layout->AddView(passphrase_textfield_); |
267 | 269 |
268 if (passphrase_ui_data_.IsManaged()) { | 270 if (passphrase_ui_data_.IsManaged()) { |
269 layout->AddView(new ControlledSettingIndicatorView(passphrase_ui_data_)); | 271 layout->AddView(new ControlledSettingIndicatorView(passphrase_ui_data_)); |
270 } else { | 272 } else { |
271 // Password visible button. | 273 // Password visible button. |
272 passphrase_visible_button_ = new views::ToggleImageButton(this); | 274 passphrase_visible_button_ = new views::ToggleImageButton(this); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 } | 374 } |
373 } | 375 } |
374 | 376 |
375 void WimaxConfigView::InitFocus() { | 377 void WimaxConfigView::InitFocus() { |
376 views::View* view_to_focus = GetInitiallyFocusedView(); | 378 views::View* view_to_focus = GetInitiallyFocusedView(); |
377 if (view_to_focus) | 379 if (view_to_focus) |
378 view_to_focus->RequestFocus(); | 380 view_to_focus->RequestFocus(); |
379 } | 381 } |
380 | 382 |
381 } // namespace chromeos | 383 } // namespace chromeos |
OLD | NEW |