#include "ui/message_center/message_center_style.h"
#include "ui/message_center/message_center_tray.h"
#include "ui/message_center/message_center_types.h"
-#include "ui/message_center/message_center_util.h"
-#include "ui/message_center/views/bounded_scroll_view.h"
#include "ui/message_center/views/message_center_button_bar.h"
#include "ui/message_center/views/message_view.h"
#include "ui/message_center/views/message_view_context_menu_controller.h"
#include "ui/views/border.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/label.h"
+#include "ui/views/controls/scroll_view.h"
+#include "ui/views/controls/scrollbar/overlay_scroll_bar.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/widget/widget.h"
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);
}
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();
}
const int button_height = button_bar_->GetPreferredSize().height();
- scroller_ =
- new BoundedScrollView(kMinScrollViewHeight, max_height - button_height);
+ scroller_ = new views::ScrollView();
+ scroller_->ClipHeightTo(kMinScrollViewHeight, max_height - button_height);
+ scroller_->SetVerticalScrollBar(new views::OverlayScrollBar(false));
+ scroller_->set_background(
+ views::Background::CreateSolidBackground(kMessageCenterBackgroundColor));
- if (get_use_acceleration_when_possible()) {
- scroller_->SetPaintToLayer(true);
- scroller_->SetFillsBoundsOpaquely(false);
- scroller_->layer()->SetMasksToBounds(true);
- }
+ scroller_->SetPaintToLayer(true);
+ scroller_->SetFillsBoundsOpaquely(false);
+ scroller_->layer()->SetMasksToBounds(true);
empty_list_view_.reset(new NoNotificationMessageView);
empty_list_view_->set_owned_by_client();
notifications.begin(); iter != notifications.end(); ++iter) {
AddNotificationAt(*(*iter), index++);
- message_center_->DisplayedNotification((*iter)->id());
+ message_center_->DisplayedNotification(
+ (*iter)->id(), message_center::DISPLAY_SOURCE_MESSAGE_CENTER);
if (notification_views_.size() >= kMaxVisibleMessageCenterNotifications)
break;
}
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;
}
}