OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 REMOTING_CLIENT_INPUT_HANDLER_H_ | 5 #ifndef REMOTING_CLIENT_INPUT_HANDLER_H_ |
6 #define REMOTING_CLIENT_INPUT_HANDLER_H_ | 6 #define REMOTING_CLIENT_INPUT_HANDLER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/task.h" | 9 #include "base/task.h" |
| 10 #include "remoting/base/protocol/chromotocol.pb.h" |
10 | 11 |
11 namespace remoting { | 12 namespace remoting { |
12 | 13 |
13 class ClientContext; | 14 class ClientContext; |
14 class ChromotingView; | 15 class ChromotingView; |
15 class HostConnection; | 16 class HostConnection; |
16 | 17 |
17 class InputHandler { | 18 class InputHandler { |
18 public: | 19 public: |
19 InputHandler(ClientContext* context, | 20 InputHandler(ClientContext* context, |
20 HostConnection* connection, | 21 HostConnection* connection, |
21 ChromotingView* view) | 22 ChromotingView* view); |
22 : context_(context), | |
23 connection_(connection), | |
24 view_(view) {} | |
25 virtual ~InputHandler() {} | 23 virtual ~InputHandler() {} |
26 | 24 |
27 virtual void Initialize() = 0; | 25 virtual void Initialize() = 0; |
28 | 26 |
29 protected: | 27 protected: |
| 28 void SendMouseMoveEvent(int x, int y); |
| 29 void SendMouseButtonEvent(bool down, MouseButton button); |
| 30 |
30 ClientContext* context_; | 31 ClientContext* context_; |
31 HostConnection* connection_; | 32 HostConnection* connection_; |
32 ChromotingView* view_; | 33 ChromotingView* view_; |
33 | 34 |
| 35 private: |
| 36 // True if we should send the next mouse position as an absolute value rather |
| 37 // than a relative value. After sending a single absolute mouse position, |
| 38 // it will automatically switch back to sending relative mouse deltas. |
| 39 bool send_absolute_mouse_; |
| 40 |
| 41 // Current (x,y) position of mouse pointer. |
| 42 // This is the last value that we sent to the host. |
| 43 int mouse_x_, mouse_y_; |
| 44 |
34 DISALLOW_COPY_AND_ASSIGN(InputHandler); | 45 DISALLOW_COPY_AND_ASSIGN(InputHandler); |
35 }; | 46 }; |
36 | 47 |
37 } // namespace remoting | 48 } // namespace remoting |
38 | 49 |
39 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::InputHandler); | 50 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::InputHandler); |
40 | 51 |
41 #endif // REMOTING_CLIENT_INPUT_HANDLER_H_ | 52 #endif // REMOTING_CLIENT_INPUT_HANDLER_H_ |
OLD | NEW |