| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_TOP_CONTROLS_MANAGER_H_ | 5 #ifndef CC_INPUT_TOP_CONTROLS_MANAGER_H_ |
| 6 #define CC_INPUT_TOP_CONTROLS_MANAGER_H_ | 6 #define CC_INPUT_TOP_CONTROLS_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "cc/input/top_controls_state.h" | 10 #include "cc/input/top_controls_state.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 void ScrollBegin(); | 55 void ScrollBegin(); |
| 56 gfx::Vector2dF ScrollBy(const gfx::Vector2dF& pending_delta); | 56 gfx::Vector2dF ScrollBy(const gfx::Vector2dF& pending_delta); |
| 57 void ScrollEnd(); | 57 void ScrollEnd(); |
| 58 | 58 |
| 59 // The caller should ensure that |Pinch{Begin,End}| are called within | 59 // The caller should ensure that |Pinch{Begin,End}| are called within |
| 60 // the scope of |Scroll{Begin,End}|. | 60 // the scope of |Scroll{Begin,End}|. |
| 61 void PinchBegin(); | 61 void PinchBegin(); |
| 62 void PinchEnd(); | 62 void PinchEnd(); |
| 63 | 63 |
| 64 void MainThreadHasStoppedFlinging(); |
| 65 |
| 64 gfx::Vector2dF Animate(base::TimeTicks monotonic_time); | 66 gfx::Vector2dF Animate(base::TimeTicks monotonic_time); |
| 65 | 67 |
| 66 protected: | 68 protected: |
| 67 TopControlsManager(TopControlsManagerClient* client, | 69 TopControlsManager(TopControlsManagerClient* client, |
| 68 float top_controls_show_threshold, | 70 float top_controls_show_threshold, |
| 69 float top_controls_hide_threshold); | 71 float top_controls_hide_threshold); |
| 70 | 72 |
| 71 private: | 73 private: |
| 72 void ResetAnimations(); | 74 void ResetAnimations(); |
| 73 void SetupAnimation(AnimationDirection direction); | 75 void SetupAnimation(AnimationDirection direction); |
| 74 void StartAnimationIfNecessary(); | 76 void StartAnimationIfNecessary(); |
| 75 bool IsAnimationCompleteAtTime(base::TimeTicks time); | 77 bool IsAnimationCompleteAtTime(base::TimeTicks time); |
| 78 void ResetBaseline(); |
| 76 | 79 |
| 77 TopControlsManagerClient* client_; // The client manages the lifecycle of | 80 TopControlsManagerClient* client_; // The client manages the lifecycle of |
| 78 // this. | 81 // this. |
| 79 | 82 |
| 80 scoped_ptr<KeyframedFloatAnimationCurve> top_controls_animation_; | 83 scoped_ptr<KeyframedFloatAnimationCurve> top_controls_animation_; |
| 81 AnimationDirection animation_direction_; | 84 AnimationDirection animation_direction_; |
| 82 TopControlsState permitted_state_; | 85 TopControlsState permitted_state_; |
| 83 | 86 |
| 84 float current_scroll_delta_; | 87 // Accumulated scroll delta since last baseline reset |
| 85 float controls_scroll_begin_offset_; | 88 float accumulated_scroll_delta_; |
| 89 |
| 90 // Content offset when last baseline reset occurred |
| 91 float baseline_content_offset_; |
| 86 | 92 |
| 87 // The percent height of the visible top control such that it must be shown | 93 // The percent height of the visible top control such that it must be shown |
| 88 // when the user stops the scroll. | 94 // when the user stops the scroll. |
| 89 float top_controls_show_threshold_; | 95 float top_controls_show_threshold_; |
| 90 | 96 |
| 91 // The percent height of the visible top control such that it must be hidden | 97 // The percent height of the visible top control such that it must be hidden |
| 92 // when the user stops the scroll. | 98 // when the user stops the scroll. |
| 93 float top_controls_hide_threshold_; | 99 float top_controls_hide_threshold_; |
| 94 | 100 |
| 95 bool pinch_gesture_active_; | 101 bool pinch_gesture_active_; |
| 96 | 102 |
| 97 DISALLOW_COPY_AND_ASSIGN(TopControlsManager); | 103 DISALLOW_COPY_AND_ASSIGN(TopControlsManager); |
| 98 }; | 104 }; |
| 99 | 105 |
| 100 } // namespace cc | 106 } // namespace cc |
| 101 | 107 |
| 102 #endif // CC_INPUT_TOP_CONTROLS_MANAGER_H_ | 108 #endif // CC_INPUT_TOP_CONTROLS_MANAGER_H_ |
| OLD | NEW |