Chromium Code Reviews| 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 12 matching lines...) Expand all Loading... | |
| 23 | 23 |
| 24 // Manages the position of the top controls. | 24 // Manages the position of the top controls. |
| 25 class CC_EXPORT TopControlsManager { | 25 class CC_EXPORT TopControlsManager { |
| 26 public: | 26 public: |
| 27 enum AnimationDirection { | 27 enum AnimationDirection { |
| 28 NO_ANIMATION, | 28 NO_ANIMATION, |
| 29 SHOWING_CONTROLS, | 29 SHOWING_CONTROLS, |
| 30 HIDING_CONTROLS | 30 HIDING_CONTROLS |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 static scoped_ptr<TopControlsManager> Create(TopControlsManagerClient* client, | 33 static scoped_ptr<TopControlsManager> Create( |
| 34 float top_controls_height); | 34 TopControlsManagerClient* client, |
| 35 float top_controls_height, | |
| 36 float top_controls_show_threshold, | |
| 37 float top_controls_hide_threshold); | |
| 35 virtual ~TopControlsManager(); | 38 virtual ~TopControlsManager(); |
| 36 | 39 |
| 37 float controls_top_offset() { return controls_top_offset_; } | 40 float controls_top_offset() { return controls_top_offset_; } |
| 38 float content_top_offset() { return content_top_offset_; } | 41 float content_top_offset() { return content_top_offset_; } |
| 39 float is_overlay_mode() { return is_overlay_mode_; } | 42 float is_overlay_mode() { return is_overlay_mode_; } |
| 40 KeyframedFloatAnimationCurve* animation() { | 43 KeyframedFloatAnimationCurve* animation() { |
| 41 return top_controls_animation_.get(); | 44 return top_controls_animation_.get(); |
| 42 } | 45 } |
| 43 AnimationDirection animation_direction() { return animation_direction_; } | 46 AnimationDirection animation_direction() { return animation_direction_; } |
| 44 | 47 |
| 45 void UpdateDrawPositions(); | 48 void UpdateDrawPositions(); |
| 46 | 49 |
| 47 void ScrollBegin(); | 50 void ScrollBegin(); |
| 48 gfx::Vector2dF ScrollBy(const gfx::Vector2dF pending_delta); | 51 gfx::Vector2dF ScrollBy(const gfx::Vector2dF pending_delta); |
| 49 void ScrollEnd(); | 52 void ScrollEnd(); |
| 50 | 53 |
| 51 void Animate(base::TimeTicks monotonic_time); | 54 void Animate(base::TimeTicks monotonic_time); |
| 52 | 55 |
| 53 protected: | 56 protected: |
| 54 TopControlsManager(TopControlsManagerClient* client, | 57 TopControlsManager(TopControlsManagerClient* client, |
| 55 float top_controls_height); | 58 float top_controls_height, |
| 59 float top_controls_show_threshold, | |
| 60 float top_controls_hide_threshold); | |
| 56 | 61 |
| 57 private: | 62 private: |
| 58 gfx::Vector2dF ScrollInternal(const gfx::Vector2dF pending_delta); | 63 gfx::Vector2dF ScrollInternal(const gfx::Vector2dF pending_delta); |
| 59 void ResetAnimations(); | 64 void ResetAnimations(); |
| 60 float RootScrollLayerTotalScrollY(); | 65 float RootScrollLayerTotalScrollY(); |
| 61 void SetupAnimation(AnimationDirection direction); | 66 void SetupAnimation(AnimationDirection direction); |
| 62 void StartAnimationIfNecessary(); | 67 void StartAnimationIfNecessary(); |
| 63 bool IsAnimationCompleteAtTime(base::TimeTicks time); | 68 bool IsAnimationCompleteAtTime(base::TimeTicks time); |
| 64 | 69 |
| 65 TopControlsManagerClient* client_; // The client manages the lifecycle of | 70 TopControlsManagerClient* client_; // The client manages the lifecycle of |
| 66 // this. | 71 // this. |
| 67 | 72 |
| 68 scoped_ptr<KeyframedFloatAnimationCurve> top_controls_animation_; | 73 scoped_ptr<KeyframedFloatAnimationCurve> top_controls_animation_; |
| 69 AnimationDirection animation_direction_; | 74 AnimationDirection animation_direction_; |
| 75 float top_controls_show_threshold_; | |
| 76 float top_controls_hide_threshold_; | |
|
Ted C
2013/02/07 00:40:26
I would put the floats below with the other ones.
David Trainor- moved to gerrit
2013/02/11 19:38:28
Done.
| |
| 70 bool is_overlay_mode_; | 77 bool is_overlay_mode_; |
| 71 bool in_scroll_gesture_; | 78 bool in_scroll_gesture_; |
| 72 float controls_top_offset_; | 79 float controls_top_offset_; |
| 73 float content_top_offset_; | 80 float content_top_offset_; |
| 74 float top_controls_height_; | 81 float top_controls_height_; |
| 75 float previous_root_scroll_offset_; | 82 float previous_root_scroll_offset_; |
| 76 float scroll_start_offset_; | 83 float scroll_start_offset_; |
| 84 float current_scroll_delta_; | |
| 77 | 85 |
| 78 DISALLOW_COPY_AND_ASSIGN(TopControlsManager); | 86 DISALLOW_COPY_AND_ASSIGN(TopControlsManager); |
| 79 }; | 87 }; |
| 80 | 88 |
| 81 } // namespace cc | 89 } // namespace cc |
| 82 | 90 |
| 83 #endif // CC_TOP_CONTROLS_MANAGER_H_ | 91 #endif // CC_TOP_CONTROLS_MANAGER_H_ |
| OLD | NEW |