Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: remoting/protocol/input_event_tracker.h

Issue 1403583003: Use standard DOM code definitions instead of custom. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Windows compile. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_INPUT_EVENT_TRACKER_H_ 5 #ifndef REMOTING_PROTOCOL_INPUT_EVENT_TRACKER_H_
6 #define REMOTING_PROTOCOL_INPUT_EVENT_TRACKER_H_ 6 #define REMOTING_PROTOCOL_INPUT_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 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" 13 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
14 #include "ui/events/keycodes/dom/dom_code.h"
14 15
15 namespace remoting { 16 namespace remoting {
16 namespace protocol { 17 namespace protocol {
17 18
18 // Filtering InputStub which tracks mouse and keyboard input events before 19 // Filtering InputStub which tracks mouse and keyboard input events before
19 // passing them on to |input_stub|, and can dispatch release events to 20 // 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 // |input_stub| for all currently-pressed keys and buttons when necessary.
21 class InputEventTracker : public InputStub { 22 class InputEventTracker : public InputStub {
22 public: 23 public:
23 explicit InputEventTracker(protocol::InputStub* input_stub); 24 explicit InputEventTracker(protocol::InputStub* input_stub);
24 ~InputEventTracker() override; 25 ~InputEventTracker() override;
25 26
26 // Returns true if the key with the specified USB code is currently pressed. 27 // Returns true if the key with the specified USB code is currently pressed.
27 bool IsKeyPressed(uint32 usb_keycode) const; 28 bool IsKeyPressed(ui::DomCode usb_keycode) const;
28 29
29 // Returns the count of keys currently pressed. 30 // Returns the count of keys currently pressed.
30 int PressedKeyCount() const; 31 int PressedKeyCount() const;
31 32
32 // Dispatch release events for all currently-pressed keys, mouse buttons, and 33 // Dispatch release events for all currently-pressed keys, mouse buttons, and
33 // touch points to the InputStub. 34 // touch points to the InputStub.
34 void ReleaseAll(); 35 void ReleaseAll();
35 36
36 // Similar to ReleaseAll, but conditional on a modifier key tracked by this 37 // Similar to ReleaseAll, but conditional on a modifier key tracked by this
37 // class being pressed without the corresponding parameter indicating that it 38 // class being pressed without the corresponding parameter indicating that it
38 // should be. 39 // should be.
39 void ReleaseAllIfModifiersStuck(bool alt_expected, bool ctrl_expected, 40 void ReleaseAllIfModifiersStuck(bool alt_expected, bool ctrl_expected,
40 bool os_expected, bool shift_expected); 41 bool os_expected, bool shift_expected);
41 42
42 // InputStub interface. 43 // InputStub interface.
43 void InjectKeyEvent(const KeyEvent& event) override; 44 void InjectKeyEvent(const KeyEvent& event) override;
44 void InjectTextEvent(const TextEvent& event) override; 45 void InjectTextEvent(const TextEvent& event) override;
45 void InjectMouseEvent(const MouseEvent& event) override; 46 void InjectMouseEvent(const MouseEvent& event) override;
46 void InjectTouchEvent(const TouchEvent& event) override; 47 void InjectTouchEvent(const TouchEvent& event) override;
47 48
48 private: 49 private:
49 protocol::InputStub* input_stub_; 50 protocol::InputStub* input_stub_;
50 51
51 std::set<uint32> pressed_keys_; 52 std::set<ui::DomCode> pressed_keys_;
52 53
53 webrtc::DesktopVector mouse_pos_; 54 webrtc::DesktopVector mouse_pos_;
54 uint32 mouse_button_state_; 55 uint32 mouse_button_state_;
55 56
56 std::set<uint32> touch_point_ids_; 57 std::set<uint32> touch_point_ids_;
57 58
58 DISALLOW_COPY_AND_ASSIGN(InputEventTracker); 59 DISALLOW_COPY_AND_ASSIGN(InputEventTracker);
59 }; 60 };
60 61
61 } // namespace protocol 62 } // namespace protocol
62 } // namespace remoting 63 } // namespace remoting
63 64
64 #endif // REMOTING_PROTOCOL_INPUT_EVENT_TRACKER_H_ 65 #endif // REMOTING_PROTOCOL_INPUT_EVENT_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698