| Index: ui/message_center/views/message_center_view.cc
|
| diff --git a/ui/message_center/views/message_center_view.cc b/ui/message_center/views/message_center_view.cc
|
| index 27b4978b0600adcf3def629504265d126c330f87..30a0875027359a67538b8125f0c5e04c2248a590 100644
|
| --- a/ui/message_center/views/message_center_view.cc
|
| +++ b/ui/message_center/views/message_center_view.cc
|
| @@ -113,7 +113,7 @@ class MessageListView : public views::View,
|
|
|
| void AddNotificationAt(MessageView* view, int i);
|
| void RemoveNotification(MessageView* view);
|
| - void UpdateNotification(MessageView* view, MessageView* new_view);
|
| + void UpdateNotification(MessageView* view, const Notification& notification);
|
| void SetRepositionTarget(const gfx::Rect& target_rect);
|
| void ResetRepositionSession();
|
| void ClearAllNotifications(const gfx::Rect& visible_scroll_rect);
|
| @@ -261,23 +261,17 @@ void MessageListView::RemoveNotification(MessageView* view) {
|
| }
|
|
|
| void MessageListView::UpdateNotification(MessageView* view,
|
| - MessageView* new_view) {
|
| + const Notification& notification) {
|
| int index = GetIndexOf(view);
|
| DCHECK_LE(0, index); // GetIndexOf is negative if not a child.
|
|
|
| if (animator_.get())
|
| animator_->StopAnimatingView(view);
|
| - gfx::Rect old_bounds = view->bounds();
|
| if (deleting_views_.find(view) != deleting_views_.end())
|
| deleting_views_.erase(view);
|
| if (deleted_when_done_.find(view) != deleted_when_done_.end())
|
| deleted_when_done_.erase(view);
|
| - delete view;
|
| - AddChildViewAt(new_view, index);
|
| - new_view->SetBounds(old_bounds.x(),
|
| - old_bounds.y(),
|
| - old_bounds.width(),
|
| - new_view->GetHeightForWidth(old_bounds.width()));
|
| + view->UpdateWithNotification(notification);
|
| DoUpdateIfPossible();
|
| }
|
|
|
| @@ -885,16 +879,11 @@ void MessageCenterView::OnNotificationUpdated(const std::string& id) {
|
| for (NotificationList::Notifications::const_iterator iter =
|
| notifications.begin(); iter != notifications.end(); ++iter) {
|
| if ((*iter)->id() == id) {
|
| - NotificationView* new_view =
|
| - NotificationView::Create(this,
|
| - *(*iter),
|
| - false); // Not creating a top-level
|
| - // notification.
|
| - new_view->set_context_menu_controller(context_menu_controller_.get());
|
| - new_view->set_scroller(scroller_);
|
| - message_list_view_->UpdateNotification(view, new_view);
|
| - notification_views_[id] = new_view;
|
| - NotificationsChanged();
|
| + int old_width = view->width();
|
| + int old_height = view->GetHeightForWidth(old_width);
|
| + message_list_view_->UpdateNotification(view, **iter);
|
| + if (view->GetHeightForWidth(old_width) != old_height)
|
| + NotificationsChanged();
|
| break;
|
| }
|
| }
|
|
|