1 // Copyright (c) 2012 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.
5 #ifndef REMOTING_PROTOCOL_INPUT_EVENT_TRACKER_H_
6 #define REMOTING_PROTOCOL_INPUT_EVENT_TRACKER_H_
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "remoting/protocol/input_stub.h"
13 #include "third_party/skia/include/core/SkPoint.h"
18 // Filtering InputStub which tracks mouse and keyboard input events before
19 // passing them on to |input_stub|, and can dispatch release events to
20 // |input_stub| for all currently-pressed keys and buttons when necessary.
21 class InputEventTracker
: public InputStub
{
23 explicit InputEventTracker(protocol::InputStub
* input_stub
);
24 virtual ~InputEventTracker();
26 // Returns true if the key with the specified USB code is currently pressed.
27 bool IsKeyPressed(uint32 usb_keycode
) const;
29 // Returns the count of keys currently pressed.
30 int PressedKeyCount() const;
32 // Dispatch release events for all currently-pressed keys and mouse buttons
36 // InputStub interface.
37 virtual void InjectKeyEvent(const KeyEvent
& event
) OVERRIDE
;
38 virtual void InjectMouseEvent(const MouseEvent
& event
) OVERRIDE
;
41 protocol::InputStub
* input_stub_
;
43 std::set
<uint32
> pressed_keys_
;
46 uint32 mouse_button_state_
;
48 DISALLOW_COPY_AND_ASSIGN(InputEventTracker
);
51 } // namespace protocol
52 } // namespace remoting
54 #endif // REMOTING_PROTOCOL_INPUT_EVENT_TRACKER_H_