Chromium Code Reviews| 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 19 matching lines...) Expand all Loading... | |
| 30 virtual ~ScrollbarAnimationControllerClient() {} | 30 virtual ~ScrollbarAnimationControllerClient() {} |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 // This abstract class represents the compositor-side analogy of | 33 // This abstract class represents the compositor-side analogy of |
| 34 // ScrollbarAnimator. Individual platforms should subclass it to provide | 34 // ScrollbarAnimator. Individual platforms should subclass it to provide |
| 35 // specialized implementation. | 35 // specialized implementation. |
| 36 class CC_EXPORT ScrollbarAnimationController { | 36 class CC_EXPORT ScrollbarAnimationController { |
| 37 public: | 37 public: |
| 38 virtual ~ScrollbarAnimationController(); | 38 virtual ~ScrollbarAnimationController(); |
| 39 | 39 |
| 40 bool Animate(base::TimeTicks now); | 40 virtual bool Animate(base::TimeTicks now); |
| 41 | 41 |
| 42 virtual void DidScrollBegin(); | 42 virtual void DidScrollBegin(); |
| 43 virtual void DidScrollUpdate(bool on_resize); | 43 virtual void DidScrollUpdate(bool on_resize); |
| 44 virtual void DidScrollEnd(); | 44 virtual void DidScrollEnd(); |
| 45 virtual void DidMouseDown() {} | 45 virtual void DidMouseDown() {} |
| 46 virtual void DidMouseUp() {} | 46 virtual void DidMouseUp() {} |
| 47 virtual void DidMouseLeave() {} | 47 virtual void DidMouseLeave() {} |
| 48 virtual void DidMouseMoveNear(float distance) {} | 48 virtual void DidMouseMoveNear(ScrollbarOrientation, float) {} |
| 49 virtual bool ScrollbarsHidden() const; | 49 virtual bool ScrollbarsHidden() const; |
| 50 | 50 |
| 51 protected: | 51 protected: |
| 52 ScrollbarAnimationController(int scroll_layer_id, | 52 ScrollbarAnimationController(int scroll_layer_id, |
| 53 ScrollbarAnimationControllerClient* client, | 53 ScrollbarAnimationControllerClient* client, |
| 54 base::TimeDelta delay_before_starting, | 54 base::TimeDelta delay_before_starting, |
| 55 base::TimeDelta resize_delay_before_starting); | 55 base::TimeDelta resize_delay_before_starting); |
| 56 | 56 |
| 57 virtual void RunAnimationFrame(float progress) = 0; | 57 virtual void RunAnimationFrame(float progress) = 0; |
| 58 virtual const base::TimeDelta& Duration() = 0; | 58 virtual const base::TimeDelta& Duration() = 0; |
| 59 | 59 |
| 60 void StartAnimation(); | 60 void StartAnimation(); |
| 61 void StopAnimation(); | 61 void StopAnimation(); |
| 62 | |
|
bokan
2017/01/20 18:57:25
Nit: remove new line
| |
| 62 ScrollbarSet Scrollbars() const; | 63 ScrollbarSet Scrollbars() const; |
| 63 | 64 |
| 64 ScrollbarAnimationControllerClient* client_; | 65 ScrollbarAnimationControllerClient* client_; |
| 65 | 66 |
| 66 void PostDelayedAnimationTask(bool on_resize); | 67 void PostDelayedAnimationTask(bool on_resize); |
| 67 | 68 |
| 68 int scroll_layer_id() const { return scroll_layer_id_; } | 69 int scroll_layer_id() const { return scroll_layer_id_; } |
| 69 | 70 |
| 71 bool animating_fade() const { return is_animating_; } | |
| 72 | |
| 70 private: | 73 private: |
| 71 // Returns how far through the animation we are as a progress value from | 74 // Returns how far through the animation we are as a progress value from |
| 72 // 0 to 1. | 75 // 0 to 1. |
| 73 float AnimationProgressAtTime(base::TimeTicks now); | 76 float AnimationProgressAtTime(base::TimeTicks now); |
| 74 | 77 |
| 75 base::TimeTicks last_awaken_time_; | 78 base::TimeTicks last_awaken_time_; |
| 76 base::TimeDelta delay_before_starting_; | 79 base::TimeDelta delay_before_starting_; |
| 77 base::TimeDelta resize_delay_before_starting_; | 80 base::TimeDelta resize_delay_before_starting_; |
| 78 | 81 |
| 79 bool is_animating_; | 82 bool is_animating_; |
| 80 | 83 |
| 81 int scroll_layer_id_; | 84 int scroll_layer_id_; |
| 82 bool currently_scrolling_; | 85 bool currently_scrolling_; |
| 83 bool scroll_gesture_has_scrolled_; | 86 bool scroll_gesture_has_scrolled_; |
| 84 base::CancelableClosure delayed_scrollbar_fade_; | 87 base::CancelableClosure delayed_scrollbar_fade_; |
| 85 | 88 |
| 86 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_; | 89 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_; |
| 87 }; | 90 }; |
| 88 | 91 |
| 89 } // namespace cc | 92 } // namespace cc |
| 90 | 93 |
| 91 #endif // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ | 94 #endif // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ |
| OLD | NEW |