OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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. |
| 4 |
| 5 #ifndef CC_TREES_LAYER_TREE_SCROLL_ELASTICITY_CLIENT_H_ |
| 6 #define CC_TREES_LAYER_TREE_SCROLL_ELASTICITY_CLIENT_H_ |
| 7 |
| 8 #include "cc/input/scroll_elasticity_controller.h" |
| 9 |
| 10 namespace cc { |
| 11 |
| 12 class LayerTreeHostImpl; |
| 13 |
| 14 // Interface between a LayerTreeHostImpl and a ScrollElasticityController. It |
| 15 // would be possible, in principle, for LayerTreeHostImpl to implement the |
| 16 // ScrollElasticityControllerClient interface itself. This artificial boundary |
| 17 // is introduced to reduce the amount of logic and state held directly inside |
| 18 // LayerTreeHostImpl. |
| 19 class CC_EXPORT LayerTreeScrollElasticityClient |
| 20 : public ScrollElasticityControllerClient { |
| 21 public: |
| 22 explicit LayerTreeScrollElasticityClient(LayerTreeHostImpl* layer_tree); |
| 23 virtual ~LayerTreeScrollElasticityClient(); |
| 24 |
| 25 // Interface between LayerTreeHostImpl and the controller. |
| 26 void Animate(base::TimeTicks monotonic_time); |
| 27 |
| 28 private: |
| 29 // ScrollElasticityControllerClient implementation: |
| 30 void BindToController(ScrollElasticityController* controller) override; |
| 31 bool AllowsHorizontalStretching() override; |
| 32 bool AllowsVerticalStretching() override; |
| 33 gfx::Vector2dF StretchAmount() override; |
| 34 bool PinnedInDirection(const gfx::Vector2dF& direction) override; |
| 35 bool CanScrollHorizontally() override; |
| 36 bool CanScrollVertically() override; |
| 37 gfx::Vector2dF AbsoluteScrollPosition() override; |
| 38 void ImmediateScrollBy(const gfx::Vector2dF& scroll) override; |
| 39 void ImmediateScrollByWithoutContentEdgeConstraints( |
| 40 const gfx::Vector2dF& scroll) override; |
| 41 void StartSnapRubberbandTimer() override; |
| 42 void StopSnapRubberbandTimer() override; |
| 43 void AdjustScrollPositionToBoundsIfNecessary() override; |
| 44 |
| 45 LayerTreeHostImpl* layer_tree_; |
| 46 ScrollElasticityController* controller_; |
| 47 gfx::Vector2dF stretch_offset_; |
| 48 bool timer_active_; |
| 49 }; |
| 50 |
| 51 } // namespace cc |
| 52 |
| 53 #endif // CC_TREES_LAYER_TREE_SCROLL_ELASTICITY_CLIENT_H_ |
OLD | NEW |