summaryrefslogtreecommitdiffstats
path: root/cc/input
diff options
context:
space:
mode:
authormkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-29 23:03:33 +0000
committermkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-29 23:03:33 +0000
commit3b91969d3681cc55ed7f81a0a8331c0ea1ee5c10 (patch)
tree445be4c666663a1dfe9c3216627132fd801dc099 /cc/input
parent3722c2f926e4cfd917e8c809c94d8d977e2f8a72 (diff)
downloadchromium_src-3b91969d3681cc55ed7f81a0a8331c0ea1ee5c10.zip
chromium_src-3b91969d3681cc55ed7f81a0a8331c0ea1ee5c10.tar.gz
chromium_src-3b91969d3681cc55ed7f81a0a8331c0ea1ee5c10.tar.bz2
Make it possible to delegate root layer scroll offset outside of cc.
This change makes it possible for the embedder to own the root layer scroll offset. BUG=b/6029133 Review URL: https://chromiumcodereview.appspot.com/13869006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197178 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/input')
-rw-r--r--cc/input/input_handler.h12
-rw-r--r--cc/input/layer_scroll_offset_delegate.h38
2 files changed, 50 insertions, 0 deletions
diff --git a/cc/input/input_handler.h b/cc/input/input_handler.h
index 982befa..b3f805e 100644
--- a/cc/input/input_handler.h
+++ b/cc/input/input_handler.h
@@ -19,6 +19,8 @@ class Vector2dF;
namespace cc {
+class LayerScrollOffsetDelegate;
+
// The InputHandler is a way for the embedders to interact with the impl thread
// side of the compositor implementation. There is one InputHandler per
// LayerTreeHost. To use the input handler, implement the InputHanderClient
@@ -62,6 +64,16 @@ class CC_EXPORT InputHandler {
// returned ScrollStarted.
virtual void ScrollEnd() = 0;
+ virtual void SetRootLayerScrollOffsetDelegate(
+ LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) = 0;
+
+ // Called when the value returned by
+ // LayerScrollOffsetDelegate.GetTotalScrollOffset has changed for reasons
+ // other than a SetTotalScrollOffset call.
+ // NOTE: This should only called after a valid delegate was set via a call to
+ // SetRootLayerScrollOffsetDelegate.
+ virtual void OnRootLayerDelegatedScrollOffsetChanged() = 0;
+
virtual void PinchGestureBegin() = 0;
virtual void PinchGestureUpdate(float magnify_delta, gfx::Point anchor) = 0;
virtual void PinchGestureEnd() = 0;
diff --git a/cc/input/layer_scroll_offset_delegate.h b/cc/input/layer_scroll_offset_delegate.h
new file mode 100644
index 0000000..1431a80
--- /dev/null
+++ b/cc/input/layer_scroll_offset_delegate.h
@@ -0,0 +1,38 @@
+// 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_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_
+#define CC_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_
+
+namespace cc {
+
+// The LayerScrollOffsetDelegate allows for the embedder to take ownership of
+// the scroll offset of the root layer.
+//
+// The LayerScrollOffsetDelegate is only used on the impl thread.
+class LayerScrollOffsetDelegate {
+ public:
+ // This is called by the compositor when the scroll offset of the layer would
+ // have otherwise changed.
+ virtual void SetTotalScrollOffset(gfx::Vector2dF new_value) = 0;
+
+ // This is called by the compositor to query the current scroll offset of the
+ // layer.
+ // There is no requirement that the return values of this method are
+ // stable in time (two subsequent calls may yield different results).
+ // The return value is not required to be related to the values passed in to
+ // the SetTotalScrollOffset method in any way.
+ virtual gfx::Vector2dF GetTotalScrollOffset() = 0;
+
+ protected:
+ LayerScrollOffsetDelegate() {}
+ virtual ~LayerScrollOffsetDelegate() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(LayerScrollOffsetDelegate);
+};
+
+} // namespace cc
+
+#endif // CC_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_