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

Unified Diff: remoting/protocol/input_event_tracker.h

Issue 9465035: Move ClientSession's input logic into separate components. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/remote_input_filter_unittest.cc ('k') | remoting/protocol/input_event_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/input_event_tracker.h
diff --git a/remoting/protocol/input_event_tracker.h b/remoting/protocol/input_event_tracker.h
new file mode 100644
index 0000000000000000000000000000000000000000..2eef074d27bbf7b35fb01abd287565f355a630ad
--- /dev/null
+++ b/remoting/protocol/input_event_tracker.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_PROTOCOL_INPUT_EVENT_TRACKER_H_
+#define REMOTING_PROTOCOL_INPUT_EVENT_TRACKER_H_
+
+#include <set>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "remoting/protocol/input_stub.h"
+#include "third_party/skia/include/core/SkPoint.h"
+
+namespace remoting {
+namespace protocol {
+
+// Filtering InputStub which tracks mouse and keyboard input events before
+// passing them on to |input_stub|, and can dispatch release events to
+// |input_stub| for all currently-pressed keys and buttons when necessary.
+class InputEventTracker : public InputStub {
+ public:
+ explicit InputEventTracker(protocol::InputStub* input_stub);
+ virtual ~InputEventTracker();
+
+ // Dispatch release events for all currently-pressed keys and mouse buttons
+ // to the InputStub.
+ void ReleaseAll();
+
+ // InputStub interface.
+ virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE;
+ virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE;
+
+ private:
+ protocol::InputStub* input_stub_;
+
+ std::set<int> pressed_keys_;
+
+ SkIPoint mouse_pos_;
+ uint32 mouse_button_state_;
+
+ DISALLOW_COPY_AND_ASSIGN(InputEventTracker);
+};
+
+} // namespace protocol
+} // namespace remoting
+
+#endif // REMOTING_PROTOCOL_INPUT_EVENT_TRACKER_H_
« no previous file with comments | « remoting/host/remote_input_filter_unittest.cc ('k') | remoting/protocol/input_event_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698