Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Side by Side Diff: cc/input/scrollbar_animation_controller.h

Issue 2716453005: Aura Overlay Scrollbars appear when mouse hovers over scroller edge (Closed)
Patch Set: rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 25 matching lines...) Expand all
36 // independent between vertical/horizontal and are managed by the 36 // independent between vertical/horizontal and are managed by the
37 // SingleScrollbarAnimationControllerThinnings. 37 // SingleScrollbarAnimationControllerThinnings.
38 class CC_EXPORT ScrollbarAnimationController { 38 class CC_EXPORT ScrollbarAnimationController {
39 public: 39 public:
40 // ScrollbarAnimationController for Android. It only has fade in/out 40 // ScrollbarAnimationController for Android. It only has fade in/out
41 // animation. 41 // animation.
42 static std::unique_ptr<ScrollbarAnimationController> 42 static std::unique_ptr<ScrollbarAnimationController>
43 CreateScrollbarAnimationControllerAndroid( 43 CreateScrollbarAnimationControllerAndroid(
44 int scroll_layer_id, 44 int scroll_layer_id,
45 ScrollbarAnimationControllerClient* client, 45 ScrollbarAnimationControllerClient* client,
46 base::TimeDelta delay_before_starting, 46 base::TimeDelta fade_out_delay,
47 base::TimeDelta resize_delay_before_starting, 47 base::TimeDelta fade_out_resize_delay,
48 base::TimeDelta fade_duration); 48 base::TimeDelta fade_out_duration);
49 49
50 // ScrollbarAnimationController for Desktop Overlay Scrollbar. It has fade in/ 50 // ScrollbarAnimationController for Desktop Overlay Scrollbar. It has fade in/
51 // out animation and thinning animation. 51 // out animation and thinning animation.
52 static std::unique_ptr<ScrollbarAnimationController> 52 static std::unique_ptr<ScrollbarAnimationController>
53 CreateScrollbarAnimationControllerAuraOverlay( 53 CreateScrollbarAnimationControllerAuraOverlay(
54 int scroll_layer_id, 54 int scroll_layer_id,
55 ScrollbarAnimationControllerClient* client, 55 ScrollbarAnimationControllerClient* client,
56 base::TimeDelta delay_before_starting, 56 base::TimeDelta fade_in_delay,
57 base::TimeDelta resize_delay_before_starting, 57 base::TimeDelta fade_out_delay,
58 base::TimeDelta fade_duration, 58 base::TimeDelta fade_out_resize_delay,
59 base::TimeDelta fade_out_duration,
59 base::TimeDelta thinning_duration); 60 base::TimeDelta thinning_duration);
60 61
61 ~ScrollbarAnimationController(); 62 ~ScrollbarAnimationController();
62 63
63 bool ScrollbarsHidden() const; 64 bool ScrollbarsHidden() const;
64 65
65 bool Animate(base::TimeTicks now); 66 bool Animate(base::TimeTicks now);
66 67
67 void DidScrollBegin(); 68 void DidScrollBegin();
68 void DidScrollUpdate(bool on_resize); 69 void DidScrollUpdate(bool on_resize);
69 void DidScrollEnd(); 70 void DidScrollEnd();
70 71
71 void DidMouseDown(); 72 void DidMouseDown();
72 void DidMouseUp(); 73 void DidMouseUp();
73 void DidMouseLeave(); 74 void DidMouseLeave();
74 void DidMouseMoveNear(ScrollbarOrientation, float); 75 void DidMouseMoveNear(ScrollbarOrientation, float);
75 76
76 bool mouse_is_over_scrollbar(ScrollbarOrientation orientation) const; 77 bool mouse_is_over_scrollbar(ScrollbarOrientation orientation) const;
78 bool mouse_is_over_any_scrollbar() const;
77 bool mouse_is_near_scrollbar(ScrollbarOrientation orientation) const; 79 bool mouse_is_near_scrollbar(ScrollbarOrientation orientation) const;
78 bool mouse_is_near_any_scrollbar() const; 80 bool mouse_is_near_any_scrollbar() const;
79 81
80 private: 82 private:
81 ScrollbarAnimationController(int scroll_layer_id, 83 ScrollbarAnimationController(int scroll_layer_id,
82 ScrollbarAnimationControllerClient* client, 84 ScrollbarAnimationControllerClient* client,
83 base::TimeDelta delay_before_starting, 85 base::TimeDelta fade_out_delay,
84 base::TimeDelta resize_delay_before_starting, 86 base::TimeDelta fade_out_resize_delay,
85 base::TimeDelta fade_duration); 87 base::TimeDelta fade_out_duration);
86 88
87 ScrollbarAnimationController(int scroll_layer_id, 89 ScrollbarAnimationController(int scroll_layer_id,
88 ScrollbarAnimationControllerClient* client, 90 ScrollbarAnimationControllerClient* client,
89 base::TimeDelta delay_before_starting, 91 base::TimeDelta fade_in_delay,
90 base::TimeDelta resize_delay_before_starting, 92 base::TimeDelta fade_out_delay,
91 base::TimeDelta fade_duration, 93 base::TimeDelta fade_out_resize_delay,
94 base::TimeDelta fade_out_duration,
92 base::TimeDelta thinning_duration); 95 base::TimeDelta thinning_duration);
93 96
94 ScrollbarSet Scrollbars() const; 97 ScrollbarSet Scrollbars() const;
95 SingleScrollbarAnimationControllerThinning& GetScrollbarAnimationController( 98 SingleScrollbarAnimationControllerThinning& GetScrollbarAnimationController(
96 ScrollbarOrientation) const; 99 ScrollbarOrientation) const;
97 100
98 // Returns how far through the animation we are as a progress value from 101 // Returns how far through the animation we are as a progress value from
99 // 0 to 1. 102 // 0 to 1.
100 float AnimationProgressAtTime(base::TimeTicks now); 103 float AnimationProgressAtTime(base::TimeTicks now);
101 void RunAnimationFrame(float progress); 104 void RunAnimationFrame(float progress);
102 105
103 void StartAnimation(); 106 void StartAnimation();
104 void StopAnimation(); 107 void StopAnimation();
105 108
106 ScrollbarAnimationControllerClient* client_; 109 void FadeIn();
107 110
108 void PostDelayedAnimationTask(bool on_resize); 111 void PostDelayedFadeIn();
112 void PostDelayedFadeOut(bool on_resize);
109 113
110 bool Captured() const; 114 bool Captured() const;
111 115
112 void ApplyOpacityToScrollbars(float opacity); 116 void ApplyOpacityToScrollbars(float opacity);
113 117
118 ScrollbarAnimationControllerClient* client_;
119
114 base::TimeTicks last_awaken_time_; 120 base::TimeTicks last_awaken_time_;
115 base::TimeDelta delay_before_starting_; 121 base::TimeDelta fade_in_delay_;
116 base::TimeDelta resize_delay_before_starting_; 122 base::TimeDelta fade_out_delay_;
123 base::TimeDelta fade_out_resize_delay_;
117 124
118 bool is_animating_; 125 bool is_animating_;
119 126
120 const int scroll_layer_id_; 127 const int scroll_layer_id_;
121 bool currently_scrolling_; 128 bool currently_scrolling_;
122 bool scroll_gesture_has_scrolled_; 129 bool scroll_gesture_has_scrolled_;
123 130
124 base::CancelableClosure delayed_scrollbar_fade_; 131 base::CancelableClosure delayed_scrollbar_fade_in_;
132 base::CancelableClosure delayed_scrollbar_fade_out_;
133
125 float opacity_; 134 float opacity_;
126 base::TimeDelta fade_duration_; 135 base::TimeDelta fade_out_duration_;
127 136
128 const bool need_thinning_animation_; 137 const bool need_thinning_animation_;
129 std::unique_ptr<SingleScrollbarAnimationControllerThinning> 138 std::unique_ptr<SingleScrollbarAnimationControllerThinning>
130 vertical_controller_; 139 vertical_controller_;
131 std::unique_ptr<SingleScrollbarAnimationControllerThinning> 140 std::unique_ptr<SingleScrollbarAnimationControllerThinning>
132 horizontal_controller_; 141 horizontal_controller_;
133 142
134 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_; 143 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_;
135 }; 144 };
136 145
137 } // namespace cc 146 } // namespace cc
138 147
139 #endif // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_ 148 #endif // CC_INPUT_SCROLLBAR_ANIMATION_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/input/scrollbar_animation_controller.cc » ('j') | cc/input/scrollbar_animation_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698