OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SERVICES_VIEW_MANAGER_ANIMATION_RUNNER_H_ | 5 #ifndef SERVICES_VIEW_MANAGER_ANIMATION_RUNNER_H_ |
6 #define SERVICES_VIEW_MANAGER_ANIMATION_RUNNER_H_ | 6 #define SERVICES_VIEW_MANAGER_ANIMATION_RUNNER_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 private: | 79 private: |
80 enum CancelSource { | 80 enum CancelSource { |
81 // Cancel is the result of scheduling another animation for the view. | 81 // Cancel is the result of scheduling another animation for the view. |
82 CANCEL_SOURCE_SCHEDULE, | 82 CANCEL_SOURCE_SCHEDULE, |
83 | 83 |
84 // Cancel originates from an explicit call to cancel. | 84 // Cancel originates from an explicit call to cancel. |
85 CANCEL_SOURCE_CANCEL, | 85 CANCEL_SOURCE_CANCEL, |
86 }; | 86 }; |
87 | 87 |
88 using ViewToAnimationMap = | 88 using ViewToAnimationMap = |
89 base::ScopedPtrHashMap<ServerView*, ScheduledAnimationGroup>; | 89 base::ScopedPtrHashMap<ServerView*, scoped_ptr<ScheduledAnimationGroup>>; |
90 using IdToViewsMap = std::map<AnimationId, std::set<ServerView*>>; | 90 using IdToViewsMap = std::map<AnimationId, std::set<ServerView*>>; |
91 | 91 |
92 void CancelAnimationForViewImpl(ServerView* view, CancelSource source); | 92 void CancelAnimationForViewImpl(ServerView* view, CancelSource source); |
93 | 93 |
94 // Removes |view| from both |view_to_animation_map_| and |id_to_views_map_|. | 94 // Removes |view| from both |view_to_animation_map_| and |id_to_views_map_|. |
95 // Returns true if there are no more views animating with the animation id | 95 // Returns true if there are no more views animating with the animation id |
96 // the view is associated with. | 96 // the view is associated with. |
97 bool RemoveViewFromMaps(ServerView* view); | 97 bool RemoveViewFromMaps(ServerView* view); |
98 | 98 |
99 AnimationId next_id_; | 99 AnimationId next_id_; |
100 | 100 |
101 base::TimeTicks last_tick_time_; | 101 base::TimeTicks last_tick_time_; |
102 | 102 |
103 ObserverList<AnimationRunnerObserver> observers_; | 103 ObserverList<AnimationRunnerObserver> observers_; |
104 | 104 |
105 ViewToAnimationMap view_to_animation_map_; | 105 ViewToAnimationMap view_to_animation_map_; |
106 | 106 |
107 IdToViewsMap id_to_views_map_; | 107 IdToViewsMap id_to_views_map_; |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(AnimationRunner); | 109 DISALLOW_COPY_AND_ASSIGN(AnimationRunner); |
110 }; | 110 }; |
111 | 111 |
112 } // namespace view_manager | 112 } // namespace view_manager |
113 | 113 |
114 #endif // SERVICES_VIEW_MANAGER_ANIMATION_RUNNER_H_ | 114 #endif // SERVICES_VIEW_MANAGER_ANIMATION_RUNNER_H_ |
OLD | NEW |