| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 CC_ANIMATION_SCROLLBAR_ANIMATION_CONTROLLER_H_ | 5 #ifndef CC_ANIMATION_SCROLLBAR_ANIMATION_CONTROLLER_H_ |
| 6 #define CC_ANIMATION_SCROLLBAR_ANIMATION_CONTROLLER_H_ | 6 #define CC_ANIMATION_SCROLLBAR_ANIMATION_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/cancelable_callback.h" | 8 #include "base/cancelable_callback.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // This abstract class represents the compositor-side analogy of | 25 // This abstract class represents the compositor-side analogy of |
| 26 // ScrollbarAnimator. Individual platforms should subclass it to provide | 26 // ScrollbarAnimator. Individual platforms should subclass it to provide |
| 27 // specialized implementation. | 27 // specialized implementation. |
| 28 class CC_EXPORT ScrollbarAnimationController { | 28 class CC_EXPORT ScrollbarAnimationController { |
| 29 public: | 29 public: |
| 30 virtual ~ScrollbarAnimationController(); | 30 virtual ~ScrollbarAnimationController(); |
| 31 | 31 |
| 32 void Animate(base::TimeTicks now); | 32 void Animate(base::TimeTicks now); |
| 33 | 33 |
| 34 virtual void DidScrollBegin(); | 34 virtual void DidScrollBegin(); |
| 35 virtual void DidScrollUpdate(); | 35 virtual void DidScrollUpdate(bool on_resize); |
| 36 virtual void DidScrollEnd(); | 36 virtual void DidScrollEnd(); |
| 37 virtual void DidMouseMoveOffScrollbar() {} | 37 virtual void DidMouseMoveOffScrollbar() {} |
| 38 virtual void DidMouseMoveNear(float distance) {} | 38 virtual void DidMouseMoveNear(float distance) {} |
| 39 | 39 |
| 40 protected: | 40 protected: |
| 41 ScrollbarAnimationController(ScrollbarAnimationControllerClient* client, | 41 ScrollbarAnimationController(ScrollbarAnimationControllerClient* client, |
| 42 base::TimeDelta delay_before_starting, | 42 base::TimeDelta delay_before_starting, |
| 43 base::TimeDelta resize_delay_before_starting, |
| 43 base::TimeDelta duration); | 44 base::TimeDelta duration); |
| 44 | 45 |
| 45 virtual void RunAnimationFrame(float progress) = 0; | 46 virtual void RunAnimationFrame(float progress) = 0; |
| 46 | 47 |
| 47 void StartAnimation(); | 48 void StartAnimation(); |
| 48 void StopAnimation(); | 49 void StopAnimation(); |
| 49 | 50 |
| 50 private: | 51 private: |
| 51 // Returns how far through the animation we are as a progress value from | 52 // Returns how far through the animation we are as a progress value from |
| 52 // 0 to 1. | 53 // 0 to 1. |
| 53 float AnimationProgressAtTime(base::TimeTicks now); | 54 float AnimationProgressAtTime(base::TimeTicks now); |
| 54 | 55 |
| 55 void PostDelayedFade(); | 56 void PostDelayedFade(bool on_resize); |
| 56 | 57 |
| 57 ScrollbarAnimationControllerClient* client_; | 58 ScrollbarAnimationControllerClient* client_; |
| 58 base::TimeTicks last_awaken_time_; | 59 base::TimeTicks last_awaken_time_; |
| 59 base::TimeDelta delay_before_starting_; | 60 base::TimeDelta delay_before_starting_; |
| 61 base::TimeDelta resize_delay_before_starting_; |
| 60 base::TimeDelta duration_; | 62 base::TimeDelta duration_; |
| 61 bool is_animating_; | 63 bool is_animating_; |
| 62 | 64 |
| 63 bool currently_scrolling_; | 65 bool currently_scrolling_; |
| 64 bool scroll_gesture_has_scrolled_; | 66 bool scroll_gesture_has_scrolled_; |
| 65 base::CancelableClosure delayed_scrollbar_fade_; | 67 base::CancelableClosure delayed_scrollbar_fade_; |
| 66 | 68 |
| 67 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_; | 69 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_; |
| 68 }; | 70 }; |
| 69 | 71 |
| 70 } // namespace cc | 72 } // namespace cc |
| 71 | 73 |
| 72 #endif // CC_ANIMATION_SCROLLBAR_ANIMATION_CONTROLLER_H_ | 74 #endif // CC_ANIMATION_SCROLLBAR_ANIMATION_CONTROLLER_H_ |
| OLD | NEW |