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

Unified Diff: ui/message_center/views/notification_view.cc

Issue 24084003: Clean-up: Replaces Font with FontList in ui/message_center. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removes comments at the ending of namespaces. Created 7 years, 3 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 | « ui/message_center/views/bounded_label_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/views/notification_view.cc
diff --git a/ui/message_center/views/notification_view.cc b/ui/message_center/views/notification_view.cc
index 5d878a38b8dc5a2a5655c1b418091b2281d9c418..43cf4e5e5ae68b138ca77436799f8a3f9a4122a6 100644
--- a/ui/message_center/views/notification_view.cc
+++ b/ui/message_center/views/notification_view.cc
@@ -466,13 +466,17 @@ NotificationView::NotificationView(const Notification& notification,
top_view_->set_border(MakeEmptyBorder(
kTextTopPadding - 8, 0, kTextBottomPadding - 5, 0));
+ const gfx::FontList default_label_font_list = views::Label().font_list();
+
// Create the title view if appropriate.
title_view_ = NULL;
if (!notification.title().empty()) {
- gfx::Font font = views::Label().font().DeriveFont(2);
- int padding = kTitleLineHeight - font.GetHeight();
+ const gfx::FontList& font_list =
+ default_label_font_list.DeriveFontListWithSizeDelta(2);
+ int padding = kTitleLineHeight - font_list.GetHeight();
title_view_ = new BoundedLabel(
- gfx::TruncateString(notification.title(), kTitleCharacterLimit), font);
+ gfx::TruncateString(notification.title(), kTitleCharacterLimit),
+ font_list);
title_view_->SetLineHeight(kTitleLineHeight);
title_view_->SetLineLimit(message_center::kTitleLineLimit);
title_view_->SetColors(message_center::kRegularTextColor,
@@ -485,7 +489,7 @@ NotificationView::NotificationView(const Notification& notification,
// Create the message view if appropriate.
message_view_ = NULL;
if (!notification.message().empty()) {
- int padding = kMessageLineHeight - views::Label().font().GetHeight();
+ int padding = kMessageLineHeight - default_label_font_list.GetHeight();
message_view_ = new BoundedLabel(
gfx::TruncateString(notification.message(), kMessageCharacterLimit));
message_view_->SetLineHeight(kMessageLineHeight);
@@ -500,12 +504,11 @@ NotificationView::NotificationView(const Notification& notification,
// Create the context message view if appropriate.
context_message_view_ = NULL;
if (!notification.context_message().empty()) {
- gfx::Font font = views::Label().font();
- int padding = kMessageLineHeight - font.GetHeight();
+ int padding = kMessageLineHeight - default_label_font_list.GetHeight();
context_message_view_ =
new BoundedLabel(gfx::TruncateString(notification.context_message(),
kContextMessageCharacterLimit),
- font);
+ default_label_font_list);
context_message_view_->SetLineLimit(
message_center::kContextMessageLineLimit);
context_message_view_->SetLineHeight(kMessageLineHeight);
@@ -527,7 +530,7 @@ NotificationView::NotificationView(const Notification& notification,
}
// Create the list item views (up to a maximum).
- int padding = kMessageLineHeight - views::Label().font().GetHeight();
+ int padding = kMessageLineHeight - default_label_font_list.GetHeight();
std::vector<NotificationItem> items = notification.items();
for (size_t i = 0; i < items.size() && i < kNotificationMaximumItems; ++i) {
ItemView* item_view = new ItemView(items[i]);
« no previous file with comments | « ui/message_center/views/bounded_label_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698