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

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: 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 0e1f553edb49d963b6b024bb1db48112df125178..129a58749c083c98329c163cd046fdd9446f8d73 100644
--- a/chrome/browser/ui/views/passwords/manage_password_item_view.cc
+++ b/chrome/browser/ui/views/passwords/manage_password_item_view.cc
@@ -43,7 +43,8 @@ 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(ManagePasswordsBubbleModel::GetPasswordDisplayString(
+ password_form_.password_value));
label_2_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label_2_->set_listener(this);
label_2_->SetFocusable(false);
@@ -103,15 +104,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_);
@@ -148,7 +140,8 @@ void ManagePasswordItemView::Refresh() {
// Set the password string to the appropriate number of bullets, and
// disable the link.
- label_2_->SetText(GetPasswordDisplayString(password_form_.password_value));
+ label_2_->SetText(ManagePasswordsBubbleModel::GetPasswordDisplayString(
+ password_form_.password_value));
label_2_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label_2_->SetEnabled(false);
label_2_->SetFocusable(false);

Powered by Google App Engine
This is Rietveld 408576698