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

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

Issue 23462005: Adds the contextMessage field to notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adjust unit test due to bugfix in toast layout. Created 7 years, 4 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/notification_view.h ('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 abfc1efe689e541a0360b5ec0d8d3ddafa8ca886..a39b4e4beeed8087e35098b041224f24498d014c 100644
--- a/ui/message_center/views/notification_view.cc
+++ b/ui/message_center/views/notification_view.cc
@@ -53,12 +53,16 @@ const size_t kTitleCharacterLimit =
const size_t kMessageCharacterLimit =
message_center::kNotificationWidth *
message_center::kMessageExpandedLineLimit / 3;
+const size_t kContextMessageCharacterLimit =
+ message_center::kNotificationWidth *
+ message_center::kContextMessageLineLimit / 3;
// Notification colors. The text background colors below are used only to keep
// view::Label from modifying the text color and will not actually be drawn.
// See view::Label's RecalculateColors() for details.
const SkColor kRegularTextBackgroundColor = SK_ColorWHITE;
const SkColor kDimTextBackgroundColor = SK_ColorWHITE;
+const SkColor kContextTextBackgroundColor = SK_ColorWHITE;
// static
views::Background* MakeBackground(
@@ -486,13 +490,32 @@ NotificationView::NotificationView(const Notification& notification,
ui::TruncateString(notification.message(), kMessageCharacterLimit));
message_view_->SetLineHeight(kMessageLineHeight);
message_view_->SetVisible(!is_expanded() || !notification.items().size());
- message_view_->SetColors(message_center::kDimTextColor,
+ message_view_->SetColors(message_center::kRegularTextColor,
kDimTextBackgroundColor);
message_view_->set_border(MakeTextBorder(padding, 4, 0));
top_view_->AddChildView(message_view_);
accessible_lines.push_back(notification.message());
}
+ // 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();
+ context_message_view_ =
+ new BoundedLabel(ui::TruncateString(notification.context_message(),
+ kContextMessageCharacterLimit),
+ font);
+ context_message_view_->SetLineLimit(
+ message_center::kContextMessageLineLimit);
+ context_message_view_->SetLineHeight(kMessageLineHeight);
+ context_message_view_->SetColors(message_center::kDimTextColor,
+ kContextTextBackgroundColor);
+ context_message_view_->set_border(MakeTextBorder(padding, 4, 0));
+ top_view_->AddChildView(context_message_view_);
+ accessible_lines.push_back(notification.context_message());
+ }
+
// Create the progress bar view.
progress_bar_view_ = NULL;
if (notification.type() == NOTIFICATION_TYPE_PROGRESS) {
« no previous file with comments | « ui/message_center/views/notification_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698