OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include <vector> | |
6 | |
7 #include "ash/ash_export.h" | |
8 #include "ash/common/wm/background_animator.h" | |
9 #include "ash/shelf/shelf_layout_manager_observer.h" | |
10 #include "base/macros.h" | |
11 | |
12 namespace ash { | |
13 | |
14 class ShelfBackgroundAnimatorDelegate; | |
15 | |
James Cook
2016/06/09 23:40:37
This will need a good class comment.
bruthig
2016/06/14 16:40:44
Acknowledged.
| |
16 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.
| |
17 public BackgroundAnimatorDelegate { | |
18 public: | |
19 ShelfBackgroundAnimator(); | |
20 ~ShelfBackgroundAnimator() override; | |
21 | |
22 ShelfBackgroundType target_background_type() const { | |
23 return target_background_type_; | |
24 } | |
25 | |
26 void AddShelfBackgroundDelegate(ShelfBackgroundAnimatorDelegate* delegate); | |
27 | |
28 void AddShelfItemBackgroundDelegate( | |
29 ShelfBackgroundAnimatorDelegate* delegate); | |
30 | |
31 void PaintBackground(ShelfBackgroundType background_type, | |
32 BackgroundAnimatorChangeType change_type); | |
33 | |
34 protected: | |
35 // ShelfLayoutManagerObserver: | |
36 void OnBackgroundUpdated(ShelfBackgroundType background_type, | |
37 BackgroundAnimatorChangeType change_type) override; | |
38 | |
39 // BackgroundAnimatorDelegate: | |
40 void UpdateBackground(BackgroundAnimator* animator, int alpha) override; | |
41 void BackgroundAnimationEnded(bool successfully) override; | |
42 | |
43 private: | |
44 using DelegateList = std::vector<ShelfBackgroundAnimatorDelegate*>; | |
45 | |
46 void UpdateDelegates(DelegateList delegates, int alpha); | |
47 | |
48 void CreateAnimators(ShelfBackgroundType background_type, | |
49 BackgroundAnimatorChangeType change_type); | |
50 | |
51 void ConfigureAnimatorsDuration(ShelfBackgroundType background_type, | |
52 BackgroundAnimatorChangeType change_type); | |
53 | |
54 ShelfBackgroundType target_background_type_; | |
55 ShelfBackgroundType previous_background_type_; | |
56 | |
57 int previous_shelf_alpha_; | |
58 | |
59 int previous_shelf_item_alpha_; | |
60 | |
61 std::unique_ptr<BackgroundAnimator> shelf_background_animator_; | |
62 | |
63 std::unique_ptr<BackgroundAnimator> shelf_item_background_animator_; | |
64 | |
65 DelegateList shelf_background_delegates_; | |
66 | |
67 DelegateList shelf_item_background_delegates_; | |
68 | |
69 DISALLOW_COPY_AND_ASSIGN(ShelfBackgroundAnimator); | |
70 }; | |
71 | |
72 } // namespace ash | |
OLD | NEW |