Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Unified Diff: cc/top_controls_manager.h

Issue 11552009: Add support for calculating the position of the top controls in the cc layer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..5ca77187e4253fead0b45df07697b23b6a6723b1
--- /dev/null
+++ b/cc/top_controls_manager.h
@@ -0,0 +1,74 @@
+// 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 "base/timer.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 TopControlsManagerClient;
+
+// Manages the position of the top controls.
+class TopControlsManager {
+ public:
+ static scoped_ptr<TopControlsManager> Create(TopControlsManagerClient* client,
+ float top_controls_height);
+ 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 pending_delta);
+ void ScrollEnd();
+
+ void Animate(base::TimeTicks monotonic_time);
+
+ protected:
+ TopControlsManager(TopControlsManagerClient* client,
+ float top_controls_height);
+
+ private:
+ gfx::Vector2dF ScrollInternal(const gfx::Vector2dF pending_delta);
+ void ResetAnimations();
+ LayerImpl* RootScrollLayer();
+ float RootScrollLayerTotalScrollY();
+ void StartAnimationIfNecessary();
+ void StartAutoHideAnimation();
+
+ TopControlsManagerClient* client_; // The client manages the lifecycle of
+ // this.
+
+ base::OneShotTimer<TopControlsManager> auto_hide_timer_;
+ scoped_ptr<TopControlsAnimation> top_controls_animation_;
+ bool is_overlay_mode_;
+ float controls_top_offset_;
+ float content_top_offset_;
+ float top_controls_height_;
+ bool scroll_readjustment_enabled_;
+ float previous_root_scroll_offset_;
+
+ DISALLOW_COPY_AND_ASSIGN(TopControlsManager);
+};
+
+} // namespace cc
+
+#endif // CC_TOP_CONTROLS_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698