Index: chrome/browser/ui/views/subtle_notification_view.cc |
diff --git a/chrome/browser/ui/views/subtle_notification_view.cc b/chrome/browser/ui/views/subtle_notification_view.cc |
index d8f19ac97f227cd19360a92eae01e72f2d771fc6..ba54e38bbdf8c05b7a321d1f30e33a9dacc74a03 100644 |
--- a/chrome/browser/ui/views/subtle_notification_view.cc |
+++ b/chrome/browser/ui/views/subtle_notification_view.cc |
@@ -34,6 +34,11 @@ const int kKeyNameBorderPx = 1; |
const int kKeyNameCornerRadius = 2; |
const int kKeyNamePaddingPx = 5; |
+// The context used to obtain typography for the instruction text. It's not |
+// really a dialog, but a dialog title is a good fit. |
+constexpr views::TextContext kInstructionTextContext = |
+ views::TextContext::DIALOG_TITLE; |
+ |
} // namespace |
// Class containing the instruction text. Contains fancy styling on the keyboard |
@@ -45,7 +50,6 @@ class SubtleNotificationView::InstructionView : public views::View { |
// will be displayed as a keyboard key. e.g., "Press |Alt|+|Q| to exit" will |
// have "Alt" and "Q" rendered as keys. |
InstructionView(const base::string16& text, |
- const gfx::FontList& font_list, |
SkColor foreground_color, |
SkColor background_color); |
@@ -57,7 +61,6 @@ class SubtleNotificationView::InstructionView : public views::View { |
// keyboard key. |
void AddTextSegment(const base::string16& text, bool format_as_key); |
- const gfx::FontList& font_list_; |
SkColor foreground_color_; |
SkColor background_color_; |
@@ -68,12 +71,9 @@ class SubtleNotificationView::InstructionView : public views::View { |
SubtleNotificationView::InstructionView::InstructionView( |
const base::string16& text, |
- const gfx::FontList& font_list, |
SkColor foreground_color, |
SkColor background_color) |
- : font_list_(font_list), |
- foreground_color_(foreground_color), |
- background_color_(background_color) { |
+ : foreground_color_(foreground_color), background_color_(background_color) { |
// The |between_child_spacing| is the horizontal margin of the key name. |
views::BoxLayout* layout = new views::BoxLayout(views::BoxLayout::kHorizontal, |
0, 0, kKeyNameMarginHorizPx); |
@@ -113,7 +113,7 @@ void SubtleNotificationView::InstructionView::SetText( |
void SubtleNotificationView::InstructionView::AddTextSegment( |
const base::string16& text, bool format_as_key) { |
- views::Label* label = new views::Label(text, font_list_); |
+ views::Label* label = new views::Label(text, kInstructionTextContext); |
label->SetEnabledColor(foreground_color_); |
label->SetBackgroundColor(background_color_); |
if (!format_as_key) { |
@@ -146,18 +146,15 @@ SubtleNotificationView::SubtleNotificationView( |
set_background(new views::BubbleBackground(bubble_border.get())); |
SetBorder(std::move(bubble_border)); |
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
- const gfx::FontList& font_list = |
- rb.GetFontList(ui::ResourceBundle::MediumFont); |
- |
- instruction_view_ = new InstructionView(base::string16(), font_list, |
- kForegroundColor, kBackgroundColor); |
+ instruction_view_ = |
+ new InstructionView(base::string16(), kForegroundColor, kBackgroundColor); |
link_ = new views::Link(); |
link_->SetFocusBehavior(FocusBehavior::NEVER); |
link_->set_listener(link_listener); |
- link_->SetFontList(font_list); |
- link_->SetEnabledColor(kForegroundColor); |
+ link_->SetFontList(views::Typography::GetFont(kInstructionTextContext, |
+ views::TextStyle::LINK)); |
+ link_->SetEnabledColor(kForegroundColor); // Overrides TextStyle::LINK. |
link_->SetBackgroundColor(kBackgroundColor); |
link_->SetVisible(false); |