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 "base/callback_forward.h" | |
10 #include "base/time/time.h" | |
9 #include "ui/gfx/size_f.h" | 11 #include "ui/gfx/size_f.h" |
10 #include "ui/gfx/vector2d_f.h" | 12 #include "ui/gfx/vector2d_f.h" |
11 | 13 |
12 namespace cc { | 14 namespace cc { |
13 | 15 |
14 // The LayerScrollOffsetDelegate allows for the embedder to take ownership of | 16 // The LayerScrollOffsetDelegate allows for the embedder to take ownership of |
15 // the scroll offset of the root layer. | 17 // the scroll offset of the root layer. |
16 // | 18 // |
17 // The LayerScrollOffsetDelegate is only used on the impl thread. | 19 // The LayerScrollOffsetDelegate is only used on the impl thread. |
18 class LayerScrollOffsetDelegate { | 20 class LayerScrollOffsetDelegate { |
(...skipping 10 matching lines...) Expand all Loading... | |
29 // layer. | 31 // layer. |
30 // There is no requirement that the return values of this method are | 32 // There is no requirement that the return values of this method are |
31 // stable in time (two subsequent calls may yield different results). | 33 // 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 | 34 // 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 | 35 // 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. | 36 // more than the value passed to the most recent SetMaxScrollOffset call. |
35 virtual gfx::Vector2dF GetTotalScrollOffset() = 0; | 37 virtual gfx::Vector2dF GetTotalScrollOffset() = 0; |
36 | 38 |
37 // This is called by the compositor to check whether a delegate-managed fling | 39 // This is called by the compositor to check whether a delegate-managed fling |
38 // is active or not. | 40 // is active or not. |
41 // TODO(jdduke): Remove? | |
mkosiba (inactive)
2014/05/15 13:48:51
maybe. This is still used by stuff like pageUp/pag
jdduke (slow)
2014/05/15 14:15:43
Gotcha, I suppose we could leave in for now.
| |
39 virtual bool IsExternalFlingActive() const = 0; | 42 virtual bool IsExternalFlingActive() const = 0; |
40 | 43 |
41 // This is called by the compositor to notify the delegate what is the current | 44 // This is called by the compositor to notify the delegate what is the current |
42 // page scale factor and limits are. | 45 // page scale factor and limits are. |
43 virtual void SetTotalPageScaleFactorAndLimits( | 46 virtual void SetTotalPageScaleFactorAndLimits( |
44 float page_scale_factor, | 47 float page_scale_factor, |
45 float min_page_scale_factor, | 48 float min_page_scale_factor, |
46 float max_page_scale_factor) = 0; | 49 float max_page_scale_factor) = 0; |
47 | 50 |
48 // This is called by the compositor to notify the delegate what is the layer's | 51 // This is called by the compositor to notify the delegate what is the layer's |
49 // scrollable size is. | 52 // scrollable size is. |
50 virtual void SetScrollableSize(const gfx::SizeF& scrollable_size) = 0; | 53 virtual void SetScrollableSize(const gfx::SizeF& scrollable_size) = 0; |
51 | 54 |
55 // This is called by the compositor when a fling hitting the root layer | |
56 // requires a scheduled animation update. | |
57 typedef base::Callback<void(base::TimeTicks)> AnimationCallback; | |
58 virtual void SetNeedsAnimate(const AnimationCallback& animation) = 0; | |
59 | |
52 protected: | 60 protected: |
53 LayerScrollOffsetDelegate() {} | 61 LayerScrollOffsetDelegate() {} |
54 virtual ~LayerScrollOffsetDelegate() {} | 62 virtual ~LayerScrollOffsetDelegate() {} |
55 | 63 |
56 private: | 64 private: |
57 DISALLOW_COPY_AND_ASSIGN(LayerScrollOffsetDelegate); | 65 DISALLOW_COPY_AND_ASSIGN(LayerScrollOffsetDelegate); |
58 }; | 66 }; |
59 | 67 |
60 } // namespace cc | 68 } // namespace cc |
61 | 69 |
62 #endif // CC_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_ | 70 #endif // CC_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_ |
OLD | NEW |