Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(595)

Unified Diff: ash/shelf/shelf_view.cc

Issue 2053113002: Replaced BackgroundAnimator with ShelfBackgroundAnimator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into animate_shelf_chip_backgrounds Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/shelf/shelf_view.h ('k') | ash/shelf/shelf_view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf_view.cc
diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc
index 7e3119ed71ba7ce9c57122915049e4fc51b405e1..ea03a1ac6be877e61baf06cfca1e6947c822ab83 100644
--- a/ash/shelf/shelf_view.cc
+++ b/ash/shelf/shelf_view.cc
@@ -14,6 +14,7 @@
#include "ash/common/shelf/overflow_bubble.h"
#include "ash/common/shelf/overflow_bubble_view.h"
#include "ash/common/shelf/overflow_button.h"
+#include "ash/common/shelf/shelf_background_animator.h"
#include "ash/common/shelf/shelf_button.h"
#include "ash/common/shelf/shelf_constants.h"
#include "ash/common/shelf/shelf_delegate.h"
@@ -360,7 +361,8 @@ const int ShelfView::kMinimumDragDistance = 8;
ShelfView::ShelfView(ShelfModel* model,
ShelfDelegate* delegate,
WmShelf* wm_shelf,
- Shelf* shelf)
+ Shelf* shelf,
+ ShelfBackgroundAnimator* background_animator)
: model_(model),
delegate_(delegate),
wm_shelf_(wm_shelf),
@@ -388,7 +390,8 @@ ShelfView::ShelfView(ShelfModel* model,
main_shelf_(nullptr),
dragged_off_from_overflow_to_shelf_(false),
is_repost_event_on_same_item_(false),
- last_pressed_index_(-1) {
+ last_pressed_index_(-1),
+ background_animator_(background_animator) {
DCHECK(model_);
DCHECK(delegate_);
DCHECK(wm_shelf_);
@@ -401,6 +404,8 @@ ShelfView::ShelfView(ShelfModel* model,
ShelfView::~ShelfView() {
bounds_animator_->RemoveObserver(this);
model_->RemoveObserver(this);
+ if (background_animator_)
+ background_animator_->RemoveObserver(this);
}
void ShelfView::Init() {
@@ -418,6 +423,9 @@ void ShelfView::Init() {
ConfigureChildView(overflow_button_);
AddChildView(overflow_button_);
+ if (background_animator_)
+ background_animator_->AddObserver(this);
+
// We'll layout when our bounds change.
}
@@ -1370,7 +1378,7 @@ void ShelfView::ToggleOverflowBubble() {
overflow_bubble_.reset(new OverflowBubble(wm_shelf_));
ShelfView* overflow_view =
- new ShelfView(model_, delegate_, wm_shelf_, shelf_);
+ new ShelfView(model_, delegate_, wm_shelf_, shelf_, nullptr);
overflow_view->overflow_mode_ = true;
overflow_view->Init();
overflow_view->set_owner_overflow_bubble(overflow_bubble_.get());
@@ -1547,6 +1555,11 @@ void ShelfView::OnGestureEvent(ui::GestureEvent* event) {
event->StopPropagation();
}
+void ShelfView::UpdateShelfItemBackground(int alpha) {
+ GetAppListButton()->SetBackgroundAlpha(alpha);
+ overflow_button_->SetBackgroundAlpha(alpha);
+}
+
void ShelfView::ShelfItemAdded(int model_index) {
{
base::AutoReset<bool> cancelling_drag(&cancelling_drag_model_changed_,
« no previous file with comments | « ash/shelf/shelf_view.h ('k') | ash/shelf/shelf_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698