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

Unified Diff: remoting/host/client_session.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/chromoting_host.cc ('k') | remoting/host/client_session.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/client_session.h
diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h
index 2ef11ec790999d72c705e60700928b83713ef698..41068fa6bcb2e740585b77631de7b34ec812b19b 100644
--- a/remoting/host/client_session.h
+++ b/remoting/host/client_session.h
@@ -6,14 +6,17 @@
#define REMOTING_HOST_CLIENT_SESSION_H_
#include <list>
-#include <set>
#include "base/time.h"
#include "base/threading/non_thread_safe.h"
+#include "remoting/host/remote_input_filter.h"
#include "remoting/protocol/clipboard_stub.h"
#include "remoting/protocol/connection_to_client.h"
#include "remoting/protocol/host_event_stub.h"
#include "remoting/protocol/host_stub.h"
+#include "remoting/protocol/input_event_tracker.h"
+#include "remoting/protocol/input_filter.h"
+#include "remoting/protocol/input_stub.h"
#include "third_party/skia/include/core/SkPoint.h"
namespace remoting {
@@ -97,10 +100,6 @@ class ClientSession : public protocol::HostEventStub,
return connection_.get();
}
- void set_awaiting_continue_approval(bool awaiting) {
- awaiting_continue_approval_ = awaiting;
- }
-
const std::string& client_jid() { return client_jid_; }
// Indicate that local mouse activity has been detected. This causes remote
@@ -108,21 +107,11 @@ class ClientSession : public protocol::HostEventStub,
// have the upper hand in 'pointer wars'.
void LocalMouseMoved(const SkIPoint& new_pos);
- bool ShouldIgnoreRemoteMouseInput(const protocol::MouseEvent& event) const;
- bool ShouldIgnoreRemoteKeyboardInput(const protocol::KeyEvent& event) const;
+ // Disable handling of input events from this client. If the client has any
+ // keys or mouse buttons pressed then these will be released.
+ void SetDisableInputs(bool disable_inputs);
private:
- friend class ClientSessionTest_RestoreEventState_Test;
-
- // Keep track of input state so that we can clean up the event queue when
- // the user disconnects.
- void RecordKeyEvent(const protocol::KeyEvent& event);
- void RecordMouseButtonState(const protocol::MouseEvent& event);
-
- // Synthesize KeyUp and MouseUp events so that we can undo these events
- // when the user disconnects.
- void RestoreEventState();
-
EventHandler* event_handler_;
// The connection to the client.
@@ -133,41 +122,24 @@ class ClientSession : public protocol::HostEventStub,
// The host event stub to which this object delegates.
protocol::HostEventStub* host_event_stub_;
+ // Tracker used to release pressed keys and buttons when disconnecting.
+ protocol::InputEventTracker input_tracker_;
+
+ // Filter used to disable remote inputs during local input activity.
+ RemoteInputFilter remote_input_filter_;
+
+ // Filter used to manage enabling & disabling of client input events.
+ protocol::InputFilter disable_input_filter_;
+
+ // Filter used to disable inputs when we're not authenticated.
+ protocol::InputFilter auth_input_filter_;
+
// Capturer, used to determine current screen size for ensuring injected
// mouse events fall within the screen area.
// TODO(lambroslambrou): Move floor-control logic, and clamping to screen
// area, out of this class (crbug.com/96508).
Capturer* capturer_;
- // Whether this client is authenticated.
- bool authenticated_;
-
- // Whether this client is fully connected (i.e. all channels are
- // connected).
- bool connected_;
-
- // Whether or not inputs from this client are blocked pending approval from
- // the host user to continue the connection.
- bool awaiting_continue_approval_;
-
- // State to control remote input blocking while the local pointer is in use.
- uint32 remote_mouse_button_state_;
-
- // Current location of the mouse pointer. This is used to provide appropriate
- // coordinates when we release the mouse buttons after a user disconnects.
- SkIPoint remote_mouse_pos_;
-
- // Queue of recently-injected mouse positions. This is used to detect whether
- // mouse events from the local input monitor are echoes of injected positions,
- // or genuine mouse movements of a local input device.
- std::list<SkIPoint> injected_mouse_positions_;
-
- base::Time latest_local_input_time_;
-
- // Set of keys that are currently pressed down by the user. This is used so
- // we can release them if the user disconnects.
- std::set<int> pressed_keys_;
-
DISALLOW_COPY_AND_ASSIGN(ClientSession);
};
« no previous file with comments | « remoting/host/chromoting_host.cc ('k') | remoting/host/client_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698