OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 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 <set> |
| 9 |
8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
9 #include "base/task.h" | 11 #include "base/task.h" |
10 #include "remoting/proto/event.pb.h" | 12 #include "remoting/proto/event.pb.h" |
11 | 13 |
12 namespace remoting { | 14 namespace remoting { |
13 | 15 |
14 class ClientContext; | 16 class ClientContext; |
15 class ChromotingView; | 17 class ChromotingView; |
16 | 18 |
17 namespace protocol { | 19 namespace protocol { |
18 class ConnectionToHost; | 20 class ConnectionToHost; |
19 } // namespace protocol | 21 } // namespace protocol |
20 | 22 |
21 class InputHandler { | 23 class InputHandler { |
22 public: | 24 public: |
23 InputHandler(ClientContext* context, | 25 InputHandler(ClientContext* context, |
24 protocol::ConnectionToHost* connection, | 26 protocol::ConnectionToHost* connection, |
25 ChromotingView* view); | 27 ChromotingView* view); |
26 virtual ~InputHandler() {} | 28 virtual ~InputHandler(); |
27 | 29 |
28 virtual void Initialize() = 0; | 30 virtual void Initialize() = 0; |
29 | 31 |
| 32 void ReleaseAllKeys(); |
| 33 |
30 protected: | 34 protected: |
31 void SendKeyEvent(bool press, int keycode); | 35 void SendKeyEvent(bool press, int keycode); |
32 void SendMouseMoveEvent(int x, int y); | 36 void SendMouseMoveEvent(int x, int y); |
33 void SendMouseButtonEvent(bool down, | 37 void SendMouseButtonEvent(bool down, |
34 protocol::MouseEvent::MouseButton button); | 38 protocol::MouseEvent::MouseButton button); |
35 | 39 |
36 ClientContext* context_; | 40 ClientContext* context_; |
37 protocol::ConnectionToHost* connection_; | 41 protocol::ConnectionToHost* connection_; |
38 ChromotingView* view_; | 42 ChromotingView* view_; |
39 | 43 |
40 private: | 44 private: |
| 45 std::set<int> pressed_keys_; |
| 46 |
41 DISALLOW_COPY_AND_ASSIGN(InputHandler); | 47 DISALLOW_COPY_AND_ASSIGN(InputHandler); |
42 }; | 48 }; |
43 | 49 |
44 } // namespace remoting | 50 } // namespace remoting |
45 | 51 |
46 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::InputHandler); | 52 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::InputHandler); |
47 | 53 |
48 #endif // REMOTING_CLIENT_INPUT_HANDLER_H_ | 54 #endif // REMOTING_CLIENT_INPUT_HANDLER_H_ |
OLD | NEW |