OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_ | 5 #ifndef CC_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_ |
6 #define CC_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_ | 6 #define CC_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "ui/gfx/geometry/scroll_offset.h" |
9 #include "ui/gfx/size_f.h" | 10 #include "ui/gfx/size_f.h" |
10 #include "ui/gfx/vector2d_f.h" | |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 | 13 |
14 // The LayerScrollOffsetDelegate allows for the embedder to take ownership of | 14 // The LayerScrollOffsetDelegate allows for the embedder to take ownership of |
15 // the scroll offset of the root layer. | 15 // the scroll offset of the root layer. |
16 // | 16 // |
17 // The LayerScrollOffsetDelegate is only used on the impl thread. | 17 // The LayerScrollOffsetDelegate is only used on the impl thread. |
18 class LayerScrollOffsetDelegate { | 18 class LayerScrollOffsetDelegate { |
19 public: | 19 public: |
20 // This is called by the compositor to query the current scroll offset of the | 20 // This is called by the compositor to query the current scroll offset of the |
21 // layer. | 21 // layer. |
22 // There is no requirement that the return values of this method are | 22 // There is no requirement that the return values of this method are |
23 // stable in time (two subsequent calls may yield different results). | 23 // stable in time (two subsequent calls may yield different results). |
24 // The return value is not required to be related to the values passed in to | 24 // The return value is not required to be related to the values passed in to |
25 // the SetTotalScrollOffset method in any way however it is required to be no | 25 // the SetTotalScrollOffset method in any way however it is required to be no |
26 // more than the value passed to the most recent SetMaxScrollOffset call. | 26 // more than the value passed to the most recent SetMaxScrollOffset call. |
27 virtual gfx::Vector2dF GetTotalScrollOffset() = 0; | 27 virtual gfx::ScrollOffset GetTotalScrollOffset() = 0; |
28 | 28 |
29 // This is called by the compositor to notify the delegate of any change to | 29 // This is called by the compositor to notify the delegate of any change to |
30 // the following parameters: | 30 // the following parameters: |
31 // |total_scroll_offset| current scroll offset of the root layer, | 31 // |total_scroll_offset| current scroll offset of the root layer, |
32 // |max_scroll_offset| total scroll offset upper bound for the root layer, | 32 // |max_scroll_offset| total scroll offset upper bound for the root layer, |
33 // |scrollable_size| root layer scrollable size, | 33 // |scrollable_size| root layer scrollable size, |
34 // |page_scale_factor| current page scale, | 34 // |page_scale_factor| current page scale, |
35 // |min_page_scale_factor| page scale lower limit, | 35 // |min_page_scale_factor| page scale lower limit, |
36 // |max_page_scale_factor| page scale upper limit. | 36 // |max_page_scale_factor| page scale upper limit. |
37 virtual void UpdateRootLayerState(const gfx::Vector2dF& total_scroll_offset, | 37 virtual void UpdateRootLayerState( |
38 const gfx::Vector2dF& max_scroll_offset, | 38 const gfx::ScrollOffset& total_scroll_offset, |
39 const gfx::SizeF& scrollable_size, | 39 const gfx::ScrollOffset& max_scroll_offset, |
40 float page_scale_factor, | 40 const gfx::SizeF& scrollable_size, |
41 float min_page_scale_factor, | 41 float page_scale_factor, |
42 float max_page_scale_factor) = 0; | 42 float min_page_scale_factor, |
| 43 float max_page_scale_factor) = 0; |
43 | 44 |
44 // This is called by the compositor to check whether a delegate-managed fling | 45 // This is called by the compositor to check whether a delegate-managed fling |
45 // is active or not. | 46 // is active or not. |
46 virtual bool IsExternalFlingActive() const = 0; | 47 virtual bool IsExternalFlingActive() const = 0; |
47 | 48 |
48 protected: | 49 protected: |
49 LayerScrollOffsetDelegate() {} | 50 LayerScrollOffsetDelegate() {} |
50 virtual ~LayerScrollOffsetDelegate() {} | 51 virtual ~LayerScrollOffsetDelegate() {} |
51 | 52 |
52 private: | 53 private: |
53 DISALLOW_COPY_AND_ASSIGN(LayerScrollOffsetDelegate); | 54 DISALLOW_COPY_AND_ASSIGN(LayerScrollOffsetDelegate); |
54 }; | 55 }; |
55 | 56 |
56 } // namespace cc | 57 } // namespace cc |
57 | 58 |
58 #endif // CC_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_ | 59 #endif // CC_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_ |
OLD | NEW |