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