Index: cc/top_controls_manager.h |
diff --git a/cc/top_controls_manager.h b/cc/top_controls_manager.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..72ba7ddba2f2cc46a3f17560655fca6fa24841d2 |
--- /dev/null |
+++ b/cc/top_controls_manager.h |
@@ -0,0 +1,83 @@ |
+// Copyright 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CC_TOP_CONTROLS_MANAGER_H_ |
+#define CC_TOP_CONTROLS_MANAGER_H_ |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "base/memory/weak_ptr.h" |
+#include "cc/layer_impl.h" |
+#include "ui/gfx/size.h" |
+#include "ui/gfx/vector2d_f.h" |
+ |
+namespace base { |
+class TimeTicks; |
+} |
+ |
+namespace cc { |
+ |
+class LayerTreeImpl; |
+class TopControlsAnimation; |
+ |
+class TopControlsDelegate { |
+ public: |
+ virtual void setNeedsRedraw() = 0; |
+ virtual void setNeedsUpdateDrawProperties() = 0; |
+ virtual LayerTreeImpl* activeTree() = 0; |
+}; |
+ |
+// Manages the position of the top controls. |
+class TopControlsManager { |
+ public: |
+ 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.
|
+ static const double kShowHideMaxDurationMs = 500; |
+ |
+ static scoped_ptr<TopControlsManager> create(TopControlsDelegate* delegate, |
+ bool enabled, |
+ float topControlsHeight); |
aelias_OOO_until_Jul13
2012/12/19 08:31:18
top_controls_height
Ted C
2012/12/19 21:34:17
Done.
|
+ virtual ~TopControlsManager(); |
+ |
+ float controls_top_offset() { return controls_top_offset_; } |
+ float content_top_offset() { return content_top_offset_; } |
+ float is_overlay_mode() { return is_overlay_mode_; } |
+ TopControlsAnimation* animation() { return top_controls_animation_.get(); } |
+ |
+ void updateDrawPositions(); |
+ |
+ void scrollBegin(); |
+ gfx::Vector2dF scrollBy(const gfx::Vector2dF pendingDelta); |
+ void scrollEnd(); |
+ |
+ void animate(base::TimeTicks monotonicTime); |
+ void resetAnimations(); |
+ |
+ protected: |
+ TopControlsManager(TopControlsDelegate* delegate, bool enabled, |
+ float topControlsHeight); |
+ |
+ private: |
+ LayerImpl* rootScrollLayer(); |
+ float rootScrollLayerTotalScrollY(); |
+ void startAnimationIfNecessary(); |
+ void startAutoHideAnimation(int64 triggeredTime); |
+ |
+ base::WeakPtrFactory<TopControlsManager> weak_ptr_factory_; |
+ |
+ TopControlsDelegate* delegate_; // owned by this. |
+ bool enabled_; |
+ |
+ scoped_ptr<TopControlsAnimation> top_controls_animation_; |
+ bool is_overlay_mode_; |
+ float controls_top_offset_; |
+ float content_top_offset_; |
+ float top_controls_height_; |
+ int64 top_controls_auto_hide_trigger_time_; |
+ float previous_root_scroll_offset_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(TopControlsManager); |
+}; |
+ |
+} // namespace cc |
+ |
+#endif // CC_TOP_CONTROLS_MANAGER_H_ |