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

Unified Diff: remoting/host/remote_input_filter.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/client_session_unittest.cc ('k') | remoting/host/remote_input_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/remote_input_filter.h
diff --git a/remoting/host/remote_input_filter.h b/remoting/host/remote_input_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..2446098065564b48d4f2fe98aec5622c8f58715f
--- /dev/null
+++ b/remoting/host/remote_input_filter.h
@@ -0,0 +1,54 @@
+// 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_HOST_REMOTE_INPUT_FILTER_H_
+#define REMOTING_HOST_REMOTE_INPUT_FILTER_H_
+
+#include <list>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/time.h"
+#include "remoting/protocol/input_event_tracker.h"
+#include "remoting/protocol/input_stub.h"
+#include "third_party/skia/include/core/SkPoint.h"
+
+namespace remoting {
+
+// Filtering InputStub that filters remotely-injected input if it has been
+// notified of local input recently.
+class RemoteInputFilter : public protocol::InputStub {
+ public:
+ // Creates a filter forwarding events to the specified InputEventTracker.
+ // The filter needs a tracker to release buttons & keys when blocking input.
+ explicit RemoteInputFilter(protocol::InputEventTracker* event_tracker);
+ virtual ~RemoteInputFilter();
+
+ // Informs the filter that local mouse activity has been detected. If the
+ // activity does not match events we injected then we assume that it is local,
+ // and block remote input for a short while.
+ void LocalMouseMoved(const SkIPoint& mouse_pos);
+
+ // InputStub overrides.
+ virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE;
+ virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE;
+
+ private:
+ bool ShouldIgnoreInput() const;
+
+ protocol::InputEventTracker* event_tracker_;
+
+ // Queue of recently-injected mouse positions used to distinguish echoes of
+ // injected events from movements from a local input device.
+ std::list<SkIPoint> injected_mouse_positions_;
+
+ // Time at which local input events were most recently observed.
+ base::TimeTicks latest_local_input_time_;
+
+ DISALLOW_COPY_AND_ASSIGN(RemoteInputFilter);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_HOST_REMOTE_INPUT_FILTER_H_
« no previous file with comments | « remoting/host/client_session_unittest.cc ('k') | remoting/host/remote_input_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698