Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(625)

Side by Side Diff: chrome/browser/chromeos/options/vpn_config_view.cc

Issue 8748001: Make text input type and password visibility bit independent in Textfield (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Textfield(STYLE_OBSCURED) sets TEXT_INPUT_TYPE_PASSWORD Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/vpn_config_view.h" 5 #include "chrome/browser/chromeos/options/vpn_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/common/net/x509_certificate_model.h" 10 #include "chrome/common/net/x509_certificate_model.h"
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 } 477 }
478 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 478 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
479 479
480 // PSK passphrase label, input and visible button. 480 // PSK passphrase label, input and visible button.
481 if (enable_psk_passphrase_) { 481 if (enable_psk_passphrase_) {
482 layout->StartRow(0, column_view_set_id); 482 layout->StartRow(0, column_view_set_id);
483 psk_passphrase_label_ = new views::Label(l10n_util::GetStringUTF16( 483 psk_passphrase_label_ = new views::Label(l10n_util::GetStringUTF16(
484 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PSK_PASSPHRASE)); 484 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PSK_PASSPHRASE));
485 layout->AddView(psk_passphrase_label_); 485 layout->AddView(psk_passphrase_label_);
486 psk_passphrase_textfield_ = new views::Textfield( 486 psk_passphrase_textfield_ = new views::Textfield(
487 views::Textfield::STYLE_PASSWORD); 487 views::Textfield::STYLE_OBSCURED);
488 psk_passphrase_textfield_->SetController(this); 488 psk_passphrase_textfield_->SetController(this);
489 if (vpn && !vpn->psk_passphrase().empty()) 489 if (vpn && !vpn->psk_passphrase().empty())
490 psk_passphrase_textfield_->SetText(UTF8ToUTF16(vpn->psk_passphrase())); 490 psk_passphrase_textfield_->SetText(UTF8ToUTF16(vpn->psk_passphrase()));
491 layout->AddView(psk_passphrase_textfield_); 491 layout->AddView(psk_passphrase_textfield_);
492 layout->AddView( 492 layout->AddView(
493 new ControlledSettingIndicatorView(psk_passphrase_ui_data_)); 493 new ControlledSettingIndicatorView(psk_passphrase_ui_data_));
494 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 494 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
495 } else { 495 } else {
496 psk_passphrase_label_ = NULL; 496 psk_passphrase_label_ = NULL;
497 psk_passphrase_textfield_ = NULL; 497 psk_passphrase_textfield_ = NULL;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 username_textfield_->SetText(UTF8ToUTF16(vpn->username())); 545 username_textfield_->SetText(UTF8ToUTF16(vpn->username()));
546 layout->AddView(username_textfield_); 546 layout->AddView(username_textfield_);
547 layout->AddView(new ControlledSettingIndicatorView(username_ui_data_)); 547 layout->AddView(new ControlledSettingIndicatorView(username_ui_data_));
548 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 548 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
549 549
550 // User passphrase label, input and visble button. 550 // User passphrase label, input and visble button.
551 layout->StartRow(0, column_view_set_id); 551 layout->StartRow(0, column_view_set_id);
552 layout->AddView(new views::Label(l10n_util::GetStringUTF16( 552 layout->AddView(new views::Label(l10n_util::GetStringUTF16(
553 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USER_PASSPHRASE))); 553 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USER_PASSPHRASE)));
554 user_passphrase_textfield_ = new views::Textfield( 554 user_passphrase_textfield_ = new views::Textfield(
555 views::Textfield::STYLE_PASSWORD); 555 views::Textfield::STYLE_OBSCURED);
556 user_passphrase_textfield_->SetController(this); 556 user_passphrase_textfield_->SetController(this);
557 user_passphrase_textfield_->SetEnabled(user_passphrase_ui_data_.editable()); 557 user_passphrase_textfield_->SetEnabled(user_passphrase_ui_data_.editable());
558 if (vpn && !vpn->user_passphrase().empty()) 558 if (vpn && !vpn->user_passphrase().empty())
559 user_passphrase_textfield_->SetText(UTF8ToUTF16(vpn->user_passphrase())); 559 user_passphrase_textfield_->SetText(UTF8ToUTF16(vpn->user_passphrase()));
560 layout->AddView(user_passphrase_textfield_); 560 layout->AddView(user_passphrase_textfield_);
561 layout->AddView(new ControlledSettingIndicatorView(user_passphrase_ui_data_)); 561 layout->AddView(new ControlledSettingIndicatorView(user_passphrase_ui_data_));
562 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 562 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
563 563
564 // OTP label and input. 564 // OTP label and input.
565 if (enable_otp_) { 565 if (enable_otp_) {
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 return std::string(); 782 return std::string();
783 std::string untrimmed = UTF16ToUTF8(textfield->text()); 783 std::string untrimmed = UTF16ToUTF8(textfield->text());
784 if (!trim_whitespace) 784 if (!trim_whitespace)
785 return untrimmed; 785 return untrimmed;
786 std::string result; 786 std::string result;
787 TrimWhitespaceASCII(untrimmed, TRIM_ALL, &result); 787 TrimWhitespaceASCII(untrimmed, TRIM_ALL, &result);
788 return result; 788 return result;
789 } 789 }
790 790
791 } // namespace chromeos 791 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698