| 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_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ | 5 #ifndef CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ |
| 6 #define CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ | 6 #define CC_INPUT_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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 virtual void DidScrollEnd(); | 43 virtual void DidScrollEnd(); |
| 44 virtual void DidCaptureScrollbarBegin() {} | 44 virtual void DidCaptureScrollbarBegin() {} |
| 45 virtual void DidCaptureScrollbarEnd() {} | 45 virtual void DidCaptureScrollbarEnd() {} |
| 46 virtual void DidMouseMoveOffScrollbar() {} | 46 virtual void DidMouseMoveOffScrollbar() {} |
| 47 virtual void DidMouseMoveNear(float distance) {} | 47 virtual void DidMouseMoveNear(float distance) {} |
| 48 | 48 |
| 49 protected: | 49 protected: |
| 50 ScrollbarAnimationController(int scroll_layer_id, | 50 ScrollbarAnimationController(int scroll_layer_id, |
| 51 ScrollbarAnimationControllerClient* client, | 51 ScrollbarAnimationControllerClient* client, |
| 52 base::TimeDelta delay_before_starting, | 52 base::TimeDelta delay_before_starting, |
| 53 base::TimeDelta resize_delay_before_starting, | 53 base::TimeDelta resize_delay_before_starting); |
| 54 base::TimeDelta duration); | |
| 55 | 54 |
| 56 virtual void RunAnimationFrame(float progress) = 0; | 55 virtual void RunAnimationFrame(float progress) = 0; |
| 56 virtual const base::TimeDelta& Duration() = 0; |
| 57 | 57 |
| 58 void StartAnimation(); | 58 void StartAnimation(); |
| 59 void StopAnimation(); | 59 void StopAnimation(); |
| 60 ScrollbarSet Scrollbars() const; | 60 ScrollbarSet Scrollbars() const; |
| 61 | 61 |
| 62 ScrollbarAnimationControllerClient* client_; | 62 ScrollbarAnimationControllerClient* client_; |
| 63 | 63 |
| 64 void PostDelayedAnimationTask(bool on_resize); |
| 65 |
| 64 private: | 66 private: |
| 65 // Returns how far through the animation we are as a progress value from | 67 // Returns how far through the animation we are as a progress value from |
| 66 // 0 to 1. | 68 // 0 to 1. |
| 67 float AnimationProgressAtTime(base::TimeTicks now); | 69 float AnimationProgressAtTime(base::TimeTicks now); |
| 68 | 70 |
| 69 void PostDelayedAnimationTask(bool on_resize); | |
| 70 | |
| 71 base::TimeTicks last_awaken_time_; | 71 base::TimeTicks last_awaken_time_; |
| 72 base::TimeDelta delay_before_starting_; | 72 base::TimeDelta delay_before_starting_; |
| 73 base::TimeDelta resize_delay_before_starting_; | 73 base::TimeDelta resize_delay_before_starting_; |
| 74 base::TimeDelta duration_; | |
| 75 | 74 |
| 76 bool is_animating_; | 75 bool is_animating_; |
| 77 | 76 |
| 78 int scroll_layer_id_; | 77 int scroll_layer_id_; |
| 79 bool currently_scrolling_; | 78 bool currently_scrolling_; |
| 80 bool scroll_gesture_has_scrolled_; | 79 bool scroll_gesture_has_scrolled_; |
| 81 base::CancelableClosure delayed_scrollbar_fade_; | 80 base::CancelableClosure delayed_scrollbar_fade_; |
| 82 | 81 |
| 83 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_; | 82 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_; |
| 84 }; | 83 }; |
| 85 | 84 |
| 86 } // namespace cc | 85 } // namespace cc |
| 87 | 86 |
| 88 #endif // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ | 87 #endif // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ |
| OLD | NEW |