Commit 15962b83 authored by sschmitz@chromium.org's avatar sschmitz@chromium.org

Adjust fonts (part of 137349): use standard font sizes in chrome/browser/ui/views

Part of work to use standard font sizes instead of "DeriveFont +/- N Pixels". Also per direction of designers and PM to move to Medium non-bold instead of "offsize" bold font for titles and headers.
Changed UIs were seen and ok-ed by either sgabriel@ or kuscher@.

Please see crbug.com/166679 for details and screenshots

BUG=166679, 137349
TEST=manual
for sad tab: navigate to chrome://crash
for password generation bubble: run with flag --enable-password-generation, navigate to www.target.com and begin to create an account, click on password text box
for global error bubble: I modified code in browser.cc to force an error
for extension: Chrome Web Store -> Extensitons -> Click on ADD TO CHROME


Review URL: https://chromiumcodereview.appspot.com/11698005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175468 0039d316-1c4b-4281-b951-d872f2087c98
parent 0be0993c
......@@ -32,9 +32,6 @@ const int kColumnSetId = 0;
// The width of the left column.
const int kLeftColumnWidth = 325;
// Heading font size correction.
const int kHeadingFontSizeDelta = 1;
class BundleInstalledBubble : public views::BubbleDelegateView,
public views::ButtonListener {
public:
......@@ -136,10 +133,8 @@ class BundleInstalledBubble : public views::BubbleDelegateView,
void AddHeading(GridLayout* layout, const string16& heading) {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
gfx::Font bold_font = rb.GetFont(ui::ResourceBundle::BaseFont).DeriveFont(
kHeadingFontSizeDelta, gfx::Font::BOLD);
views::Label* heading_label = new views::Label(heading, bold_font);
views::Label* heading_label = new views::Label(
heading, rb.GetFont(ui::ResourceBundle::MediumFont));
heading_label->SetMultiLine(true);
heading_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
heading_label->SizeToFit(kLeftColumnWidth);
......
......@@ -71,11 +71,6 @@ const int kBundleLeftColumnWidth = 300;
// this case, so make it wider than normal.
const int kExternalInstallLeftColumnWidth = 350;
// Heading font size correction.
const int kHeadingFontSizeDelta = 1;
const int kRatingFontSizeDelta = -1;
void AddResourceIcon(const gfx::ImageSkia* skia_image, void* data) {
views::View* parent = static_cast<views::View*>(data);
views::ImageView* image_view = new views::ImageView();
......@@ -351,9 +346,10 @@ ExtensionInstallDialogView::ExtensionInstallDialogView(
layout->StartRow(0, column_set_id);
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
views::Label* heading = new views::Label(prompt.GetHeading());
heading->SetFont(heading->font().DeriveFont(kHeadingFontSizeDelta,
gfx::Font::BOLD));
heading->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont));
heading->SetMultiLine(true);
heading->SetHorizontalAlignment(gfx::ALIGN_LEFT);
heading->SizeToFit(left_column_width);
......@@ -395,8 +391,7 @@ ExtensionInstallDialogView::ExtensionInstallDialogView(
prompt.AppendRatingStars(AddResourceIcon, rating);
views::Label* rating_count = new views::Label(prompt.GetRatingCount());
rating_count->SetFont(
rating_count->font().DeriveFont(kRatingFontSizeDelta));
rating_count->SetFont(rb.GetFont(ui::ResourceBundle::SmallFont));
// Add some space between the stars and the rating count.
rating_count->set_border(views::Border::CreateEmptyBorder(0, 2, 0, 0));
rating->AddChildView(rating_count);
......@@ -405,13 +400,13 @@ ExtensionInstallDialogView::ExtensionInstallDialogView(
views::Label* user_count = new views::Label(prompt.GetUserCount());
user_count->SetAutoColorReadabilityEnabled(false);
user_count->SetEnabledColor(SK_ColorGRAY);
user_count->SetFont(user_count->font().DeriveFont(kRatingFontSizeDelta));
user_count->SetFont(rb.GetFont(ui::ResourceBundle::SmallFont));
layout->AddView(user_count);
layout->StartRow(0, column_set_id);
views::Link* store_link = new views::Link(
l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_STORE_LINK));
store_link->SetFont(store_link->font().DeriveFont(kRatingFontSizeDelta));
store_link->SetFont(rb.GetFont(ui::ResourceBundle::SmallFont));
store_link->set_listener(this);
layout->AddView(store_link);
}
......@@ -446,13 +441,12 @@ ExtensionInstallDialogView::ExtensionInstallDialogView(
layout->StartRow(0, column_set_id);
views::Label* permissions_header = NULL;
if (is_bundle_install()) {
// We need to make the font bold like this, rather than using SetFont,
// because otherwise SizeToFit mis-judges the width of the line.
gfx::Font bold_font = ui::ResourceBundle::GetSharedInstance().GetFont(
ui::ResourceBundle::BaseFont).DeriveFont(
kHeadingFontSizeDelta, gfx::Font::BOLD);
// We need to pass the Font in the constructor, rather than calling
// SetFont later, because otherwise SizeToFit mis-judges the width
// of the line.
permissions_header = new views::Label(
prompt.GetPermissionsHeading(), bold_font);
prompt.GetPermissionsHeading(),
rb.GetFont(ui::ResourceBundle::MediumFont));
} else {
permissions_header = new views::Label(prompt.GetPermissionsHeading());
}
......@@ -524,7 +518,7 @@ ExtensionInstallDialogView::ExtensionInstallDialogView(
app_launcher_opt_in_checkbox_ = new views::Checkbox(
l10n_util::GetStringUTF16(IDS_APP_LIST_OPT_IN_TEXT));
app_launcher_opt_in_checkbox_->SetFont(
app_launcher_opt_in_checkbox_->font().DeriveFont(0, gfx::Font::BOLD));
rb.GetFont(ui::ResourceBundle::BoldFont));
layout->AddView(app_launcher_opt_in_checkbox_);
}
}
......
......@@ -8,6 +8,7 @@
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/button/text_button.h"
#include "ui/views/controls/label.h"
......@@ -23,13 +24,6 @@ namespace chrome {
typedef MediaGalleriesDialogController::KnownGalleryPermissions
GalleryPermissions;
namespace {
// Heading font size correction.
const int kHeadingFontSizeDelta = 1;
} // namespace
MediaGalleriesDialogViews::MediaGalleriesDialogViews(
MediaGalleriesDialogController* controller)
: controller_(controller),
......@@ -67,8 +61,8 @@ void MediaGalleriesDialogViews::InitChildViews() {
// Header text.
views::Label* header = new views::Label(controller_->GetHeader());
header->SetFont(header->font().DeriveFont(kHeadingFontSizeDelta,
gfx::Font::BOLD));
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
header->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont));
header->SetHorizontalAlignment(gfx::ALIGN_LEFT);
layout->StartRow(0, column_set_id);
layout->AddView(header);
......
......@@ -78,7 +78,7 @@ GlobalErrorBubbleView::GlobalErrorBubbleView(
scoped_ptr<views::Label> title_label(new views::Label(title_string));
title_label->SetMultiLine(true);
title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
title_label->SetFont(title_label->font().DeriveFont(1));
title_label->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont));
string16 message_string(error_->GetBubbleViewMessage());
views::Label* message_label = new views::Label(message_string);
......
......@@ -35,7 +35,7 @@ const int kBubbleMargin = 9;
const int kButtonHorizontalSpacing = 4;
const int kButtonWidth = 65;
const int kDefaultTextFieldChars = 18;
const int kTitleLabelVerticalOffset = -3;
const int kTitleLabelVerticalOffset = -1;
const int kVerticalPadding = 8;
// Constants for Text fieldWrapper.
......@@ -148,11 +148,9 @@ void PasswordGenerationBubbleView::Init() {
// TODO(gcasto): Localize text after we have finalized the UI.
// crbug.com/118062.
gfx::Font label_font =
ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont);
label_font = label_font.DeriveFont(2);
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
title_label_ = new views::Label(ASCIIToUTF16("Password Suggestion"),
label_font);
rb.GetFont(ui::ResourceBundle::MediumFont));
AddChildView(title_label_);
regenerate_button_ = new views::ImageButton(this);
......@@ -167,10 +165,6 @@ void PasswordGenerationBubbleView::Init() {
theme_provider_->GetImageSkiaNamed(IDR_RELOAD));
textfield_ = new views::Textfield();
gfx::Font textfield_font =
ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont);
textfield_font = textfield_font.DeriveFont(2, gfx::Font::BOLD);
textfield_->SetFont(textfield_font);
textfield_->set_default_width_in_chars(kDefaultTextFieldChars);
textfield_->SetText(ASCIIToUTF16(password_generator_->Generate()));
......
......@@ -20,7 +20,6 @@
#include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/font.h"
#include "ui/views/controls/button/text_button.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
......@@ -40,10 +39,6 @@ const SkColor kKillColor = SkColorSetRGB(57, 48, 88);
const char kCategoryTagCrash[] = "Crash";
// Font size correction.
const int kTitleFontSizeDelta = 2;
const int kMessageFontSizeDelta = 1;
// Name of the experiment to run.
const char kExperiment[] = "LowMemoryMargin";
......@@ -62,8 +57,6 @@ SadTabView::SadTabView(WebContents* web_contents, chrome::SadTabKind kind)
: web_contents_(web_contents),
kind_(kind),
painted_(false),
base_font_(ui::ResourceBundle::GetSharedInstance().GetFont(
ui::ResourceBundle::BaseFont)),
message_(NULL),
help_link_(NULL),
feedback_link_(NULL),
......@@ -161,7 +154,8 @@ void SadTabView::ViewHierarchyChanged(bool is_add,
views::Label* title = CreateLabel(l10n_util::GetStringUTF16(
(kind_ == chrome::SAD_TAB_KIND_CRASHED) ?
IDS_SAD_TAB_TITLE : IDS_KILLED_TAB_TITLE));
title->SetFont(base_font_.DeriveFont(kTitleFontSizeDelta, gfx::Font::BOLD));
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
title->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont));
layout->StartRowWithPadding(0, column_set_id, 0, kPadding);
layout->AddView(title);
......@@ -251,7 +245,6 @@ void SadTabView::OnPaint(gfx::Canvas* canvas) {
views::Label* SadTabView::CreateLabel(const string16& text) {
views::Label* label = new views::Label(text);
label->SetFont(base_font_.DeriveFont(kMessageFontSizeDelta));
label->SetBackgroundColor(background()->get_color());
label->SetEnabledColor(kTextColor);
return label;
......@@ -259,7 +252,6 @@ views::Label* SadTabView::CreateLabel(const string16& text) {
views::Link* SadTabView::CreateLink(const string16& text) {
views::Link* link = new views::Link(text);
link->SetFont(base_font_.DeriveFont(kMessageFontSizeDelta));
link->SetBackgroundColor(background()->get_color());
link->SetEnabledColor(kTextColor);
link->set_listener(this);
......
......@@ -16,10 +16,6 @@ namespace content {
class WebContents;
}
namespace gfx {
class Font;
}
namespace views {
class Label;
class TextButton;
......@@ -64,7 +60,6 @@ class SadTabView : public views::View,
content::WebContents* web_contents_;
chrome::SadTabKind kind_;
bool painted_;
const gfx::Font& base_font_;
views::Label* message_;
views::Link* help_link_;
views::Link* feedback_link_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment