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_TOP_CONTROLS_MANAGER_H_ | 5 #ifndef CC_TOP_CONTROLS_MANAGER_H_ |
6 #define CC_TOP_CONTROLS_MANAGER_H_ | 6 #define CC_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/layer_impl.h" | 10 #include "cc/layer_impl.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 virtual ~TopControlsManager(); | 35 virtual ~TopControlsManager(); |
36 | 36 |
37 float controls_top_offset() { return controls_top_offset_; } | 37 float controls_top_offset() { return controls_top_offset_; } |
38 float content_top_offset() { return content_top_offset_; } | 38 float content_top_offset() { return content_top_offset_; } |
39 float is_overlay_mode() { return is_overlay_mode_; } | 39 float is_overlay_mode() { return is_overlay_mode_; } |
40 KeyframedFloatAnimationCurve* animation() { | 40 KeyframedFloatAnimationCurve* animation() { |
41 return top_controls_animation_.get(); | 41 return top_controls_animation_.get(); |
42 } | 42 } |
43 AnimationDirection animation_direction() { return animation_direction_; } | 43 AnimationDirection animation_direction() { return animation_direction_; } |
44 | 44 |
45 void UpdateDrawPositions(); | |
46 | |
47 void ScrollBegin(); | 45 void ScrollBegin(); |
48 gfx::Vector2dF ScrollBy(const gfx::Vector2dF pending_delta); | 46 gfx::Vector2dF ScrollBy(const gfx::Vector2dF pending_delta); |
49 void ScrollEnd(); | 47 void ScrollEnd(); |
50 | 48 |
51 void Animate(base::TimeTicks monotonic_time); | 49 void Animate(base::TimeTicks monotonic_time); |
52 | 50 |
| 51 void ProgrammaticScroll(gfx::Vector2d targetOffset); |
| 52 |
53 protected: | 53 protected: |
54 TopControlsManager(TopControlsManagerClient* client, | 54 TopControlsManager(TopControlsManagerClient* client, |
55 float top_controls_height); | 55 float top_controls_height); |
56 | 56 |
57 private: | 57 private: |
58 gfx::Vector2dF ScrollInternal(const gfx::Vector2dF pending_delta); | 58 gfx::Vector2dF ScrollInternal(const gfx::Vector2dF pending_delta); |
59 void ResetAnimations(); | 59 void ResetAnimations(); |
60 float RootScrollLayerTotalScrollY(); | 60 float RootScrollLayerTotalScrollY(); |
61 void SetupAnimation(AnimationDirection direction); | 61 void SetupAnimation(AnimationDirection direction); |
62 void StartAnimationIfNecessary(); | 62 void StartAnimationIfNecessary(); |
63 bool IsAnimationCompleteAtTime(base::TimeTicks time); | 63 bool IsAnimationCompleteAtTime(base::TimeTicks time); |
64 | 64 |
65 TopControlsManagerClient* client_; // The client manages the lifecycle of | 65 TopControlsManagerClient* client_; // The client manages the lifecycle of |
66 // this. | 66 // this. |
67 | 67 |
68 scoped_ptr<KeyframedFloatAnimationCurve> top_controls_animation_; | 68 scoped_ptr<KeyframedFloatAnimationCurve> top_controls_animation_; |
69 AnimationDirection animation_direction_; | 69 AnimationDirection animation_direction_; |
70 bool is_overlay_mode_; | 70 bool is_overlay_mode_; |
71 bool scroll_readjustment_enabled_; | |
72 float controls_top_offset_; | 71 float controls_top_offset_; |
73 float content_top_offset_; | 72 float content_top_offset_; |
74 float top_controls_height_; | 73 float top_controls_height_; |
75 float previous_root_scroll_offset_; | 74 bool in_user_scroll_; |
76 | 75 |
77 DISALLOW_COPY_AND_ASSIGN(TopControlsManager); | 76 DISALLOW_COPY_AND_ASSIGN(TopControlsManager); |
78 }; | 77 }; |
79 | 78 |
80 } // namespace cc | 79 } // namespace cc |
81 | 80 |
82 #endif // CC_TOP_CONTROLS_MANAGER_H_ | 81 #endif // CC_TOP_CONTROLS_MANAGER_H_ |
OLD | NEW |