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

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

Issue 11781003: Connect to DesktopEnvironment's stubs only when audio/video schedulers are about to be created. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
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/skia/include/core/SkPoint.h" 13 #include "third_party/skia/include/core/SkPoint.h"
14 14
15 namespace remoting { 15 namespace remoting {
16 namespace protocol { 16 namespace protocol {
17 17
18 // Filtering InputStub which tracks mouse and keyboard input events before 18 // Filtering InputStub which tracks mouse and keyboard input events before
19 // passing them on to |input_stub|, and can dispatch release events to 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. 20 // |input_stub| for all currently-pressed keys and buttons when necessary.
21 class InputEventTracker : public InputStub { 21 class InputEventTracker : public InputStub {
22 public: 22 public:
23 explicit InputEventTracker(protocol::InputStub* input_stub); 23 explicit InputEventTracker(InputStub* input_stub);
24 virtual ~InputEventTracker(); 24 virtual ~InputEventTracker();
25 25
26 // Sets the InputStub that sends events to the client.
27 void set_input_stub(InputStub* input_stub) { input_stub_ = input_stub; }
Wez 2013/01/08 18:34:00 Why not derived from InputFilter to get this, and
Wez 2013/01/08 18:34:00 The problem with this is that it creates the quest
alexeypa (please no reviews) 2013/01/08 20:00:14 Done.
28
26 // Returns true if the key with the specified USB code is currently pressed. 29 // Returns true if the key with the specified USB code is currently pressed.
27 bool IsKeyPressed(uint32 usb_keycode) const; 30 bool IsKeyPressed(uint32 usb_keycode) const;
28 31
29 // Returns the count of keys currently pressed. 32 // Returns the count of keys currently pressed.
30 int PressedKeyCount() const; 33 int PressedKeyCount() const;
31 34
32 // Dispatch release events for all currently-pressed keys and mouse buttons 35 // Dispatch release events for all currently-pressed keys and mouse buttons
33 // to the InputStub. 36 // to the InputStub.
34 void ReleaseAll(); 37 void ReleaseAll();
35 38
36 // InputStub interface. 39 // InputStub interface.
37 virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE; 40 virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE;
38 virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE; 41 virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE;
39 42
40 private: 43 private:
41 protocol::InputStub* input_stub_; 44 protocol::InputStub* input_stub_;
42 45
43 std::set<uint32> pressed_keys_; 46 std::set<uint32> pressed_keys_;
44 47
45 SkIPoint mouse_pos_; 48 SkIPoint mouse_pos_;
46 uint32 mouse_button_state_; 49 uint32 mouse_button_state_;
47 50
48 DISALLOW_COPY_AND_ASSIGN(InputEventTracker); 51 DISALLOW_COPY_AND_ASSIGN(InputEventTracker);
49 }; 52 };
50 53
51 } // namespace protocol 54 } // namespace protocol
52 } // namespace remoting 55 } // namespace remoting
53 56
54 #endif // REMOTING_PROTOCOL_INPUT_EVENT_TRACKER_H_ 57 #endif // REMOTING_PROTOCOL_INPUT_EVENT_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698