| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef REMOTING_PROTOCOL_KEY_EVENT_TRACKER_H_ | |
| 6 #define REMOTING_PROTOCOL_KEY_EVENT_TRACKER_H_ | |
| 7 | |
| 8 #include <set> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "remoting/protocol/input_stub.h" | |
| 13 | |
| 14 namespace remoting { | |
| 15 namespace protocol { | |
| 16 | |
| 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 | |
| 19 // all currently-pressed keys when necessary. | |
| 20 class KeyEventTracker : public InputStub { | |
| 21 public: | |
| 22 KeyEventTracker(protocol::InputStub* input_stub); | |
| 23 virtual ~KeyEventTracker(); | |
| 24 | |
| 25 // Dispatch release events for all currently-pressed keys to the InputStub. | |
| 26 void ReleaseAllKeys(); | |
| 27 | |
| 28 // InputStub interface. | |
| 29 virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; | |
| 30 virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; | |
| 31 | |
| 32 private: | |
| 33 protocol::InputStub* input_stub_; | |
| 34 | |
| 35 std::set<int> pressed_keys_; | |
| 36 | |
| 37 DISALLOW_COPY_AND_ASSIGN(KeyEventTracker); | |
| 38 }; | |
| 39 | |
| 40 } // namespace protocol | |
| 41 } // namespace remoting | |
| 42 | |
| 43 #endif // REMOTING_PROTOCOL_KEY_EVENT_TRACKER_H_ | |
| OLD | NEW |