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