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 21 matching lines...) Expand all Loading... |
32 HIDING_CONTROLS | 32 HIDING_CONTROLS |
33 }; | 33 }; |
34 | 34 |
35 static scoped_ptr<TopControlsManager> Create( | 35 static scoped_ptr<TopControlsManager> Create( |
36 TopControlsManagerClient* client, | 36 TopControlsManagerClient* client, |
37 float top_controls_height, | 37 float top_controls_height, |
38 float top_controls_show_threshold, | 38 float top_controls_show_threshold, |
39 float top_controls_hide_threshold); | 39 float top_controls_hide_threshold); |
40 virtual ~TopControlsManager(); | 40 virtual ~TopControlsManager(); |
41 | 41 |
42 float controls_top_offset() { return controls_top_offset_; } | 42 float controls_height() { return top_controls_height_; } |
43 float content_top_offset() { | 43 float ControlsTopOffset(); |
44 return controls_top_offset_ + top_controls_height_; | 44 float ContentTopOffset(); |
45 } | 45 |
46 KeyframedFloatAnimationCurve* animation() { | 46 KeyframedFloatAnimationCurve* animation() { |
47 return top_controls_animation_.get(); | 47 return top_controls_animation_.get(); |
48 } | 48 } |
49 AnimationDirection animation_direction() { return animation_direction_; } | 49 AnimationDirection animation_direction() { return animation_direction_; } |
50 | 50 |
51 void UpdateTopControlsState(TopControlsState constraints, | 51 void UpdateTopControlsState(TopControlsState constraints, |
52 TopControlsState current, | 52 TopControlsState current, |
53 bool animate); | 53 bool animate); |
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 gfx::Vector2dF Animate(base::TimeTicks monotonic_time); | 64 gfx::Vector2dF Animate(base::TimeTicks monotonic_time); |
| 65 void SetControlsTopOffset(float offset); |
| 66 float top_controls_height() { return top_controls_height_; } |
65 | 67 |
66 protected: | 68 protected: |
67 TopControlsManager(TopControlsManagerClient* client, | 69 TopControlsManager(TopControlsManagerClient* client, |
68 float top_controls_height, | 70 float top_controls_height, |
69 float top_controls_show_threshold, | 71 float top_controls_show_threshold, |
70 float top_controls_hide_threshold); | 72 float top_controls_hide_threshold); |
71 | 73 |
72 private: | 74 private: |
73 void SetControlsTopOffset(float offset); | |
74 void ResetAnimations(); | 75 void ResetAnimations(); |
75 void SetupAnimation(AnimationDirection direction); | 76 void SetupAnimation(AnimationDirection direction); |
76 void StartAnimationIfNecessary(); | 77 void StartAnimationIfNecessary(); |
77 bool IsAnimationCompleteAtTime(base::TimeTicks time); | 78 bool IsAnimationCompleteAtTime(base::TimeTicks time); |
78 | 79 |
79 TopControlsManagerClient* client_; // The client manages the lifecycle of | 80 TopControlsManagerClient* client_; // The client manages the lifecycle of |
80 // this. | 81 // this. |
81 | 82 |
82 scoped_ptr<KeyframedFloatAnimationCurve> top_controls_animation_; | 83 scoped_ptr<KeyframedFloatAnimationCurve> top_controls_animation_; |
83 AnimationDirection animation_direction_; | 84 AnimationDirection animation_direction_; |
(...skipping 13 matching lines...) Expand all Loading... |
97 float top_controls_hide_height_; | 98 float top_controls_hide_height_; |
98 | 99 |
99 bool pinch_gesture_active_; | 100 bool pinch_gesture_active_; |
100 | 101 |
101 DISALLOW_COPY_AND_ASSIGN(TopControlsManager); | 102 DISALLOW_COPY_AND_ASSIGN(TopControlsManager); |
102 }; | 103 }; |
103 | 104 |
104 } // namespace cc | 105 } // namespace cc |
105 | 106 |
106 #endif // CC_INPUT_TOP_CONTROLS_MANAGER_H_ | 107 #endif // CC_INPUT_TOP_CONTROLS_MANAGER_H_ |
OLD | NEW |