| 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/vector2d_f.h" | 9 #include "ui/gfx/vector2d_f.h" |
| 10 | 10 |
| 11 namespace cc { | 11 namespace cc { |
| 12 | 12 |
| 13 // The LayerScrollOffsetDelegate allows for the embedder to take ownership of | 13 // The LayerScrollOffsetDelegate allows for the embedder to take ownership of |
| 14 // the scroll offset of the root layer. | 14 // the scroll offset of the root layer. |
| 15 // | 15 // |
| 16 // The LayerScrollOffsetDelegate is only used on the impl thread. | 16 // The LayerScrollOffsetDelegate is only used on the impl thread. |
| 17 class LayerScrollOffsetDelegate { | 17 class LayerScrollOffsetDelegate { |
| 18 public: | 18 public: |
| 19 // This is called by the compositor to notify the delegate what is the upper |
| 20 // total scroll offset bound. |
| 21 virtual void SetMaxScrollOffset(gfx::Vector2dF max_scroll_offset) = 0; |
| 22 |
| 19 // This is called by the compositor when the scroll offset of the layer would | 23 // This is called by the compositor when the scroll offset of the layer would |
| 20 // have otherwise changed. | 24 // have otherwise changed. |
| 21 virtual void SetTotalScrollOffset(gfx::Vector2dF new_value) = 0; | 25 virtual void SetTotalScrollOffset(gfx::Vector2dF new_value) = 0; |
| 22 | 26 |
| 23 // This is called by the compositor to query the current scroll offset of the | 27 // This is called by the compositor to query the current scroll offset of the |
| 24 // layer. | 28 // layer. |
| 25 // There is no requirement that the return values of this method are | 29 // There is no requirement that the return values of this method are |
| 26 // stable in time (two subsequent calls may yield different results). | 30 // stable in time (two subsequent calls may yield different results). |
| 27 // The return value is not required to be related to the values passed in to | 31 // The return value is not required to be related to the values passed in to |
| 28 // the SetTotalScrollOffset method in any way. | 32 // the SetTotalScrollOffset method in any way however it is required to be no |
| 33 // more than the value passed to the most recent SetMaxScrollOffset call. |
| 29 virtual gfx::Vector2dF GetTotalScrollOffset() = 0; | 34 virtual gfx::Vector2dF GetTotalScrollOffset() = 0; |
| 30 | 35 |
| 31 protected: | 36 protected: |
| 32 LayerScrollOffsetDelegate() {} | 37 LayerScrollOffsetDelegate() {} |
| 33 virtual ~LayerScrollOffsetDelegate() {} | 38 virtual ~LayerScrollOffsetDelegate() {} |
| 34 | 39 |
| 35 private: | 40 private: |
| 36 DISALLOW_COPY_AND_ASSIGN(LayerScrollOffsetDelegate); | 41 DISALLOW_COPY_AND_ASSIGN(LayerScrollOffsetDelegate); |
| 37 }; | 42 }; |
| 38 | 43 |
| 39 } // namespace cc | 44 } // namespace cc |
| 40 | 45 |
| 41 #endif // CC_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_ | 46 #endif // CC_INPUT_LAYER_SCROLL_OFFSET_DELEGATE_H_ |
| OLD | NEW |