OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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 CCScrollbarAnimationController_h | 5 #ifndef CCScrollbarAnimationController_h |
6 #define CCScrollbarAnimationController_h | 6 #define CCScrollbarAnimationController_h |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "FloatPoint.h" | 9 #include "FloatPoint.h" |
10 #include "IntSize.h" | 10 #include "IntSize.h" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 | 13 |
14 class CCLayerImpl; | 14 class LayerImpl; |
15 class CCScrollbarLayerImpl; | 15 class ScrollbarLayerImpl; |
16 | 16 |
17 // This abstract class represents the compositor-side analogy of ScrollbarAnimat
or. | 17 // This abstract class represents the compositor-side analogy of ScrollbarAnimat
or. |
18 // Individual platforms should subclass it to provide specialized implementation
. | 18 // Individual platforms should subclass it to provide specialized implementation
. |
19 class CCScrollbarAnimationController { | 19 class ScrollbarAnimationController { |
20 public: | 20 public: |
21 static scoped_ptr<CCScrollbarAnimationController> create(CCLayerImpl* scroll
Layer); | 21 static scoped_ptr<ScrollbarAnimationController> create(LayerImpl* scrollLaye
r); |
22 | 22 |
23 virtual ~CCScrollbarAnimationController(); | 23 virtual ~ScrollbarAnimationController(); |
24 | 24 |
25 virtual bool animate(double monotonicTime); | 25 virtual bool animate(double monotonicTime); |
26 void didPinchGestureBegin(); | 26 void didPinchGestureBegin(); |
27 void didPinchGestureUpdate(); | 27 void didPinchGestureUpdate(); |
28 void didPinchGestureEnd(); | 28 void didPinchGestureEnd(); |
29 void updateScrollOffset(CCLayerImpl* scrollLayer); | 29 void updateScrollOffset(LayerImpl* scrollLayer); |
30 | 30 |
31 void setHorizontalScrollbarLayer(CCScrollbarLayerImpl* layer) { m_horizontal
ScrollbarLayer = layer; } | 31 void setHorizontalScrollbarLayer(ScrollbarLayerImpl* layer) { m_horizontalSc
rollbarLayer = layer; } |
32 CCScrollbarLayerImpl* horizontalScrollbarLayer() const { return m_horizontal
ScrollbarLayer; } | 32 ScrollbarLayerImpl* horizontalScrollbarLayer() const { return m_horizontalSc
rollbarLayer; } |
33 | 33 |
34 void setVerticalScrollbarLayer(CCScrollbarLayerImpl* layer) { m_verticalScro
llbarLayer = layer; } | 34 void setVerticalScrollbarLayer(ScrollbarLayerImpl* layer) { m_verticalScroll
barLayer = layer; } |
35 CCScrollbarLayerImpl* verticalScrollbarLayer() const { return m_verticalScro
llbarLayer; } | 35 ScrollbarLayerImpl* verticalScrollbarLayer() const { return m_verticalScroll
barLayer; } |
36 | 36 |
37 FloatPoint currentPos() const { return m_currentPos; } | 37 FloatPoint currentPos() const { return m_currentPos; } |
38 IntSize totalSize() const { return m_totalSize; } | 38 IntSize totalSize() const { return m_totalSize; } |
39 IntSize maximum() const { return m_maximum; } | 39 IntSize maximum() const { return m_maximum; } |
40 | 40 |
41 virtual void didPinchGestureBeginAtTime(double monotonicTime) { } | 41 virtual void didPinchGestureBeginAtTime(double monotonicTime) { } |
42 virtual void didPinchGestureUpdateAtTime(double monotonicTime) { } | 42 virtual void didPinchGestureUpdateAtTime(double monotonicTime) { } |
43 virtual void didPinchGestureEndAtTime(double monotonicTime) { } | 43 virtual void didPinchGestureEndAtTime(double monotonicTime) { } |
44 virtual void updateScrollOffsetAtTime(CCLayerImpl* scrollLayer, double monot
onicTime); | 44 virtual void updateScrollOffsetAtTime(LayerImpl* scrollLayer, double monoton
icTime); |
45 | 45 |
46 protected: | 46 protected: |
47 explicit CCScrollbarAnimationController(CCLayerImpl* scrollLayer); | 47 explicit ScrollbarAnimationController(LayerImpl* scrollLayer); |
48 | 48 |
49 private: | 49 private: |
50 static IntSize getScrollLayerBounds(const CCLayerImpl*); | 50 static IntSize getScrollLayerBounds(const LayerImpl*); |
51 | 51 |
52 // Beware of dangling pointer. Always update these during tree synchronizati
on. | 52 // Beware of dangling pointer. Always update these during tree synchronizati
on. |
53 CCScrollbarLayerImpl* m_horizontalScrollbarLayer; | 53 ScrollbarLayerImpl* m_horizontalScrollbarLayer; |
54 CCScrollbarLayerImpl* m_verticalScrollbarLayer; | 54 ScrollbarLayerImpl* m_verticalScrollbarLayer; |
55 | 55 |
56 FloatPoint m_currentPos; | 56 FloatPoint m_currentPos; |
57 IntSize m_totalSize; | 57 IntSize m_totalSize; |
58 IntSize m_maximum; | 58 IntSize m_maximum; |
59 }; | 59 }; |
60 | 60 |
61 } // namespace cc | 61 } // namespace cc |
62 | 62 |
63 #endif // CCScrollbarAnimationController_h | 63 #endif // CCScrollbarAnimationController_h |
OLD | NEW |