Chromium Code Reviews| 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 |