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

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

Issue 152343006: Clean-up: Replaces obsolete Font/FontList methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced. Created 6 years, 10 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
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_result_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
index adb4e014b1422a84f74dc64ccaa02b60cd106aa5..58f4d83e3fb16e72350ebba1bd6a84a8d998d7fb 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
@@ -17,7 +17,7 @@
#include "content/public/browser/web_contents_view.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
-#include "ui/gfx/canvas.h"
+#include "ui/gfx/text_utils.h"
#include "ui/views/controls/button/blue_button.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/layout/grid_layout.h"
@@ -33,14 +33,13 @@ namespace {
void UpdateBiggestWidth(const autofill::PasswordForm& password_form,
bool username,
int* biggest_width) {
- ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
- gfx::FontList font_list(rb->GetFontList(ui::ResourceBundle::BaseFont));
+ const gfx::FontList font_list;
base::string16 display_string(username ?
password_form.username_value :
ManagePasswordItemView::GetPasswordDisplayString(
password_form.password_value));
- *biggest_width = std::max(
- gfx::Canvas::GetStringWidth(display_string, font_list), *biggest_width);
+ *biggest_width = std::max(gfx::GetStringWidth(display_string, font_list),
+ *biggest_width);
}
} // namespace
@@ -163,9 +162,8 @@ void ManagePasswordsBubbleView::Init() {
// bubble. We do not need to clamp the password field width because
// ManagePasswordItemView::GetPasswordFisplayString() does this.
- ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
const int predefined_username_field_max_width =
- rb->GetFont(ui::ResourceBundle::BaseFont).GetAverageCharacterWidth() * 22;
+ gfx::FontList().GetExpectedTextWidth(22);
const int max_username_or_password_width =
std::min(GetMaximumUsernameOrPasswordWidth(true),
predefined_username_field_max_width);
@@ -185,6 +183,7 @@ void ManagePasswordsBubbleView::Init() {
GridLayout::USE_PREF, 0, 0);
column_set->AddPaddingColumn(0, views::kPanelHorizMargin);
+ ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
views::Label* title_label =
new views::Label(manage_passwords_bubble_model_->title());
title_label->SetMultiLine(true);
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_result_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698