Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: cc/input/input_handler.h

Issue 13844021: Move compositor thread input handling logic into content (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win component build Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/test/fake_layer_tree_host_client.h » ('j') | cc/trees/layer_tree_host_impl.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 CC_INPUT_INPUT_HANDLER_H_ 5 #ifndef CC_INPUT_INPUT_HANDLER_H_
6 #define CC_INPUT_INPUT_HANDLER_H_ 6 #define CC_INPUT_INPUT_HANDLER_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/base/cc_export.h" 10 #include "cc/base/cc_export.h"
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbar.h" 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbar.h"
12 12
13 namespace gfx { 13 namespace gfx {
14 class Point; 14 class Point;
15 class PointF; 15 class PointF;
16 class Vector2d; 16 class Vector2d;
17 class Vector2dF; 17 class Vector2dF;
18 } 18 }
19 19
20 namespace cc { 20 namespace cc {
21 21
22 class LayerScrollOffsetDelegate; 22 class LayerScrollOffsetDelegate;
23 23
24 class CC_EXPORT InputHandlerClient {
25 public:
26 virtual ~InputHandlerClient() {}
27
28 virtual void Animate(base::TimeTicks time) = 0;
29 virtual void MainThreadHasStoppedFlinging() = 0;
30
31 protected:
32 InputHandlerClient() {}
33
34 private:
35 DISALLOW_COPY_AND_ASSIGN(InputHandlerClient);
36 };
37
24 // The InputHandler is a way for the embedders to interact with the impl thread 38 // The InputHandler is a way for the embedders to interact with the impl thread
25 // side of the compositor implementation. There is one InputHandler per 39 // side of the compositor implementation. There is one InputHandler per
26 // LayerTreeHost. To use the input handler, implement the InputHanderClient 40 // LayerTreeHost. To use the input handler, implement the InputHanderClient
27 // interface and bind it to the handler on the compositor thread. 41 // interface and bind it to the handler on the compositor thread.
28 class CC_EXPORT InputHandler { 42 class CC_EXPORT InputHandler {
29 public: 43 public:
30 enum ScrollStatus { ScrollOnMainThread, ScrollStarted, ScrollIgnored }; 44 enum ScrollStatus { ScrollOnMainThread, ScrollStarted, ScrollIgnored };
31 enum ScrollInputType { Gesture, Wheel, NonBubblingGesture }; 45 enum ScrollInputType { Gesture, Wheel, NonBubblingGesture };
32 46
47 // Binds a client to this handler to receive notifications. Only one client
48 // can be bound to an InputHandler. The handler takes ownership of the client.
49 virtual void BindToClient(InputHandlerClient* client) = 0;
50
33 // Selects a layer to be scrolled at a given point in viewport (logical 51 // Selects a layer to be scrolled at a given point in viewport (logical
34 // pixel) coordinates. Returns ScrollStarted if the layer at the coordinates 52 // pixel) coordinates. Returns ScrollStarted if the layer at the coordinates
35 // can be scrolled, ScrollOnMainThread if the scroll event should instead be 53 // 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 54 // delegated to the main thread, or ScrollIgnored if there is nothing to be
37 // scrolled at the given coordinates. 55 // scrolled at the given coordinates.
38 virtual ScrollStatus ScrollBegin(gfx::Point viewport_point, 56 virtual ScrollStatus ScrollBegin(gfx::Point viewport_point,
39 ScrollInputType type) = 0; 57 ScrollInputType type) = 0;
40 58
41 // Scroll the selected layer starting at the given position. If the scroll 59 // Scroll the selected layer starting at the given position. If the scroll
42 // type given to ScrollBegin was a gesture, then the scroll point and delta 60 // type given to ScrollBegin was a gesture, then the scroll point and delta
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 base::TimeTicks frame_time) = 0; 111 base::TimeTicks frame_time) = 0;
94 112
95 protected: 113 protected:
96 InputHandler() {} 114 InputHandler() {}
97 virtual ~InputHandler() {} 115 virtual ~InputHandler() {}
98 116
99 private: 117 private:
100 DISALLOW_COPY_AND_ASSIGN(InputHandler); 118 DISALLOW_COPY_AND_ASSIGN(InputHandler);
101 }; 119 };
102 120
103 class CC_EXPORT InputHandlerClient {
104 public:
105 virtual ~InputHandlerClient() {}
106
107 virtual void BindToHandler(InputHandler* handler) = 0;
108 virtual void Animate(base::TimeTicks time) = 0;
109 virtual void MainThreadHasStoppedFlinging() = 0;
110
111 protected:
112 InputHandlerClient() {}
113
114 private:
115 DISALLOW_COPY_AND_ASSIGN(InputHandlerClient);
116 };
117
118 } // namespace cc 121 } // namespace cc
119 122
120 #endif // CC_INPUT_INPUT_HANDLER_H_ 123 #endif // CC_INPUT_INPUT_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/test/fake_layer_tree_host_client.h » ('j') | cc/trees/layer_tree_host_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698