Index: ui/message_center/views/notification_view.cc |
=================================================================== |
--- ui/message_center/views/notification_view.cc (revision 188662) |
+++ ui/message_center/views/notification_view.cc (working copy) |
@@ -18,7 +18,6 @@ |
#include "ui/message_center/notification.h" |
#include "ui/message_center/notification_change_observer.h" |
#include "ui/message_center/notification_types.h" |
-#include "ui/message_center/views/bounded_label.h" |
#include "ui/message_center/views/message_simple_view.h" |
#include "ui/native_theme/native_theme.h" |
#include "ui/views/controls/button/image_button.h" |
@@ -341,9 +340,6 @@ |
NotificationChangeObserver* observer, |
bool expanded) |
: MessageView(notification, observer, expanded) { |
- // As we build the view, we'll see if any part of it is expandable. |
- bool expandable = false; |
- |
// Create the opaque background that's above the view's shadow. |
background_view_ = new views::View(); |
background_view_->set_background( |
@@ -357,9 +353,13 @@ |
// Create the title view if appropriate. |
title_view_ = NULL; |
if (!notification.title().empty()) { |
- gfx::Font font = views::Label().font().DeriveFont(4); |
- title_view_ = new BoundedLabel(notification.title(), font, 1); |
+ title_view_ = new views::Label(notification.title()); |
title_view_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
+ if (is_expanded()) |
+ title_view_->SetMultiLine(true); |
+ else |
+ title_view_->SetElideBehavior(views::Label::ELIDE_AT_END); |
+ title_view_->SetFont(title_view_->font().DeriveFont(4)); |
title_view_->SetEnabledColor(kTitleColor); |
title_view_->SetBackgroundColor(kTitleBackgroundColor); |
title_view_->set_border(MakeBorder(kTextTopPadding, 3)); |
@@ -369,16 +369,18 @@ |
// Create the message view if appropriate. |
message_view_ = NULL; |
if (!notification.message().empty()) { |
- size_t lines = (is_expanded() && notification.image().IsEmpty()) ? 7 : 2; |
- message_view_ = new BoundedLabel(notification.message(), lines); |
+ message_view_ = new views::Label(notification.message()); |
message_view_->SetVisible(!is_expanded() || !notification.items().size()); |
message_view_->set_collapse_when_hidden(true); |
message_view_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
+ if (is_expanded()) |
+ message_view_->SetMultiLine(true); |
+ else |
+ message_view_->SetElideBehavior(views::Label::ELIDE_AT_END); |
message_view_->SetEnabledColor(kMessageColor); |
message_view_->SetBackgroundColor(kMessageBackgroundColor); |
message_view_->set_border(MakeBorder(0, 3)); |
top_view_->AddChildView(message_view_); |
- expandable = (message_view_->GetPreferredLines() > lines); |
} |
// Create the list item views (up to a maximum). |
@@ -389,7 +391,6 @@ |
item_view->set_border(MakeBorder(0, 4)); |
item_views_.push_back(item_view); |
top_view_->AddChildView(item_view); |
- expandable = true; |
} |
// Create the notification icon view. |
@@ -407,7 +408,6 @@ |
image_view_ = new ProportionalImageView(notification.image().AsImageSkia()); |
image_view_->SetVisible(is_expanded()); |
bottom_view_->AddChildView(image_view_); |
- expandable = true; |
} |
// Create action buttons if appropriate. |
@@ -425,6 +425,7 @@ |
} |
// Hide the expand button if appropriate. |
+ bool expandable = item_views_.size() || image_view_; |
expand_button()->SetVisible(expandable && !is_expanded()); |
// Put together the different content and control views. Layering those allows |
@@ -501,10 +502,8 @@ |
// Show and hide subviews appropriately on expansion. |
if (sender == expand_button()) { |
- if (message_view_ && !item_views_.size() && !image_view_) |
- message_view_->SetMaxLines(7); |
- else if (message_view_ && item_views_.size()) |
- message_view_->SetVisible(false); |
+ if (message_view_) |
+ message_view_->SetVisible(!item_views_.size()); |
for (size_t i = 0; i < item_views_.size(); ++i) |
item_views_[i]->SetVisible(true); |
if (image_view_) |