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