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

Unified Diff: chrome/browser/ui/views/passwords/manage_password_item_view.cc

Issue 221853003: Password bubble: Add a test for displayed password length. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rewrite. Created 6 years, 9 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/passwords/manage_password_item_view.cc
diff --git a/chrome/browser/ui/views/passwords/manage_password_item_view.cc b/chrome/browser/ui/views/passwords/manage_password_item_view.cc
index dbe5fd8e0338394a499e15d9d9b39c29982a1460..054e753bf254fe2e43e153311a827cf76c088480 100644
--- a/chrome/browser/ui/views/passwords/manage_password_item_view.cc
+++ b/chrome/browser/ui/views/passwords/manage_password_item_view.cc
@@ -55,9 +55,10 @@ ManagePasswordItemView::ManagePasswordItemView(
// Add the password field: fills the second non-padding column of the layout.
label_2_ =
- new views::Link(GetPasswordDisplayString(password_form_.password_value));
+ new views::Link(password_form_.password_value);
label_2_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label_2_->set_listener(this);
+ label_2_->SetObscured(true);
label_2_->SetFocusable(false);
label_2_->SetEnabled(false);
label_2_->SetUnderline(false);
@@ -115,15 +116,6 @@ void ManagePasswordItemView::BuildColumnSet(views::GridLayout* layout,
column_set->AddPaddingColumn(0, views::kItemLabelSpacing);
}
-// static
-base::string16 ManagePasswordItemView::GetPasswordDisplayString(
- const base::string16& password) {
- const wchar_t kPasswordBullet = 0x2022;
- const size_t kMaxPasswordChar = 22;
- return base::string16(std::min(password.length(), kMaxPasswordChar),
- kPasswordBullet);
-}
-
ManagePasswordItemView::~ManagePasswordItemView() {
if (delete_password_)
manage_passwords_bubble_model_->DeleteFromBestMatches(password_form_);
@@ -143,6 +135,7 @@ void ManagePasswordItemView::Refresh() {
// Change the password's text to "Undo", and enable the link.
label_2_->SetText(l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_UNDO));
label_2_->SetHorizontalAlignment(gfx::ALIGN_RIGHT);
+ label_2_->SetObscured(false);
label_2_->SetEnabled(true);
label_2_->SetFocusable(true);
@@ -158,12 +151,13 @@ void ManagePasswordItemView::Refresh() {
// Change the username string back to the username.
label_1_->SetText(password_form_.username_value);
- // Set the password string to the appropriate number of bullets, and
+ // Change the second column back to the password, obscure and disable it.
// disable the link.
- label_2_->SetText(GetPasswordDisplayString(password_form_.password_value));
- label_2_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
+ label_2_->SetObscured(true);
label_2_->SetEnabled(false);
label_2_->SetFocusable(false);
+ label_2_->SetText(password_form_.password_value);
+ label_2_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
if (delete_button_)
delete_button_->SetVisible(true);

Powered by Google App Engine
This is Rietveld 408576698