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" |
11 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
12 #include "cc/layers/layer_impl.h" | 12 #include "cc/layers/layer_impl.h" |
13 #include "cc/layers/scrollbar_layer_impl_base.h" | 13 #include "cc/layers/scrollbar_layer_impl_base.h" |
14 #include "ui/gfx/geometry/vector2d_f.h" | 14 #include "ui/gfx/geometry/vector2d_f.h" |
15 | 15 |
16 namespace cc { | 16 namespace cc { |
17 | 17 |
18 class ScrollbarAnimationController; | 18 class ScrollbarAnimationController; |
19 | 19 |
20 class CC_EXPORT ScrollbarAnimationControllerClient { | 20 class CC_EXPORT ScrollbarAnimationControllerClient { |
21 public: | 21 public: |
22 virtual void PostDelayedScrollbarAnimationTask(const base::Closure& task, | 22 virtual void PostDelayedScrollbarAnimationTask(const base::Closure& task, |
23 base::TimeDelta delay) = 0; | 23 base::TimeDelta delay) = 0; |
24 virtual void SetNeedsRedrawForScrollbarAnimation() = 0; | 24 virtual void SetNeedsRedrawForScrollbarAnimation() = 0; |
25 virtual void SetNeedsAnimateForScrollbarAnimation() = 0; | 25 virtual void SetNeedsAnimateForScrollbarAnimation() = 0; |
26 virtual ScrollbarSet ScrollbarsFor(int scroll_layer_id) const = 0; | 26 virtual ScrollbarSet ScrollbarsFor(int scroll_layer_id) const = 0; |
27 virtual void SetScrollbarsHidden(int layer_id, bool hidden) = 0; | |
27 | 28 |
28 protected: | 29 protected: |
29 virtual ~ScrollbarAnimationControllerClient() {} | 30 virtual ~ScrollbarAnimationControllerClient() {} |
30 }; | 31 }; |
31 | 32 |
32 // This abstract class represents the compositor-side analogy of | 33 // This abstract class represents the compositor-side analogy of |
33 // ScrollbarAnimator. Individual platforms should subclass it to provide | 34 // ScrollbarAnimator. Individual platforms should subclass it to provide |
34 // specialized implementation. | 35 // specialized implementation. |
35 class CC_EXPORT ScrollbarAnimationController { | 36 class CC_EXPORT ScrollbarAnimationController { |
36 public: | 37 public: |
(...skipping 19 matching lines...) Expand all Loading... | |
56 virtual const base::TimeDelta& Duration() = 0; | 57 virtual const base::TimeDelta& Duration() = 0; |
57 | 58 |
58 void StartAnimation(); | 59 void StartAnimation(); |
59 void StopAnimation(); | 60 void StopAnimation(); |
60 ScrollbarSet Scrollbars() const; | 61 ScrollbarSet Scrollbars() const; |
61 | 62 |
62 ScrollbarAnimationControllerClient* client_; | 63 ScrollbarAnimationControllerClient* client_; |
63 | 64 |
64 void PostDelayedAnimationTask(bool on_resize); | 65 void PostDelayedAnimationTask(bool on_resize); |
65 | 66 |
67 int scroll_layer_id_; | |
aelias_OOO_until_Jul13
2016/10/26 19:01:03
Please leave this private and introduce a protecte
bokan
2016/10/27 20:56:46
Done.
| |
68 | |
66 private: | 69 private: |
67 // Returns how far through the animation we are as a progress value from | 70 // Returns how far through the animation we are as a progress value from |
68 // 0 to 1. | 71 // 0 to 1. |
69 float AnimationProgressAtTime(base::TimeTicks now); | 72 float AnimationProgressAtTime(base::TimeTicks now); |
70 | 73 |
71 base::TimeTicks last_awaken_time_; | 74 base::TimeTicks last_awaken_time_; |
72 base::TimeDelta delay_before_starting_; | 75 base::TimeDelta delay_before_starting_; |
73 base::TimeDelta resize_delay_before_starting_; | 76 base::TimeDelta resize_delay_before_starting_; |
74 | 77 |
75 bool is_animating_; | 78 bool is_animating_; |
76 | 79 |
77 int scroll_layer_id_; | |
78 bool currently_scrolling_; | 80 bool currently_scrolling_; |
79 bool scroll_gesture_has_scrolled_; | 81 bool scroll_gesture_has_scrolled_; |
80 base::CancelableClosure delayed_scrollbar_fade_; | 82 base::CancelableClosure delayed_scrollbar_fade_; |
81 | 83 |
82 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_; | 84 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_; |
83 }; | 85 }; |
84 | 86 |
85 } // namespace cc | 87 } // namespace cc |
86 | 88 |
87 #endif // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ | 89 #endif // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ |
OLD | NEW |