Index: ui/message_center/message_view.cc |
diff --git a/ui/message_center/message_view.cc b/ui/message_center/message_view.cc |
index 27535b74c1d54e27c9cdf0e5283cc3e019407858..5b37e90c0f64eccf752bef53c035a119fd3909db 100644 |
--- a/ui/message_center/message_view.cc |
+++ b/ui/message_center/message_view.cc |
@@ -19,9 +19,11 @@ |
namespace { |
-const int kCloseButtonSize = 29; |
+const int kControlButtonSize = 29; |
const int kCloseIconTopPadding = 5; |
const int kCloseIconRightPadding = 5; |
+const int kExpandIconBottomPadding = 8; |
+const int kExpandIconRightPadding = 11; |
// ControlButtons are ImageButtons whose image can be padded within the button. |
// This allows the creation of buttons like the notification close and expand |
@@ -91,7 +93,7 @@ void ControlButton::SetPressedImage(int resource_id) { |
} |
gfx::Size ControlButton::GetPreferredSize() { |
- return gfx::Size(kCloseButtonSize, kCloseButtonSize); |
+ return gfx::Size(kControlButtonSize, kControlButtonSize); |
} |
void ControlButton::OnPaint(gfx::Canvas* canvas) { |
@@ -225,13 +227,23 @@ MessageView::MessageView( |
const Notification& notification) |
: list_delegate_(list_delegate), |
notification_(notification), |
- scroller_(NULL) { |
+ scroller_(NULL), |
+ expanded_(false) { |
ControlButton *close = new ControlButton(this); |
close->SetPadding(-kCloseIconRightPadding, kCloseIconTopPadding); |
close->SetNormalImage(IDR_NOTIFICATION_CLOSE); |
close->SetHoveredImage(IDR_NOTIFICATION_CLOSE_HOVER); |
close->SetPressedImage(IDR_NOTIFICATION_CLOSE_PRESSED); |
+ close->set_owned_by_client(); |
dharcourt
2013/02/23 04:32:00
This isn't strictly needed because close_button_ w
|
close_button_.reset(close); |
+ |
+ ControlButton *expand = new ControlButton(this); |
+ expand->SetPadding(-kExpandIconRightPadding, -kExpandIconBottomPadding); |
+ expand->SetNormalImage(IDR_NOTIFICATIONS_EXPAND); |
+ expand->SetHoveredImage(IDR_NOTIFICATIONS_EXPAND_HOVER); |
+ expand->SetPressedImage(IDR_NOTIFICATIONS_EXPAND_PRESSED); |
+ expand->set_owned_by_client(); |
+ expand_button_.reset(expand); |
} |
MessageView::MessageView() { |
@@ -279,6 +291,16 @@ void MessageView::ButtonPressed(views::Button* sender, |
const ui::Event& event) { |
if (sender == close_button()) |
list_delegate_->SendRemoveNotification(notification_.id); |
+ else if (sender == expand_button()) |
+ SetExpanded(!expanded_); |
+} |
+ |
+bool MessageView::IsExpanded() { |
+ return expanded_; |
+} |
+ |
+void MessageView::SetExpanded(bool expanded) { |
+ expanded_ = expanded; |
} |
void MessageView::ShowMenu(gfx::Point screen_location) { |