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

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: Fix host build. 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 InputEventTracker();
27 explicit InputEventTracker(InputStub* input_stub);
27 ~InputEventTracker() override; 28 ~InputEventTracker() override;
28 29
30 void set_input_stub(InputStub* input_stub) {
31 input_stub_ = input_stub;
32 }
33
29 // Returns true if the key with the specified USB code is currently pressed. 34 // Returns true if the key with the specified USB code is currently pressed.
30 bool IsKeyPressed(ui::DomCode usb_keycode) const; 35 bool IsKeyPressed(ui::DomCode usb_keycode) const;
31 36
32 // Returns the count of keys currently pressed. 37 // Returns the count of keys currently pressed.
33 int PressedKeyCount() const; 38 int PressedKeyCount() const;
34 39
35 // Dispatch release events for all currently-pressed keys, mouse buttons, and 40 // Dispatch release events for all currently-pressed keys, mouse buttons, and
36 // touch points to the InputStub. 41 // touch points to the InputStub.
37 void ReleaseAll(); 42 void ReleaseAll();
38 43
39 // Similar to ReleaseAll, but conditional on a modifier key tracked by this 44 // Similar to ReleaseAll, but conditional on a modifier key tracked by this
40 // class being pressed without the corresponding parameter indicating that it 45 // class being pressed without the corresponding parameter indicating that it
41 // should be. 46 // should be.
42 void ReleaseAllIfModifiersStuck(bool alt_expected, bool ctrl_expected, 47 void ReleaseAllIfModifiersStuck(bool alt_expected, bool ctrl_expected,
43 bool os_expected, bool shift_expected); 48 bool os_expected, bool shift_expected);
44 49
45 // InputStub interface. 50 // InputStub interface.
46 void InjectKeyEvent(const KeyEvent& event) override; 51 void InjectKeyEvent(const KeyEvent& event) override;
47 void InjectTextEvent(const TextEvent& event) override; 52 void InjectTextEvent(const TextEvent& event) override;
48 void InjectMouseEvent(const MouseEvent& event) override; 53 void InjectMouseEvent(const MouseEvent& event) override;
49 void InjectTouchEvent(const TouchEvent& event) override; 54 void InjectTouchEvent(const TouchEvent& event) override;
50 55
51 private: 56 private:
52 protocol::InputStub* input_stub_; 57 InputStub* input_stub_ = nullptr;
53 58
54 std::set<ui::DomCode> pressed_keys_; 59 std::set<ui::DomCode> pressed_keys_;
55 60
56 webrtc::DesktopVector mouse_pos_; 61 webrtc::DesktopVector mouse_pos_;
57 uint32_t mouse_button_state_; 62 uint32_t mouse_button_state_ = 0;
58 63
59 std::set<uint32_t> touch_point_ids_; 64 std::set<uint32_t> touch_point_ids_;
60 65
61 DISALLOW_COPY_AND_ASSIGN(InputEventTracker); 66 DISALLOW_COPY_AND_ASSIGN(InputEventTracker);
62 }; 67 };
63 68
64 } // namespace protocol 69 } // namespace protocol
65 } // namespace remoting 70 } // namespace remoting
66 71
67 #endif // REMOTING_PROTOCOL_INPUT_EVENT_TRACKER_H_ 72 #endif // REMOTING_PROTOCOL_INPUT_EVENT_TRACKER_H_
OLDNEW
« no previous file with comments | « remoting/client/plugin/pepper_input_handler.cc ('k') | remoting/protocol/input_event_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698