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

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: rebased 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') | no next file with comments »
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 WillShutdown() = 0;
29 virtual void Animate(base::TimeTicks time) = 0;
30 virtual void MainThreadHasStoppedFlinging() = 0;
31
32 protected:
33 InputHandlerClient() {}
34
35 private:
36 DISALLOW_COPY_AND_ASSIGN(InputHandlerClient);
37 };
38
24 // The InputHandler is a way for the embedders to interact with the impl thread 39 // 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 40 // side of the compositor implementation. There is one InputHandler per
26 // LayerTreeHost. To use the input handler, implement the InputHanderClient 41 // LayerTreeHost. To use the input handler, implement the InputHanderClient
27 // interface and bind it to the handler on the compositor thread. 42 // interface and bind it to the handler on the compositor thread.
28 class CC_EXPORT InputHandler { 43 class CC_EXPORT InputHandler {
29 public: 44 public:
30 enum ScrollStatus { ScrollOnMainThread, ScrollStarted, ScrollIgnored }; 45 enum ScrollStatus { ScrollOnMainThread, ScrollStarted, ScrollIgnored };
31 enum ScrollInputType { Gesture, Wheel, NonBubblingGesture }; 46 enum ScrollInputType { Gesture, Wheel, NonBubblingGesture };
32 47
48 // Binds a client to this handler to receive notifications. Only one client
49 // can be bound to an InputHandler. The client must live at least until the
50 // handler calls WillShutdown() on the client.
51 virtual void BindToClient(InputHandlerClient* client) = 0;
52
33 // Selects a layer to be scrolled at a given point in viewport (logical 53 // Selects a layer to be scrolled at a given point in viewport (logical
34 // pixel) coordinates. Returns ScrollStarted if the layer at the coordinates 54 // pixel) coordinates. Returns ScrollStarted if the layer at the coordinates
35 // can be scrolled, ScrollOnMainThread if the scroll event should instead be 55 // 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 56 // delegated to the main thread, or ScrollIgnored if there is nothing to be
37 // scrolled at the given coordinates. 57 // scrolled at the given coordinates.
38 virtual ScrollStatus ScrollBegin(gfx::Point viewport_point, 58 virtual ScrollStatus ScrollBegin(gfx::Point viewport_point,
39 ScrollInputType type) = 0; 59 ScrollInputType type) = 0;
40 60
41 // Scroll the selected layer starting at the given position. If the scroll 61 // 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 62 // 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; 113 base::TimeTicks frame_time) = 0;
94 114
95 protected: 115 protected:
96 InputHandler() {} 116 InputHandler() {}
97 virtual ~InputHandler() {} 117 virtual ~InputHandler() {}
98 118
99 private: 119 private:
100 DISALLOW_COPY_AND_ASSIGN(InputHandler); 120 DISALLOW_COPY_AND_ASSIGN(InputHandler);
101 }; 121 };
102 122
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 123 } // namespace cc
119 124
120 #endif // CC_INPUT_INPUT_HANDLER_H_ 125 #endif // CC_INPUT_INPUT_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/test/fake_layer_tree_host_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698