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