Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_TOP_CONTROLS_MANAGER_H_ | |
| 6 #define CC_TOP_CONTROLS_MANAGER_H_ | |
| 7 | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "base/memory/weak_ptr.h" | |
| 10 #include "cc/layer_impl.h" | |
| 11 #include "ui/gfx/size.h" | |
| 12 #include "ui/gfx/vector2d_f.h" | |
| 13 | |
| 14 namespace base { | |
| 15 class TimeTicks; | |
| 16 } | |
| 17 | |
| 18 namespace cc { | |
| 19 | |
| 20 class LayerTreeImpl; | |
| 21 class TopControlsAnimation; | |
| 22 | |
| 23 class TopControlsDelegate { | |
| 24 public: | |
| 25 virtual void setNeedsRedraw() = 0; | |
| 26 virtual void setNeedsUpdateDrawProperties() = 0; | |
| 27 virtual LayerTreeImpl* activeTree() = 0; | |
| 28 }; | |
| 29 | |
| 30 // Manages the position of the top controls. | |
| 31 class TopControlsManager { | |
| 32 public: | |
| 33 static const int64 kAutoHideDelayMs = 1500; | |
|
aelias_OOO_until_Jul13
2012/12/19 08:31:18
Move these values to the .cc file.
Ted C
2012/12/19 21:34:17
Done.
| |
| 34 static const double kShowHideMaxDurationMs = 500; | |
| 35 | |
| 36 static scoped_ptr<TopControlsManager> create(TopControlsDelegate* delegate, | |
| 37 bool enabled, | |
| 38 float topControlsHeight); | |
|
aelias_OOO_until_Jul13
2012/12/19 08:31:18
top_controls_height
Ted C
2012/12/19 21:34:17
Done.
| |
| 39 virtual ~TopControlsManager(); | |
| 40 | |
| 41 float controls_top_offset() { return controls_top_offset_; } | |
| 42 float content_top_offset() { return content_top_offset_; } | |
| 43 float is_overlay_mode() { return is_overlay_mode_; } | |
| 44 TopControlsAnimation* animation() { return top_controls_animation_.get(); } | |
| 45 | |
| 46 void updateDrawPositions(); | |
| 47 | |
| 48 void scrollBegin(); | |
| 49 gfx::Vector2dF scrollBy(const gfx::Vector2dF pendingDelta); | |
| 50 void scrollEnd(); | |
| 51 | |
| 52 void animate(base::TimeTicks monotonicTime); | |
| 53 void resetAnimations(); | |
| 54 | |
| 55 protected: | |
| 56 TopControlsManager(TopControlsDelegate* delegate, bool enabled, | |
| 57 float topControlsHeight); | |
| 58 | |
| 59 private: | |
| 60 LayerImpl* rootScrollLayer(); | |
| 61 float rootScrollLayerTotalScrollY(); | |
| 62 void startAnimationIfNecessary(); | |
| 63 void startAutoHideAnimation(int64 triggeredTime); | |
| 64 | |
| 65 base::WeakPtrFactory<TopControlsManager> weak_ptr_factory_; | |
| 66 | |
| 67 TopControlsDelegate* delegate_; // owned by this. | |
| 68 bool enabled_; | |
| 69 | |
| 70 scoped_ptr<TopControlsAnimation> top_controls_animation_; | |
| 71 bool is_overlay_mode_; | |
| 72 float controls_top_offset_; | |
| 73 float content_top_offset_; | |
| 74 float top_controls_height_; | |
| 75 int64 top_controls_auto_hide_trigger_time_; | |
| 76 float previous_root_scroll_offset_; | |
| 77 | |
| 78 DISALLOW_COPY_AND_ASSIGN(TopControlsManager); | |
| 79 }; | |
| 80 | |
| 81 } // namespace cc | |
| 82 | |
| 83 #endif // CC_TOP_CONTROLS_MANAGER_H_ | |
| OLD | NEW |