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

Unified Diff: ash/shelf/shelf_background_animator.h

Issue 2053113002: Replaced BackgroundAnimator with ShelfBackgroundAnimator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/shelf/shelf_background_animator.h
diff --git a/ash/shelf/shelf_background_animator.h b/ash/shelf/shelf_background_animator.h
new file mode 100644
index 0000000000000000000000000000000000000000..1f0d48bee0e63164b31c4429c33c84b46811ffd9
--- /dev/null
+++ b/ash/shelf/shelf_background_animator.h
@@ -0,0 +1,72 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <vector>
+
+#include "ash/ash_export.h"
+#include "ash/common/wm/background_animator.h"
+#include "ash/shelf/shelf_layout_manager_observer.h"
+#include "base/macros.h"
+
+namespace ash {
+
+class ShelfBackgroundAnimatorDelegate;
+
James Cook 2016/06/09 23:40:37 This will need a good class comment.
bruthig 2016/06/14 16:40:44 Acknowledged.
+class ASH_EXPORT ShelfBackgroundAnimator : public ShelfLayoutManagerObserver,
James Cook 2016/06/09 23:40:37 I think it would be better if this class lived in
bruthig 2016/06/14 16:40:44 Done.
+ public BackgroundAnimatorDelegate {
+ public:
+ ShelfBackgroundAnimator();
+ ~ShelfBackgroundAnimator() override;
+
+ ShelfBackgroundType target_background_type() const {
+ return target_background_type_;
+ }
+
+ void AddShelfBackgroundDelegate(ShelfBackgroundAnimatorDelegate* delegate);
+
+ void AddShelfItemBackgroundDelegate(
+ ShelfBackgroundAnimatorDelegate* delegate);
+
+ void PaintBackground(ShelfBackgroundType background_type,
+ BackgroundAnimatorChangeType change_type);
+
+ protected:
+ // ShelfLayoutManagerObserver:
+ void OnBackgroundUpdated(ShelfBackgroundType background_type,
+ BackgroundAnimatorChangeType change_type) override;
+
+ // BackgroundAnimatorDelegate:
+ void UpdateBackground(BackgroundAnimator* animator, int alpha) override;
+ void BackgroundAnimationEnded(bool successfully) override;
+
+ private:
+ using DelegateList = std::vector<ShelfBackgroundAnimatorDelegate*>;
+
+ void UpdateDelegates(DelegateList delegates, int alpha);
+
+ void CreateAnimators(ShelfBackgroundType background_type,
+ BackgroundAnimatorChangeType change_type);
+
+ void ConfigureAnimatorsDuration(ShelfBackgroundType background_type,
+ BackgroundAnimatorChangeType change_type);
+
+ ShelfBackgroundType target_background_type_;
+ ShelfBackgroundType previous_background_type_;
+
+ int previous_shelf_alpha_;
+
+ int previous_shelf_item_alpha_;
+
+ std::unique_ptr<BackgroundAnimator> shelf_background_animator_;
+
+ std::unique_ptr<BackgroundAnimator> shelf_item_background_animator_;
+
+ DelegateList shelf_background_delegates_;
+
+ DelegateList shelf_item_background_delegates_;
+
+ DISALLOW_COPY_AND_ASSIGN(ShelfBackgroundAnimator);
+};
+
+} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698