Commit c64ff31d authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

Shrink UnifiedSystemTray when notification removed

Different from the current notification center, UnifiedSystemTray will
shrink its area when notifications are removed.

UX spec: http://shortn/_U7QSE9nhSk

TEST=manual
BUG=828752

Change-Id: I5c793d39f88aa81fb7a2fa90366e62fc5dc9af2d
Reviewed-on: https://chromium-review.googlesource.com/1011522Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550476}
parent fef93a84
...@@ -47,6 +47,7 @@ MessageListView::MessageListView() ...@@ -47,6 +47,7 @@ MessageListView::MessageListView()
fixed_height_(0), fixed_height_(0),
has_deferred_task_(false), has_deferred_task_(false),
clear_all_started_(false), clear_all_started_(false),
use_fixed_height_(true),
animator_(this), animator_(this),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
auto layout = std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical, auto layout = std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical,
...@@ -207,7 +208,7 @@ gfx::Size MessageListView::CalculatePreferredSize() const { ...@@ -207,7 +208,7 @@ gfx::Size MessageListView::CalculatePreferredSize() const {
} }
int MessageListView::GetHeightForWidth(int width) const { int MessageListView::GetHeightForWidth(int width) const {
if (fixed_height_ > 0) if (use_fixed_height_ && fixed_height_ > 0)
return fixed_height_; return fixed_height_;
width -= GetInsets().width(); width -= GetInsets().width();
......
...@@ -68,6 +68,9 @@ class ASH_EXPORT MessageListView : public views::View, ...@@ -68,6 +68,9 @@ class ASH_EXPORT MessageListView : public views::View,
void AddObserver(Observer* observer); void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer); void RemoveObserver(Observer* observer);
void set_use_fixed_height(bool use_fixed_height) {
use_fixed_height_ = use_fixed_height;
}
void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; } void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; }
protected: protected:
...@@ -128,6 +131,7 @@ class ASH_EXPORT MessageListView : public views::View, ...@@ -128,6 +131,7 @@ class ASH_EXPORT MessageListView : public views::View,
int fixed_height_; int fixed_height_;
bool has_deferred_task_; bool has_deferred_task_;
bool clear_all_started_; bool clear_all_started_;
bool use_fixed_height_;
std::set<views::View*> adding_views_; std::set<views::View*> adding_views_;
std::set<views::View*> deleting_views_; std::set<views::View*> deleting_views_;
std::set<views::View*> deleted_when_done_; std::set<views::View*> deleted_when_done_;
......
...@@ -46,6 +46,7 @@ UnifiedMessageCenterView::UnifiedMessageCenterView( ...@@ -46,6 +46,7 @@ UnifiedMessageCenterView::UnifiedMessageCenterView(
scroller_->SetHorizontalScrollBar(new views::OverlayScrollBar(true)); scroller_->SetHorizontalScrollBar(new views::OverlayScrollBar(true));
AddChildView(scroller_); AddChildView(scroller_);
message_list_view_->set_use_fixed_height(false);
message_list_view_->set_scroller(scroller_); message_list_view_->set_scroller(scroller_);
scroller_->SetContents(message_list_view_); scroller_->SetContents(message_list_view_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment