Chromium Code Reviews| 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..077e8a3ab22da88fa784a56ded2b33cdbc09f37b 100644 |
| --- a/ui/message_center/views/notification_view.cc |
| +++ b/ui/message_center/views/notification_view.cc |
| @@ -45,7 +45,7 @@ const int kProgressBarBottomPadding = 0; |
| const int kButtonVecticalPadding = 0; |
| const int kButtonTitleTopPadding = 0; |
| -// Character limits: Displayed text will be subject to the line limits above, |
| +// Character limits: Displayed text will be subject to the ine limits above, |
|
jianli
2013/08/28 21:30:54
ine?
dewittj
2013/08/29 17:40:10
Done.
|
| // but we also remove trailing characters from text to reduce processing cost. |
| // Character limit = pixels per line * line limit / min. pixels per character. |
| const size_t kTitleCharacterLimit = |
| @@ -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( |
| @@ -493,6 +497,26 @@ NotificationView::NotificationView(const Notification& notification, |
| accessible_lines.push_back(notification.message()); |
| } |
| + // Create the context message view if appropriate. |
| + context_message_view_ = NULL; |
| + LOG(INFO) << "Context message: " << notification.context_message(); |
| + if (!notification.context_message().empty()) { |
| + gfx::Font font = views::Label().font().DeriveFont(0, gfx::Font::ITALIC); |
| + int padding = kContextMessageLineHeight - views::Label().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(kContextMessageLineHeight); |
| + context_message_view_->SetColors(message_center::kContextTextColor, |
| + 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) { |