| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 UI_GFX_ANIMATION_ANIMATION_H_ | 5 #ifndef UI_GFX_ANIMATION_ANIMATION_H_ |
| 6 #define UI_GFX_ANIMATION_ANIMATION_H_ | 6 #define UI_GFX_ANIMATION_ANIMATION_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "ui/gfx/animation/animation_container_element.h" | 12 #include "ui/gfx/animation/animation_container_element.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 class Rect; | 15 class Rect; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace gfx { | 18 namespace gfx { |
| 19 | 19 |
| 20 class AnimationContainer; | 20 class AnimationContainer; |
| 21 class AnimationDelegate; | 21 class AnimationDelegate; |
| 22 class AnimationTestApi; |
| 22 | 23 |
| 23 // Base class used in implementing animations. You only need use this class if | 24 // Base class used in implementing animations. You only need use this class if |
| 24 // you're implementing a new animation type, otherwise you'll likely want one of | 25 // you're implementing a new animation type, otherwise you'll likely want one of |
| 25 // LinearAnimation, SlideAnimation, ThrobAnimation or MultiAnimation. | 26 // LinearAnimation, SlideAnimation, ThrobAnimation or MultiAnimation. |
| 26 // | 27 // |
| 27 // To subclass override Step, which is invoked as the animation progresses and | 28 // To subclass override Step, which is invoked as the animation progresses and |
| 28 // GetCurrentValue() to return the value appropriate to the animation. | 29 // GetCurrentValue() to return the value appropriate to the animation. |
| 29 class ANIMATION_EXPORT Animation : public AnimationContainerElement { | 30 class ANIMATION_EXPORT Animation : public AnimationContainerElement { |
| 30 public: | 31 public: |
| 31 explicit Animation(base::TimeDelta timer_interval); | 32 explicit Animation(base::TimeDelta timer_interval); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 AnimationContainer* container() { return container_.get(); } | 86 AnimationContainer* container() { return container_.get(); } |
| 86 base::TimeTicks start_time() const { return start_time_; } | 87 base::TimeTicks start_time() const { return start_time_; } |
| 87 AnimationDelegate* delegate() { return delegate_; } | 88 AnimationDelegate* delegate() { return delegate_; } |
| 88 | 89 |
| 89 // AnimationContainer::Element overrides | 90 // AnimationContainer::Element overrides |
| 90 void SetStartTime(base::TimeTicks start_time) override; | 91 void SetStartTime(base::TimeTicks start_time) override; |
| 91 void Step(base::TimeTicks time_now) override = 0; | 92 void Step(base::TimeTicks time_now) override = 0; |
| 92 base::TimeDelta GetTimerInterval() const override; | 93 base::TimeDelta GetTimerInterval() const override; |
| 93 | 94 |
| 94 private: | 95 private: |
| 96 friend class AnimationTestApi; |
| 97 |
| 95 // Interval for the animation. | 98 // Interval for the animation. |
| 96 const base::TimeDelta timer_interval_; | 99 const base::TimeDelta timer_interval_; |
| 97 | 100 |
| 98 // If true we're running. | 101 // If true we're running. |
| 99 bool is_animating_; | 102 bool is_animating_; |
| 100 | 103 |
| 101 // Our delegate; may be null. | 104 // Our delegate; may be null. |
| 102 AnimationDelegate* delegate_; | 105 AnimationDelegate* delegate_; |
| 103 | 106 |
| 104 // Container we're in. If non-null we're animating. | 107 // Container we're in. If non-null we're animating. |
| 105 scoped_refptr<AnimationContainer> container_; | 108 scoped_refptr<AnimationContainer> container_; |
| 106 | 109 |
| 107 // Time we started at. | 110 // Time we started at. |
| 108 base::TimeTicks start_time_; | 111 base::TimeTicks start_time_; |
| 109 | 112 |
| 110 DISALLOW_COPY_AND_ASSIGN(Animation); | 113 DISALLOW_COPY_AND_ASSIGN(Animation); |
| 111 }; | 114 }; |
| 112 | 115 |
| 113 } // namespace gfx | 116 } // namespace gfx |
| 114 | 117 |
| 115 #endif // UI_GFX_ANIMATION_ANIMATION_H_ | 118 #endif // UI_GFX_ANIMATION_ANIMATION_H_ |
| OLD | NEW |