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

Unified Diff: ash/common/shelf/shelf_widget.cc

Issue 2679333002: [ash-md] Remove the number of animators used for the Shelf animations. (Closed)
Patch Set: Created 3 years, 10 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
Index: ash/common/shelf/shelf_widget.cc
diff --git a/ash/common/shelf/shelf_widget.cc b/ash/common/shelf/shelf_widget.cc
index cffc5c9749b0b5bf6e8851e6e9d437a0990415a8..393f03b2f972080c301b5ebd00a30a3c06cce92e 100644
--- a/ash/common/shelf/shelf_widget.cc
+++ b/ash/common/shelf/shelf_widget.cc
@@ -24,6 +24,7 @@
#include "base/memory/ptr_util.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/gfx/animation/animation_change_type.h"
#include "ui/gfx/skbitmap_operations.h"
#include "ui/views/accessible_pane_view.h"
#include "ui/views/layout/fill_layout.h"
@@ -61,12 +62,13 @@ class ShelfWidget::DelegateView : public views::WidgetDelegate,
void OnBoundsChanged(const gfx::Rect& old_bounds) override;
// ShelfBackgroundAnimatorObserver:
- void UpdateShelfOpaqueBackground(int alpha) override;
+ void UpdateShelfBackground(int alpha) override;
private:
ShelfWidget* shelf_widget_;
FocusCycler* focus_cycler_;
- // A black background layer which is shown when a maximized window is visible.
+ // A black background layer that may be visible depending on a
+ // ShelfBackgroundAnimator.
ui::Layer opaque_background_;
// A black foreground layer which is shown while transitioning between users.
// Note: Since the back- and foreground layers have different functions they
@@ -123,7 +125,7 @@ void ShelfWidget::DelegateView::OnBoundsChanged(const gfx::Rect& old_bounds) {
opaque_foreground_.SetBounds(GetLocalBounds());
}
-void ShelfWidget::DelegateView::UpdateShelfOpaqueBackground(int alpha) {
+void ShelfWidget::DelegateView::UpdateShelfBackground(int alpha) {
const float kMaxAlpha = 255.0f;
opaque_background_.SetOpacity(alpha / kMaxAlpha);
}
@@ -160,7 +162,7 @@ ShelfWidget::ShelfWidget(WmWindow* shelf_container, WmShelf* wm_shelf)
shelf_container->SetLayoutManager(base::WrapUnique(shelf_layout_manager_));
background_animator_.PaintBackground(
shelf_layout_manager_->GetShelfBackgroundType(),
- BACKGROUND_CHANGE_IMMEDIATE);
+ gfx::ANIMATION_CHANGE_IMMEDIATE);
views::Widget::AddObserver(this);
}
@@ -189,9 +191,8 @@ void ShelfWidget::CreateStatusAreaWidget(WmWindow* status_container) {
base::MakeUnique<StatusAreaLayoutManager>(this));
}
-void ShelfWidget::SetPaintsBackground(
- ShelfBackgroundType background_type,
- BackgroundAnimatorChangeType change_type) {
+void ShelfWidget::SetPaintsBackground(ShelfBackgroundType background_type,
+ gfx::AnimationChangeType change_type) {
background_animator_.PaintBackground(background_type, change_type);
}
@@ -242,7 +243,7 @@ void ShelfWidget::PostCreateShelf() {
SetFocusCycler(WmShell::Get()->focus_cycler());
// Ensure the newly created |shelf_| gets current values.
- background_animator_.Initialize(this);
+ background_animator_.NotifyObserver(this);
// TODO(jamescook): The IsActiveUserSessionStarted() check may not be needed
// because the shelf is only created after the first user session is active.

Powered by Google App Engine
This is Rietveld 408576698