summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authoryukishiino@chromium.org <yukishiino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-26 16:50:27 +0000
committeryukishiino@chromium.org <yukishiino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-26 16:50:27 +0000
commiteb480623bd4d7c98ce7527835a098c62413867a2 (patch)
treecfdda9b173f29e7b91811d1afb6f10db8b922cb1 /ash
parent13887217612069e2db97fec335f53137ccaad8d3 (diff)
downloadchromium_src-eb480623bd4d7c98ce7527835a098c62413867a2.zip
chromium_src-eb480623bd4d7c98ce7527835a098c62413867a2.tar.gz
chromium_src-eb480623bd4d7c98ce7527835a098c62413867a2.tar.bz2
Clean-up: Replaces gfx::Font with gfx::FontList in ash/.
As part of effort to support multiple fonts, this CL changes methods which are now taking gfx::Font so they will take gfx::FontList instead. See https://docs.google.com/a/chromium.org/document/d/1D_25fp9B8b9aZJORfAjDIFq61NWvUquZ5xmKH-VcC4k/view BUG=265485 TEST=Run unit_tests, ui_unittests, views_unittests, ash_unittests. Review URL: https://codereview.chromium.org/110953006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242535 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/accelerators/exit_warning_handler.cc13
-rw-r--r--ash/popup_message.cc3
-rw-r--r--ash/system/chromeos/audio/tray_audio.cc4
-rw-r--r--ash/system/chromeos/network/network_state_list_detailed_view.cc2
-rw-r--r--ash/system/chromeos/network/tray_sms.cc5
-rw-r--r--ash/system/date/date_view.cc4
-rw-r--r--ash/system/logout_button/logout_button_tray.cc5
-rw-r--r--ash/system/monitor/tray_monitor.cc2
-rw-r--r--ash/system/session_length_limit/tray_session_length_limit.cc6
-rw-r--r--ash/system/tray/hover_highlight_view.cc10
-rw-r--r--ash/system/tray/tray_utils.cc7
11 files changed, 36 insertions, 25 deletions
diff --git a/ash/accelerators/exit_warning_handler.cc b/ash/accelerators/exit_warning_handler.cc
index 6c873c3..3b36df0 100644
--- a/ash/accelerators/exit_warning_handler.cc
+++ b/ash/accelerators/exit_warning_handler.cc
@@ -17,7 +17,8 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
-#include "ui/gfx/font.h"
+#include "ui/gfx/font_list.h"
+#include "ui/gfx/text_utils.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/view.h"
@@ -65,14 +66,15 @@ class ExitWarningWidgetDelegateView : public views::WidgetDelegateView {
accessible_name_ =
l10n_util::GetStringUTF16(IDS_ASH_EXIT_WARNING_POPUP_TEXT_ACCESSIBLE);
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- font_ = rb.GetFont(ui::ResourceBundle::LargeFont);
- text_width_ = font_.GetStringWidth(text_);
+ const gfx::FontList& font_list =
+ rb.GetFontList(ui::ResourceBundle::LargeFont);
+ text_width_ = gfx::GetStringWidth(text_, font_list);
width_ = text_width_ + kHorizontalMarginAroundText;
- height_ = font_.GetHeight() + kVerticalMarginAroundText;
+ height_ = font_list.GetHeight() + kVerticalMarginAroundText;
views::Label* label = new ExitWarningLabel;
label->SetText(text_);
label->SetHorizontalAlignment(gfx::ALIGN_CENTER);
- label->SetFont(font_);
+ label->SetFontList(font_list);
label->SetEnabledColor(kTextColor);
label->SetDisabledColor(kTextColor);
label->SetAutoColorReadabilityEnabled(false);
@@ -100,7 +102,6 @@ class ExitWarningWidgetDelegateView : public views::WidgetDelegateView {
private:
base::string16 text_;
base::string16 accessible_name_;
- gfx::Font font_;
int text_width_;
int width_;
int height_;
diff --git a/ash/popup_message.cc b/ash/popup_message.cc
index 612cee3..bd1aea4 100644
--- a/ash/popup_message.cc
+++ b/ash/popup_message.cc
@@ -130,7 +130,8 @@ PopupMessage::MessageBubble::MessageBubble(const base::string16& caption,
views::Label* caption_label = new views::Label(caption);
caption_label->SetMultiLine(true);
caption_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- caption_label->SetFont(bundle.GetFont(ui::ResourceBundle::BoldFont));
+ caption_label->SetFontList(
+ bundle.GetFontList(ui::ResourceBundle::BoldFont));
caption_label->SetEnabledColor(kMessageTextColor);
details->AddChildView(caption_label);
}
diff --git a/ash/system/chromeos/audio/tray_audio.cc b/ash/system/chromeos/audio/tray_audio.cc
index b2ce819..0f05ffa 100644
--- a/ash/system/chromeos/audio/tray_audio.cc
+++ b/ash/system/chromeos/audio/tray_audio.cc
@@ -29,6 +29,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
+#include "ui/gfx/font_list.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/views/controls/button/image_button.h"
@@ -506,7 +507,8 @@ class AudioDetailedView : public TrayDetailsView,
right_margin));
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label->SetEnabledColor(SkColorSetARGB(192, 0, 0, 0));
- label->SetFont(label->font().DeriveFont(0, gfx::Font::BOLD));
+ label->SetFontList(label->font_list().DeriveFontListWithSizeDeltaAndStyle(
+ 0, gfx::Font::BOLD));
scroll_content()->AddChildView(label);
}
diff --git a/ash/system/chromeos/network/network_state_list_detailed_view.cc b/ash/system/chromeos/network/network_state_list_detailed_view.cc
index 0c0dde3..8788320 100644
--- a/ash/system/chromeos/network/network_state_list_detailed_view.cc
+++ b/ash/system/chromeos/network/network_state_list_detailed_view.cc
@@ -65,7 +65,7 @@ const int kRequestScanDelaySeconds = 10;
views::Label* CreateInfoBubbleLabel(const base::string16& text) {
views::Label* label = new views::Label(text);
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- label->SetFont(rb.GetFont(ui::ResourceBundle::SmallFont));
+ label->SetFontList(rb.GetFontList(ui::ResourceBundle::SmallFont));
label->SetEnabledColor(SkColorSetARGB(127, 0, 0, 0));
return label;
}
diff --git a/ash/system/chromeos/network/tray_sms.cc b/ash/system/chromeos/network/tray_sms.cc
index f1e1e56..fc76c09 100644
--- a/ash/system/chromeos/network/tray_sms.cc
+++ b/ash/system/chromeos/network/tray_sms.cc
@@ -98,8 +98,9 @@ class TraySms::SmsMessageView : public views::View,
l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_SMS_NUMBER,
base::UTF8ToUTF16(number)));
number_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- number_label_->SetFont(
- number_label_->font().DeriveFont(0, gfx::Font::BOLD));
+ number_label_->SetFontList(
+ number_label_->font_list().DeriveFontListWithSizeDeltaAndStyle(
+ 0, gfx::Font::BOLD));
message_label_ = new views::Label(base::UTF8ToUTF16(message));
message_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
diff --git a/ash/system/date/date_view.cc b/ash/system/date/date_view.cc
index 5e89f73..b336477 100644
--- a/ash/system/date/date_view.cc
+++ b/ash/system/date/date_view.cc
@@ -300,8 +300,8 @@ void TimeView::SetupLabels() {
void TimeView::SetupLabel(views::Label* label) {
label->set_owned_by_client();
SetupLabelForTray(label);
- gfx::Font font = label->font();
- label->SetFont(font.DeriveFont(0, font.GetStyle() & ~gfx::Font::BOLD));
+ label->SetFontList(label->font_list().DeriveFontListWithSizeDeltaAndStyle(
+ 0, label->font_list().GetFontStyle() & ~gfx::Font::BOLD));
}
} // namespace tray
diff --git a/ash/system/logout_button/logout_button_tray.cc b/ash/system/logout_button/logout_button_tray.cc
index c060730..e99b340 100644
--- a/ash/system/logout_button/logout_button_tray.cc
+++ b/ash/system/logout_button/logout_button_tray.cc
@@ -15,7 +15,7 @@
#include "grit/ash_resources.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/events/event.h"
-#include "ui/gfx/font.h"
+#include "ui/gfx/font_list.h"
#include "ui/gfx/insets.h"
#include "ui/gfx/size.h"
#include "ui/views/bubble/tray_bubble_view.h"
@@ -69,7 +69,8 @@ class LogoutButton : public views::LabelButton {
LogoutButton::LogoutButton(views::ButtonListener* listener)
: views::LabelButton(listener, base::string16()) {
SetupLabelForTray(label());
- SetFont(GetFont().DeriveFont(0, gfx::Font::NORMAL));
+ SetFontList(
+ GetFontList().DeriveFontListWithSizeDeltaAndStyle(0, gfx::Font::NORMAL));
for (size_t state = 0; state < views::Button::STATE_COUNT; ++state)
SetTextColor(static_cast<views::Button::ButtonState>(state), SK_ColorWHITE);
diff --git a/ash/system/monitor/tray_monitor.cc b/ash/system/monitor/tray_monitor.cc
index fc87a3a..6719a5d0 100644
--- a/ash/system/monitor/tray_monitor.cc
+++ b/ash/system/monitor/tray_monitor.cc
@@ -44,7 +44,7 @@ views::View* TrayMonitor::CreateTrayView(user::LoginStatus status) {
SkColorSetARGB(64, 0, 0, 0));
label_->SetShadowOffset(0, 1);
label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- label_->SetFont(label_->font().DeriveFont(-2));
+ label_->SetFontList(label_->font_list().DeriveFontListWithSizeDelta(-2));
return view;
}
diff --git a/ash/system/session_length_limit/tray_session_length_limit.cc b/ash/system/session_length_limit/tray_session_length_limit.cc
index 43b4030..395d911 100644
--- a/ash/system/session_length_limit/tray_session_length_limit.cc
+++ b/ash/system/session_length_limit/tray_session_length_limit.cc
@@ -25,7 +25,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/time_format.h"
#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/font.h"
+#include "ui/gfx/font_list.h"
#include "ui/message_center/message_center.h"
#include "ui/message_center/notification.h"
#include "ui/views/border.h"
@@ -54,8 +54,8 @@ views::Label* CreateAndSetupLabel() {
views::Label* label = new views::Label;
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
SetupLabelForTray(label);
- gfx::Font font = label->font();
- label->SetFont(font.DeriveFont(0, font.GetStyle() & ~gfx::Font::BOLD));
+ label->SetFontList(label->font_list().DeriveFontListWithSizeDeltaAndStyle(
+ 0, label->font_list().GetFontStyle() & ~gfx::Font::BOLD));
return label;
}
diff --git a/ash/system/tray/hover_highlight_view.cc b/ash/system/tray/hover_highlight_view.cc
index 8afa2de..488b3e7 100644
--- a/ash/system/tray/hover_highlight_view.cc
+++ b/ash/system/tray/hover_highlight_view.cc
@@ -11,6 +11,7 @@
#include "ui/base/accessibility/accessible_view_state.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
+#include "ui/gfx/font_list.h"
#include "ui/views/border.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
@@ -55,7 +56,8 @@ void HoverHighlightView::AddIconAndLabel(const gfx::ImageSkia& image,
text_label_ = new views::Label(text);
text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- text_label_->SetFont(text_label_->font().DeriveFont(0, style));
+ text_label_->SetFontList(
+ text_label_->font_list().DeriveFontListWithSizeDeltaAndStyle(0, style));
if (text_default_color_)
text_label_->SetEnabledColor(text_default_color_);
AddChildView(text_label_);
@@ -78,7 +80,8 @@ views::Label* HoverHighlightView::AddLabel(const base::string16& text,
text_label_->set_border(
views::Border::CreateEmptyBorder(5, left_margin, 5, right_margin));
text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- text_label_->SetFont(text_label_->font().DeriveFont(0, style));
+ text_label_->SetFontList(
+ text_label_->font_list().DeriveFontListWithSizeDeltaAndStyle(0, style));
// Do not set alpha value in disable color. It will have issue with elide
// blending filter in disabled state for rendering label text color.
text_label_->SetDisabledColor(SkColorSetARGB(255, 127, 127, 127));
@@ -110,7 +113,8 @@ views::Label* HoverHighlightView::AddCheckableLabel(const base::string16& text,
text_label_ = new views::Label(text);
text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- text_label_->SetFont(text_label_->font().DeriveFont(0, style));
+ text_label_->SetFontList(
+ text_label_->font_list().DeriveFontListWithSizeDeltaAndStyle(0, style));
text_label_->SetDisabledColor(SkColorSetARGB(127, 0, 0, 0));
if (text_default_color_)
text_label_->SetEnabledColor(text_default_color_);
diff --git a/ash/system/tray/tray_utils.cc b/ash/system/tray/tray_utils.cc
index 34582b6..a545ed1 100644
--- a/ash/system/tray/tray_utils.cc
+++ b/ash/system/tray/tray_utils.cc
@@ -6,7 +6,7 @@
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_item_view.h"
-#include "ui/gfx/font.h"
+#include "ui/gfx/font_list.h"
#include "ui/views/border.h"
#include "ui/views/controls/label.h"
@@ -16,8 +16,9 @@ namespace internal {
void SetupLabelForTray(views::Label* label) {
// Making label_font static to avoid the time penalty of DeriveFont for
// all but the first call.
- static const gfx::Font label_font(gfx::Font().DeriveFont(1, gfx::Font::BOLD));
- label->SetFont(label_font);
+ static const gfx::FontList label_font_list(
+ gfx::FontList().DeriveFontListWithSizeDeltaAndStyle(1, gfx::Font::BOLD));
+ label->SetFontList(label_font_list);
label->SetAutoColorReadabilityEnabled(false);
label->SetEnabledColor(SK_ColorWHITE);
label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255));