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); |
+} |