Telemetry support for iframes.
[chromium-blink-merge.git] / cc / input / layer_scroll_offset_delegate.h
blob2da5f13befbd83739448f6e289a3f2b58e033ae7
1 // Copyright 2013 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.
5 #ifndef CC_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_
6 #define CC_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_
8 #include "base/basictypes.h"
9 #include "ui/gfx/size_f.h"
10 #include "ui/gfx/vector2d_f.h"
12 namespace cc {
14 // The LayerScrollOffsetDelegate allows for the embedder to take ownership of
15 // the scroll offset of the root layer.
17 // The LayerScrollOffsetDelegate is only used on the impl thread.
18 class LayerScrollOffsetDelegate {
19 public:
20 // This is called by the compositor to notify the delegate what is the upper
21 // total scroll offset bound.
22 virtual void SetMaxScrollOffset(const gfx::Vector2dF& max_scroll_offset) = 0;
24 // This is called by the compositor when the scroll offset of the layer would
25 // have otherwise changed.
26 virtual void SetTotalScrollOffset(const gfx::Vector2dF& new_value) = 0;
28 // This is called by the compositor to query the current scroll offset of the
29 // layer.
30 // There is no requirement that the return values of this method are
31 // stable in time (two subsequent calls may yield different results).
32 // The return value is not required to be related to the values passed in to
33 // the SetTotalScrollOffset method in any way however it is required to be no
34 // more than the value passed to the most recent SetMaxScrollOffset call.
35 virtual gfx::Vector2dF GetTotalScrollOffset() = 0;
37 // This is called by the compositor to check whether a delegate-managed fling
38 // is active or not.
39 virtual bool IsExternalFlingActive() const = 0;
41 // This is called by the compositor to notify the delegate what is the current
42 // page scale factor and limits are.
43 virtual void SetTotalPageScaleFactorAndLimits(
44 float page_scale_factor,
45 float min_page_scale_factor,
46 float max_page_scale_factor) = 0;
48 // This is called by the compositor to notify the delegate what is the layer's
49 // scrollable size is.
50 virtual void SetScrollableSize(const gfx::SizeF& scrollable_size) = 0;
52 protected:
53 LayerScrollOffsetDelegate() {}
54 virtual ~LayerScrollOffsetDelegate() {}
56 private:
57 DISALLOW_COPY_AND_ASSIGN(LayerScrollOffsetDelegate);
60 } // namespace cc
62 #endif // CC_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_