OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_BROWSER_CONTROLS_OFFSET_MANAGER_H_ | 5 #ifndef CC_INPUT_BROWSER_CONTROLS_OFFSET_MANAGER_H_ |
6 #define CC_INPUT_BROWSER_CONTROLS_OFFSET_MANAGER_H_ | 6 #define CC_INPUT_BROWSER_CONTROLS_OFFSET_MANAGER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 BrowserControlsOffsetManager(BrowserControlsOffsetManagerClient* client, | 73 BrowserControlsOffsetManager(BrowserControlsOffsetManagerClient* client, |
74 float controls_show_threshold, | 74 float controls_show_threshold, |
75 float controls_hide_threshold); | 75 float controls_hide_threshold); |
76 | 76 |
77 private: | 77 private: |
78 void ResetAnimations(); | 78 void ResetAnimations(); |
79 void SetupAnimation(AnimationDirection direction); | 79 void SetupAnimation(AnimationDirection direction); |
80 void StartAnimationIfNecessary(); | 80 void StartAnimationIfNecessary(); |
81 bool IsAnimationComplete(float new_ratio); | 81 bool IsAnimationComplete(float new_ratio); |
82 void ResetBaseline(); | 82 void ResetBaseline(); |
83 // Offset computation regardless of top or bottom control state. | |
84 float ContentOffsetInternal() const; | |
85 | 83 |
86 // The client manages the lifecycle of this. | 84 // The client manages the lifecycle of this. |
87 BrowserControlsOffsetManagerClient* client_; | 85 BrowserControlsOffsetManagerClient* client_; |
88 | 86 |
89 base::TimeTicks animation_start_time_; | 87 base::TimeTicks animation_start_time_; |
90 float animation_start_value_; | 88 float animation_start_value_; |
91 base::TimeTicks animation_stop_time_; | 89 base::TimeTicks animation_stop_time_; |
92 float animation_stop_value_; | 90 float animation_stop_value_; |
93 AnimationDirection animation_direction_; | 91 AnimationDirection animation_direction_; |
94 | 92 |
95 BrowserControlsState permitted_state_; | 93 BrowserControlsState permitted_state_; |
96 | 94 |
97 // Accumulated scroll delta since last baseline reset | 95 // Accumulated scroll delta since last baseline reset |
98 float accumulated_scroll_delta_; | 96 float accumulated_scroll_delta_; |
99 | 97 |
100 // Content offset when last baseline reset occurred | 98 // Content offset when last baseline reset occurred. |
101 float baseline_content_offset_; | 99 float baseline_top_content_offset_; |
| 100 float baseline_bottom_content_offset_; |
102 | 101 |
103 // The percent height of the visible control such that it must be shown | 102 // The percent height of the visible control such that it must be shown |
104 // when the user stops the scroll. | 103 // when the user stops the scroll. |
105 float controls_show_threshold_; | 104 float controls_show_threshold_; |
106 | 105 |
107 // The percent height of the visible control such that it must be hidden | 106 // The percent height of the visible control such that it must be hidden |
108 // when the user stops the scroll. | 107 // when the user stops the scroll. |
109 float controls_hide_threshold_; | 108 float controls_hide_threshold_; |
110 | 109 |
111 bool pinch_gesture_active_; | 110 bool pinch_gesture_active_; |
112 | 111 |
113 DISALLOW_COPY_AND_ASSIGN(BrowserControlsOffsetManager); | 112 DISALLOW_COPY_AND_ASSIGN(BrowserControlsOffsetManager); |
114 }; | 113 }; |
115 | 114 |
116 } // namespace cc | 115 } // namespace cc |
117 | 116 |
118 #endif // CC_INPUT_BROWSER_CONTROLS_OFFSET_MANAGER_H_ | 117 #endif // CC_INPUT_BROWSER_CONTROLS_OFFSET_MANAGER_H_ |
OLD | NEW |