summaryrefslogtreecommitdiffstats
path: root/cc/top_controls_manager.h
diff options
context:
space:
mode:
authortedchoc@chromium.org <tedchoc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-16 03:58:38 +0000
committertedchoc@chromium.org <tedchoc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-16 03:58:38 +0000
commit3ba4cae36f9c80067c103809fa3f65ad18c7f2d5 (patch)
treed62946f6f8e8a15cc76d37fe8f2c89117a6b35d8 /cc/top_controls_manager.h
parentdc87a404f3c9f0d64df6fc208b9857e8d115eba3 (diff)
downloadchromium_src-3ba4cae36f9c80067c103809fa3f65ad18c7f2d5.zip
chromium_src-3ba4cae36f9c80067c103809fa3f65ad18c7f2d5.tar.gz
chromium_src-3ba4cae36f9c80067c103809fa3f65ad18c7f2d5.tar.bz2
Add support for calculating the position of the top controls in the cc layer.
Provides a means for keeping the top controls in sync with the currently renderered frame, which will allow us to move the top controls around the screen. BUG=161303 Review URL: https://chromiumcodereview.appspot.com/11552009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177081 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/top_controls_manager.h')
-rw-r--r--cc/top_controls_manager.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/cc/top_controls_manager.h b/cc/top_controls_manager.h
new file mode 100644
index 0000000..37d1670
--- /dev/null
+++ b/cc/top_controls_manager.h
@@ -0,0 +1,77 @@
+// Copyright 2013 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 KeyframedFloatAnimationCurve;
+class LayerTreeImpl;
+class TopControlsManagerClient;
+
+// Manages the position of the top controls.
+class CC_EXPORT TopControlsManager {
+ public:
+ static scoped_ptr<TopControlsManager> Create(TopControlsManagerClient* client,
+ float top_controls_height);
+ virtual ~TopControlsManager();
+
+ void set_content_layer_id(int id) { content_layer_id_ = id; }
+ float controls_top_offset() { return controls_top_offset_; }
+ float content_top_offset() { return content_top_offset_; }
+ float is_overlay_mode() { return is_overlay_mode_; }
+ KeyframedFloatAnimationCurve* 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 SetupAnimation(bool show_controls);
+ void StartAnimationIfNecessary();
+
+ TopControlsManagerClient* client_; // The client manages the lifecycle of
+ // this.
+
+ scoped_ptr<KeyframedFloatAnimationCurve> top_controls_animation_;
+ int content_layer_id_;
+ bool is_showing_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_