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

Unified Diff: chrome/browser/ui/passwords/manage_passwords_bubble_model.cc

Issue 462563002: Add ManagePasswordsBubbleManageViewController and unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix views Created 6 years, 4 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/passwords/manage_passwords_bubble_model.cc
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
index 7b788884ad862b6213da7406130bf65ac092f773..677965f6802d22969f79043f05c99996ea7008cf 100644
--- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
@@ -14,6 +14,7 @@
#include "components/password_manager/core/common/password_manager_ui.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/base/resource/resource_bundle.h"
using autofill::PasswordFormMap;
using content::WebContents;
@@ -21,6 +22,19 @@ namespace metrics_util = password_manager::metrics_util;
namespace {
+enum FieldType { USERNAME_FIELD, PASSWORD_FIELD };
+
+const int kUsernameFieldSize = 30;
+const int kPasswordFieldSize = 22;
+
+// Returns the width of |type| field.
+int GetFieldWidth(FieldType type) {
+ return ui::ResourceBundle::GetSharedInstance()
+ .GetFontList(ui::ResourceBundle::SmallFont)
+ .GetExpectedTextWidth(type == USERNAME_FIELD ? kUsernameFieldSize
+ : kPasswordFieldSize);
+}
+
void SetupLinkifiedText(const base::string16& string_with_separator,
base::string16* text,
gfx::Range* link_range) {
@@ -179,3 +193,13 @@ void ManagePasswordsBubbleModel::OnPasswordAction(
else
password_store->AddLogin(password_form);
}
+
+// static
+int ManagePasswordsBubbleModel::UsernameFieldWidth() {
+ return GetFieldWidth(USERNAME_FIELD);
+}
+
+// static
+int ManagePasswordsBubbleModel::PasswordFieldWidth() {
+ return GetFieldWidth(PASSWORD_FIELD);
+}

Powered by Google App Engine
This is Rietveld 408576698