OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 CCInputHandler_h | 5 #ifndef CCInputHandler_h |
6 #define CCInputHandler_h | 6 #define CCInputHandler_h |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 | 9 |
10 namespace cc { | 10 namespace cc { |
11 | 11 |
12 class IntPoint; | 12 class IntPoint; |
13 class IntSize; | 13 class IntSize; |
14 | 14 |
15 // The CCInputHandler is a way for the embedders to interact with | 15 // The InputHandler is a way for the embedders to interact with |
16 // the impl thread side of the compositor implementation. | 16 // the impl thread side of the compositor implementation. |
17 // | 17 // |
18 // There is one CCInputHandler for every CCLayerTreeHost. It is | 18 // There is one InputHandler for every LayerTreeHost. It is |
19 // created on the main thread and used only on the impl thread. | 19 // created on the main thread and used only on the impl thread. |
20 // | 20 // |
21 // The CCInputHandler is constructed with a CCInputHandlerClient, which is the | 21 // The InputHandler is constructed with a InputHandlerClient, which is the |
22 // interface by which the handler can manipulate the LayerTree. | 22 // interface by which the handler can manipulate the LayerTree. |
23 class CCInputHandlerClient { | 23 class InputHandlerClient { |
24 public: | 24 public: |
25 enum ScrollStatus { ScrollOnMainThread, ScrollStarted, ScrollIgnored }; | 25 enum ScrollStatus { ScrollOnMainThread, ScrollStarted, ScrollIgnored }; |
26 enum ScrollInputType { Gesture, Wheel }; | 26 enum ScrollInputType { Gesture, Wheel }; |
27 | 27 |
28 // Selects a layer to be scrolled at a given point in window coordinates. | 28 // Selects a layer to be scrolled at a given point in window coordinates. |
29 // Returns ScrollStarted if the layer at the coordinates can be scrolled, | 29 // Returns ScrollStarted if the layer at the coordinates can be scrolled, |
30 // ScrollOnMainThread if the scroll event should instead be delegated to the | 30 // ScrollOnMainThread if the scroll event should instead be delegated to the |
31 // main thread, or ScrollIgnored if there is nothing to be scrolled at the | 31 // main thread, or ScrollIgnored if there is nothing to be scrolled at the |
32 // given coordinates. | 32 // given coordinates. |
33 virtual ScrollStatus scrollBegin(const IntPoint&, ScrollInputType) = 0; | 33 virtual ScrollStatus scrollBegin(const IntPoint&, ScrollInputType) = 0; |
(...skipping 11 matching lines...) Expand all Loading... |
45 virtual void pinchGestureBegin() = 0; | 45 virtual void pinchGestureBegin() = 0; |
46 virtual void pinchGestureUpdate(float magnifyDelta, const IntPoint& anchor)
= 0; | 46 virtual void pinchGestureUpdate(float magnifyDelta, const IntPoint& anchor)
= 0; |
47 virtual void pinchGestureEnd() = 0; | 47 virtual void pinchGestureEnd() = 0; |
48 | 48 |
49 virtual void startPageScaleAnimation(const IntSize& targetPosition, | 49 virtual void startPageScaleAnimation(const IntSize& targetPosition, |
50 bool anchorPoint, | 50 bool anchorPoint, |
51 float pageScale, | 51 float pageScale, |
52 double startTime, | 52 double startTime, |
53 double duration) = 0; | 53 double duration) = 0; |
54 | 54 |
55 // Request another callback to CCInputHandler::animate(). | 55 // Request another callback to InputHandler::animate(). |
56 virtual void scheduleAnimation() = 0; | 56 virtual void scheduleAnimation() = 0; |
57 | 57 |
58 protected: | 58 protected: |
59 CCInputHandlerClient() { } | 59 InputHandlerClient() { } |
60 virtual ~CCInputHandlerClient() { } | 60 virtual ~InputHandlerClient() { } |
61 | 61 |
62 private: | 62 private: |
63 DISALLOW_COPY_AND_ASSIGN(CCInputHandlerClient); | 63 DISALLOW_COPY_AND_ASSIGN(InputHandlerClient); |
64 }; | 64 }; |
65 | 65 |
66 class CCInputHandler { | 66 class InputHandler { |
67 public: | 67 public: |
68 virtual ~CCInputHandler() { } | 68 virtual ~InputHandler() { } |
69 | 69 |
70 virtual void bindToClient(CCInputHandlerClient*) = 0; | 70 virtual void bindToClient(InputHandlerClient*) = 0; |
71 virtual void animate(double monotonicTime) = 0; | 71 virtual void animate(double monotonicTime) = 0; |
72 | 72 |
73 protected: | 73 protected: |
74 CCInputHandler() { } | 74 InputHandler() { } |
75 | 75 |
76 private: | 76 private: |
77 DISALLOW_COPY_AND_ASSIGN(CCInputHandler); | 77 DISALLOW_COPY_AND_ASSIGN(InputHandler); |
78 }; | 78 }; |
79 | 79 |
80 } | 80 } |
81 | 81 |
82 #endif | 82 #endif |
OLD | NEW |