| 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_BASE_ANIMATION_ANIMATION_H_ | 5 #ifndef UI_BASE_ANIMATION_ANIMATION_H_ |
| 6 #define UI_BASE_ANIMATION_ANIMATION_H_ | 6 #define UI_BASE_ANIMATION_ANIMATION_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" |
| 9 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 10 #include "base/time.h" | 11 #include "base/time.h" |
| 11 #include "ui/base/animation/animation_container_element.h" | 12 #include "ui/base/animation/animation_container_element.h" |
| 12 | 13 |
| 13 namespace gfx { | 14 namespace gfx { |
| 14 class Rect; | 15 class Rect; |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace ui { | 18 namespace ui { |
| 18 | 19 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // Invoked from stop to determine if cancel should be invoked. If this returns | 75 // Invoked from stop to determine if cancel should be invoked. If this returns |
| 75 // true the delegate is notified the animation was canceled, otherwise the | 76 // true the delegate is notified the animation was canceled, otherwise the |
| 76 // delegate is notified the animation stopped. | 77 // delegate is notified the animation stopped. |
| 77 virtual bool ShouldSendCanceledFromStop(); | 78 virtual bool ShouldSendCanceledFromStop(); |
| 78 | 79 |
| 79 AnimationContainer* container() { return container_.get(); } | 80 AnimationContainer* container() { return container_.get(); } |
| 80 base::TimeTicks start_time() const { return start_time_; } | 81 base::TimeTicks start_time() const { return start_time_; } |
| 81 AnimationDelegate* delegate() { return delegate_; } | 82 AnimationDelegate* delegate() { return delegate_; } |
| 82 | 83 |
| 83 // AnimationContainer::Element overrides | 84 // AnimationContainer::Element overrides |
| 84 virtual void SetStartTime(base::TimeTicks start_time); | 85 virtual void SetStartTime(base::TimeTicks start_time) OVERRIDE; |
| 85 virtual void Step(base::TimeTicks time_now) = 0; | 86 virtual void Step(base::TimeTicks time_now) = 0; |
| 86 virtual base::TimeDelta GetTimerInterval() const; | 87 virtual base::TimeDelta GetTimerInterval() const OVERRIDE; |
| 87 | 88 |
| 88 private: | 89 private: |
| 89 // Interval for the animation. | 90 // Interval for the animation. |
| 90 const base::TimeDelta timer_interval_; | 91 const base::TimeDelta timer_interval_; |
| 91 | 92 |
| 92 // If true we're running. | 93 // If true we're running. |
| 93 bool is_animating_; | 94 bool is_animating_; |
| 94 | 95 |
| 95 // Our delegate; may be null. | 96 // Our delegate; may be null. |
| 96 AnimationDelegate* delegate_; | 97 AnimationDelegate* delegate_; |
| 97 | 98 |
| 98 // Container we're in. If non-null we're animating. | 99 // Container we're in. If non-null we're animating. |
| 99 scoped_refptr<AnimationContainer> container_; | 100 scoped_refptr<AnimationContainer> container_; |
| 100 | 101 |
| 101 // Time we started at. | 102 // Time we started at. |
| 102 base::TimeTicks start_time_; | 103 base::TimeTicks start_time_; |
| 103 | 104 |
| 104 DISALLOW_COPY_AND_ASSIGN(Animation); | 105 DISALLOW_COPY_AND_ASSIGN(Animation); |
| 105 }; | 106 }; |
| 106 | 107 |
| 107 } // namespace ui | 108 } // namespace ui |
| 108 | 109 |
| 109 #endif // UI_BASE_ANIMATION_ANIMATION_H_ | 110 #endif // UI_BASE_ANIMATION_ANIMATION_H_ |
| OLD | NEW |