OLD | NEW |
1 // Copyright (c) 2011 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_PROTOCOL_KEY_EVENT_TRACKER_H_ | 5 #ifndef REMOTING_PROTOCOL_KEY_EVENT_TRACKER_H_ |
6 #define REMOTING_PROTOCOL_KEY_EVENT_TRACKER_H_ | 6 #define REMOTING_PROTOCOL_KEY_EVENT_TRACKER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "remoting/protocol/input_stub.h" | 12 #include "remoting/protocol/input_stub.h" |
13 | 13 |
14 namespace remoting { | 14 namespace remoting { |
15 namespace protocol { | 15 namespace protocol { |
16 | 16 |
17 // Filtering InputStub which tracks key press and release events before passing | 17 // Filtering InputStub which tracks key press and release events before passing |
18 // them on to |input_stub|, and can dispatch release events to |input_stub| for | 18 // them on to |input_stub|, and can dispatch release events to |input_stub| for |
19 // all currently-pressed keys when necessary. | 19 // all currently-pressed keys when necessary. |
20 class KeyEventTracker : public InputStub { | 20 class KeyEventTracker : public InputStub { |
21 public: | 21 public: |
22 KeyEventTracker(protocol::InputStub* input_stub); | 22 KeyEventTracker(protocol::InputStub* input_stub); |
23 virtual ~KeyEventTracker(); | 23 virtual ~KeyEventTracker(); |
24 | 24 |
25 // Dispatch release events for all currently-pressed keys to the InputStub. | 25 // Dispatch release events for all currently-pressed keys to the InputStub. |
26 void ReleaseAllKeys(); | 26 void ReleaseAllKeys(); |
27 | 27 |
28 // InputStub interface. | 28 // InputStub interface. |
| 29 virtual void InjectClipboardEvent(const ClipboardEvent& event) OVERRIDE; |
29 virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; | 30 virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; |
30 virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; | 31 virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; |
31 | 32 |
32 private: | 33 private: |
33 protocol::InputStub* input_stub_; | 34 protocol::InputStub* input_stub_; |
34 | 35 |
35 std::set<int> pressed_keys_; | 36 std::set<int> pressed_keys_; |
36 | 37 |
37 DISALLOW_COPY_AND_ASSIGN(KeyEventTracker); | 38 DISALLOW_COPY_AND_ASSIGN(KeyEventTracker); |
38 }; | 39 }; |
39 | 40 |
40 } // namespace protocol | 41 } // namespace protocol |
41 } // namespace remoting | 42 } // namespace remoting |
42 | 43 |
43 #endif // REMOTING_PROTOCOL_KEY_EVENT_TRACKER_H_ | 44 #endif // REMOTING_PROTOCOL_KEY_EVENT_TRACKER_H_ |
OLD | NEW |