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

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: Move mouse state tracking to InputEventTracker. 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
Index: remoting/host/client_session.h
diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h
index 31ac0793dcf81b0cabad117c7bb91d8a37800aa5..0fa31b2763d108ab6f2ed8af2b907a8f8e5eb46c 100644
--- a/remoting/host/client_session.h
+++ b/remoting/host/client_session.h
@@ -6,12 +6,13 @@
#define REMOTING_HOST_CLIENT_SESSION_H_
#include <list>
-#include <set>
#include "base/time.h"
#include "base/threading/non_thread_safe.h"
#include "remoting/protocol/connection_to_client.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"
@@ -93,14 +94,6 @@ class ClientSession : public protocol::HostStub,
return connection_.get();
}
- bool authenticated() const {
- return authenticated_;
- }
-
- 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,20 +101,15 @@ class ClientSession : public protocol::HostStub,
// 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();
+ // Returns whether input should be ignored because of local activity.
+ bool ShouldIgnoreInput() const;
EventHandler* event_handler_;
@@ -130,8 +118,11 @@ class ClientSession : public protocol::HostStub,
std::string client_jid_;
- // The input stub to which this object delegates.
- protocol::InputStub* input_stub_;
+ // Tracker used to release pressed keys and buttons when disconnecting.
+ protocol::InputEventTracker input_tracker_;
+
+ // Filter used to manage enabling & disabling of client input events.
+ protocol::InputFilter input_filter_;
// Capturer, used to determine current screen size for ensuring injected
// mouse events fall within the screen area.
@@ -139,20 +130,6 @@ class ClientSession : public protocol::HostStub,
// area, out of this class (crbug.com/96508).
Capturer* capturer_;
- // Whether this client is authenticated.
- bool authenticated_;
-
- // 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.
@@ -160,10 +137,6 @@ class ClientSession : public protocol::HostStub,
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);
};

Powered by Google App Engine
This is Rietveld 408576698