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 be77657f6e0dc522854ebeffeaff888419488b41..e283ce84e8c65affeb3aca5d320ef237a643ac81 100644 |
| --- a/ui/message_center/views/notification_view.cc |
| +++ b/ui/message_center/views/notification_view.cc |
| @@ -528,12 +528,13 @@ void NotificationView::CreateOrUpdateTitleView( |
| int title_character_limit = |
| kNotificationWidth * kMaxTitleLines / kMinPixelsPerTitleCharacter; |
| + base::string16 title = gfx::TruncateString(notification.title(), |
| + title_character_limit, |
| + gfx::WORD_BREAK); |
| if (!title_view_) { |
| int padding = kTitleLineHeight - font_list.GetHeight(); |
| - title_view_ = new BoundedLabel( |
| - gfx::TruncateString(notification.title(), title_character_limit), |
| - font_list); |
| + title_view_ = new BoundedLabel(title, font_list); |
| title_view_->SetLineHeight(kTitleLineHeight); |
| title_view_->SetLineLimit(kMaxTitleLines); |
| title_view_->SetColors(message_center::kRegularTextColor, |
| @@ -541,8 +542,7 @@ void NotificationView::CreateOrUpdateTitleView( |
| title_view_->SetBorder(MakeTextBorder(padding, 3, 0)); |
| top_view_->AddChildView(title_view_); |
| } else { |
| - title_view_->SetText( |
| - gfx::TruncateString(notification.title(), title_character_limit)); |
| + title_view_->SetText(title); |
| } |
| } |
| @@ -559,18 +559,19 @@ void NotificationView::CreateOrUpdateMessageView( |
| DCHECK(top_view_ != NULL); |
| + base::string16 title = gfx::TruncateString(notification.message(), |
|
msw
2014/07/21 16:47:29
nit: rename this to |text|, since this isn't a |ti
Marc Treib
2014/07/22 08:12:48
Done.
|
| + kMessageCharacterLimit, |
| + gfx::WORD_BREAK); |
| if (!message_view_) { |
| int padding = kMessageLineHeight - views::Label().font_list().GetHeight(); |
| - message_view_ = new BoundedLabel( |
| - gfx::TruncateString(notification.message(), kMessageCharacterLimit)); |
| + message_view_ = new BoundedLabel(title); |
| message_view_->SetLineHeight(kMessageLineHeight); |
| message_view_->SetColors(message_center::kRegularTextColor, |
| kDimTextBackgroundColor); |
| message_view_->SetBorder(MakeTextBorder(padding, 4, 0)); |
| top_view_->AddChildView(message_view_); |
| } else { |
| - message_view_->SetText( |
| - gfx::TruncateString(notification.message(), kMessageCharacterLimit)); |
| + message_view_->SetText(title); |
| } |
| message_view_->SetVisible(!notification.items().size()); |
| @@ -589,10 +590,12 @@ void NotificationView::CreateOrUpdateContextMessageView( |
| DCHECK(top_view_ != NULL); |
| + base::string16 title = gfx::TruncateString(notification.context_message(), |
|
msw
2014/07/21 16:47:29
ditto
Marc Treib
2014/07/22 08:12:48
Done.
|
| + kContextMessageCharacterLimit, |
| + gfx::WORD_BREAK); |
| if (!context_message_view_) { |
| int padding = kMessageLineHeight - views::Label().font_list().GetHeight(); |
| - context_message_view_ = new BoundedLabel(gfx::TruncateString( |
| - notification.context_message(), kContextMessageCharacterLimit)); |
| + context_message_view_ = new BoundedLabel(title); |
| context_message_view_->SetLineLimit( |
| message_center::kContextMessageLineLimit); |
| context_message_view_->SetLineHeight(kMessageLineHeight); |
| @@ -601,8 +604,7 @@ void NotificationView::CreateOrUpdateContextMessageView( |
| context_message_view_->SetBorder(MakeTextBorder(padding, 4, 0)); |
| top_view_->AddChildView(context_message_view_); |
| } else { |
| - context_message_view_->SetText(gfx::TruncateString( |
| - notification.context_message(), kContextMessageCharacterLimit)); |
| + context_message_view_->SetText(title); |
| } |
| } |