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

Unified Diff: remoting/host/client_session.cc

Issue 10831223: Use ClipboardFilter in ClientSession auth & disable-input blocking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improve comment. Created 8 years, 4 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.h ('k') | remoting/host/client_session_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/client_session.cc
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc
index 6e7e3d74b4b91e2beae37410d44f4d8b46463c2e..540277ecc6d041fa2262597be002c0ee79d5833c 100644
--- a/remoting/host/client_session.cc
+++ b/remoting/host/client_session.cc
@@ -39,7 +39,7 @@ ClientSession::ClientSession(
// TODO(sergeyu): Currently ConnectionToClient expects stubs to be
// set before channels are connected. Make it possible to set stubs
// later and set them only when connection is authenticated.
- connection_->set_clipboard_stub(this);
+ connection_->set_clipboard_stub(&auth_clipboard_filter_);
connection_->set_host_stub(this);
connection_->set_input_stub(this);
clipboard_echo_filter_.set_host_stub(host_clipboard_stub_);
@@ -48,20 +48,6 @@ ClientSession::ClientSession(
ClientSession::~ClientSession() {
}
-void ClientSession::InjectClipboardEvent(
- const protocol::ClipboardEvent& event) {
- DCHECK(CalledOnValidThread());
-
- // TODO(wez): Disable clipboard in both directions on local activity, and
- // replace these tests with a HostInputFilter (or ClipboardFilter).
- if (auth_input_filter_.input_stub() == NULL)
- return;
- if (disable_input_filter_.input_stub() == NULL)
- return;
-
- clipboard_echo_filter_.host_filter()->InjectClipboardEvent(event);
-}
-
void ClientSession::InjectKeyEvent(const protocol::KeyEvent& event) {
DCHECK(CalledOnValidThread());
auth_input_filter_.InjectKeyEvent(event);
@@ -99,15 +85,20 @@ void ClientSession::OnConnectionAuthenticated(
protocol::ConnectionToClient* connection) {
DCHECK(CalledOnValidThread());
DCHECK_EQ(connection_.get(), connection);
+
is_authenticated_ = true;
auth_input_filter_.set_input_stub(&disable_input_filter_);
+ auth_clipboard_filter_.set_clipboard_stub(&disable_clipboard_filter_);
+
clipboard_echo_filter_.set_client_stub(connection_->client_stub());
+
if (max_duration_ > base::TimeDelta()) {
// TODO(simonmorris): Let Disconnect() tell the client that the
// disconnection was caused by the session exceeding its maximum duration.
max_duration_timer_.Start(FROM_HERE, max_duration_,
this, &ClientSession::Disconnect);
}
+
event_handler_->OnSessionAuthenticated(this);
}
@@ -127,6 +118,7 @@ void ClientSession::OnConnectionClosed(
if (!is_authenticated_)
event_handler_->OnSessionAuthenticationFailed(this);
auth_input_filter_.set_input_stub(NULL);
+ auth_clipboard_filter_.set_clipboard_stub(NULL);
// Ensure that any pressed keys or buttons are released.
input_tracker_.ReleaseAll();
@@ -171,9 +163,12 @@ void ClientSession::SetDisableInputs(bool disable_inputs) {
if (disable_inputs) {
disable_input_filter_.set_input_stub(NULL);
+ disable_clipboard_filter_.set_clipboard_stub(NULL);
input_tracker_.ReleaseAll();
} else {
disable_input_filter_.set_input_stub(&mouse_input_filter_);
+ disable_clipboard_filter_.set_clipboard_stub(
+ clipboard_echo_filter_.host_filter());
}
}
« no previous file with comments | « remoting/host/client_session.h ('k') | remoting/host/client_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698