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

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

Issue 1760633003: Notify normalizing input filters on blur. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "remoting/protocol/input_stub.h" 14 #include "remoting/protocol/input_stub.h"
15 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" 15 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
16 #include "ui/events/keycodes/dom/dom_code.h" 16 #include "ui/events/keycodes/dom/dom_code.h"
17 17
18 namespace remoting { 18 namespace remoting {
19 namespace protocol { 19 namespace protocol {
20 20
21 // Filtering InputStub which tracks mouse and keyboard input events before 21 // Filtering InputStub which tracks mouse and keyboard input events before
22 // passing them on to |input_stub|, and can dispatch release events to 22 // passing them on to |input_stub|, and can dispatch release events to
23 // |input_stub| for all currently-pressed keys and buttons when necessary. 23 // |input_stub| for all currently-pressed keys and buttons when necessary.
24 class InputEventTracker : public InputStub { 24 class InputEventTracker : public InputStub {
25 public: 25 public:
26 explicit InputEventTracker(protocol::InputStub* input_stub); 26 explicit InputEventTracker();
27 ~InputEventTracker() override; 27 ~InputEventTracker() override;
28 28
29 void set_input_stub(protocol::InputStub* input_stub) {
Sergey Ulanov 2016/03/04 00:30:45 don't need protocol::
Jamie 2016/03/04 01:39:46 Done.
30 input_stub_ = input_stub;
31 }
32
29 // Returns true if the key with the specified USB code is currently pressed. 33 // Returns true if the key with the specified USB code is currently pressed.
30 bool IsKeyPressed(ui::DomCode usb_keycode) const; 34 bool IsKeyPressed(ui::DomCode usb_keycode) const;
31 35
32 // Returns the count of keys currently pressed. 36 // Returns the count of keys currently pressed.
33 int PressedKeyCount() const; 37 int PressedKeyCount() const;
34 38
35 // Dispatch release events for all currently-pressed keys, mouse buttons, and 39 // Dispatch release events for all currently-pressed keys, mouse buttons, and
36 // touch points to the InputStub. 40 // touch points to the InputStub.
37 void ReleaseAll(); 41 void ReleaseAll();
38 42
39 // Similar to ReleaseAll, but conditional on a modifier key tracked by this 43 // Similar to ReleaseAll, but conditional on a modifier key tracked by this
40 // class being pressed without the corresponding parameter indicating that it 44 // class being pressed without the corresponding parameter indicating that it
41 // should be. 45 // should be.
42 void ReleaseAllIfModifiersStuck(bool alt_expected, bool ctrl_expected, 46 void ReleaseAllIfModifiersStuck(bool alt_expected, bool ctrl_expected,
43 bool os_expected, bool shift_expected); 47 bool os_expected, bool shift_expected);
44 48
45 // InputStub interface. 49 // InputStub interface.
46 void InjectKeyEvent(const KeyEvent& event) override; 50 void InjectKeyEvent(const KeyEvent& event) override;
47 void InjectTextEvent(const TextEvent& event) override; 51 void InjectTextEvent(const TextEvent& event) override;
48 void InjectMouseEvent(const MouseEvent& event) override; 52 void InjectMouseEvent(const MouseEvent& event) override;
49 void InjectTouchEvent(const TouchEvent& event) override; 53 void InjectTouchEvent(const TouchEvent& event) override;
50 54
51 private: 55 private:
52 protocol::InputStub* input_stub_; 56 protocol::InputStub* input_stub_ = nullptr;
Sergey Ulanov 2016/03/04 00:30:45 don't need protocol::
Jamie 2016/03/04 01:39:46 Done.
53 57
54 std::set<ui::DomCode> pressed_keys_; 58 std::set<ui::DomCode> pressed_keys_;
55 59
56 webrtc::DesktopVector mouse_pos_; 60 webrtc::DesktopVector mouse_pos_;
57 uint32_t mouse_button_state_; 61 uint32_t mouse_button_state_ = 0;
58 62
59 std::set<uint32_t> touch_point_ids_; 63 std::set<uint32_t> touch_point_ids_;
60 64
61 DISALLOW_COPY_AND_ASSIGN(InputEventTracker); 65 DISALLOW_COPY_AND_ASSIGN(InputEventTracker);
62 }; 66 };
63 67
64 } // namespace protocol 68 } // namespace protocol
65 } // namespace remoting 69 } // namespace remoting
66 70
67 #endif // REMOTING_PROTOCOL_INPUT_EVENT_TRACKER_H_ 71 #endif // REMOTING_PROTOCOL_INPUT_EVENT_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698