OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 APP_ANIMATION_H_ | 5 #ifndef APP_ANIMATION_H_ |
6 #define APP_ANIMATION_H_ | 6 #define APP_ANIMATION_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "app/animation_container_element.h" | 9 #include "app/animation_container_element.h" |
10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // Invoked from Start to allow subclasses to prepare for the animation. | 65 // Invoked from Start to allow subclasses to prepare for the animation. |
66 virtual void AnimationStarted() {} | 66 virtual void AnimationStarted() {} |
67 | 67 |
68 // Invoked from Stop after we're removed from the container but before the | 68 // Invoked from Stop after we're removed from the container but before the |
69 // delegate has been invoked. | 69 // delegate has been invoked. |
70 virtual void AnimationStopped() {} | 70 virtual void AnimationStopped() {} |
71 | 71 |
72 // Invoked from stop to determine if cancel should be invoked. If this returns | 72 // Invoked from stop to determine if cancel should be invoked. If this returns |
73 // true the delegate is notified the animation was canceled, otherwise the | 73 // true the delegate is notified the animation was canceled, otherwise the |
74 // delegate is notified the animation stopped. | 74 // delegate is notified the animation stopped. |
75 virtual bool ShouldSendCanceledFromStop() { return false; } | 75 virtual bool ShouldSendCanceledFromStop(); |
76 | 76 |
77 AnimationContainer* container() { return container_.get(); } | 77 AnimationContainer* container() { return container_.get(); } |
78 base::TimeTicks start_time() const { return start_time_; } | 78 base::TimeTicks start_time() const { return start_time_; } |
79 AnimationDelegate* delegate() { return delegate_; } | 79 AnimationDelegate* delegate() { return delegate_; } |
80 | 80 |
81 // AnimationContainer::Element overrides | 81 // AnimationContainer::Element overrides |
82 virtual void SetStartTime(base::TimeTicks start_time); | 82 virtual void SetStartTime(base::TimeTicks start_time); |
83 virtual void Step(base::TimeTicks time_now) = 0; | 83 virtual void Step(base::TimeTicks time_now) = 0; |
84 virtual base::TimeDelta GetTimerInterval() const { return timer_interval_; } | 84 virtual base::TimeDelta GetTimerInterval() const; |
85 | 85 |
86 private: | 86 private: |
87 // Interval for the animation. | 87 // Interval for the animation. |
88 const base::TimeDelta timer_interval_; | 88 const base::TimeDelta timer_interval_; |
89 | 89 |
90 // If true we're running. | 90 // If true we're running. |
91 bool is_animating_; | 91 bool is_animating_; |
92 | 92 |
93 // Our delegate; may be null. | 93 // Our delegate; may be null. |
94 AnimationDelegate* delegate_; | 94 AnimationDelegate* delegate_; |
95 | 95 |
96 // Container we're in. If non-null we're animating. | 96 // Container we're in. If non-null we're animating. |
97 scoped_refptr<AnimationContainer> container_; | 97 scoped_refptr<AnimationContainer> container_; |
98 | 98 |
99 // Time we started at. | 99 // Time we started at. |
100 base::TimeTicks start_time_; | 100 base::TimeTicks start_time_; |
101 | 101 |
102 DISALLOW_COPY_AND_ASSIGN(Animation); | 102 DISALLOW_COPY_AND_ASSIGN(Animation); |
103 }; | 103 }; |
104 | 104 |
105 #endif // APP_ANIMATION_H_ | 105 #endif // APP_ANIMATION_H_ |
OLD | NEW |