1 // Copyright 2012 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 CCScrollbarAnimationController_h
6 #define CCScrollbarAnimationController_h
8 #include "base/memory/scoped_ptr.h"
9 #include "FloatPoint.h"
15 class CCScrollbarLayerImpl
;
17 // This abstract class represents the compositor-side analogy of ScrollbarAnimator.
18 // Individual platforms should subclass it to provide specialized implementation.
19 class CCScrollbarAnimationController
{
21 static scoped_ptr
<CCScrollbarAnimationController
> create(CCLayerImpl
* scrollLayer
);
23 virtual ~CCScrollbarAnimationController();
25 virtual bool animate(double monotonicTime
);
26 void didPinchGestureBegin();
27 void didPinchGestureUpdate();
28 void didPinchGestureEnd();
29 void updateScrollOffset(CCLayerImpl
* scrollLayer
);
31 void setHorizontalScrollbarLayer(CCScrollbarLayerImpl
* layer
) { m_horizontalScrollbarLayer
= layer
; }
32 CCScrollbarLayerImpl
* horizontalScrollbarLayer() const { return m_horizontalScrollbarLayer
; }
34 void setVerticalScrollbarLayer(CCScrollbarLayerImpl
* layer
) { m_verticalScrollbarLayer
= layer
; }
35 CCScrollbarLayerImpl
* verticalScrollbarLayer() const { return m_verticalScrollbarLayer
; }
37 FloatPoint
currentPos() const { return m_currentPos
; }
38 IntSize
totalSize() const { return m_totalSize
; }
39 IntSize
maximum() const { return m_maximum
; }
41 virtual void didPinchGestureBeginAtTime(double monotonicTime
) { }
42 virtual void didPinchGestureUpdateAtTime(double monotonicTime
) { }
43 virtual void didPinchGestureEndAtTime(double monotonicTime
) { }
44 virtual void updateScrollOffsetAtTime(CCLayerImpl
* scrollLayer
, double monotonicTime
);
47 explicit CCScrollbarAnimationController(CCLayerImpl
* scrollLayer
);
50 static IntSize
getScrollLayerBounds(const CCLayerImpl
*);
52 // Beware of dangling pointer. Always update these during tree synchronization.
53 CCScrollbarLayerImpl
* m_horizontalScrollbarLayer
;
54 CCScrollbarLayerImpl
* m_verticalScrollbarLayer
;
56 FloatPoint m_currentPos
;
63 #endif // CCScrollbarAnimationController_h