Index: remoting/host/client_session.cc |
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc |
index 52feba70462efae8bc4d28cce9f9f09cd605d073..6dc1feec8f2dda0b4221473fe85e7433a81991a4 100644 |
--- a/remoting/host/client_session.cc |
+++ b/remoting/host/client_session.cc |
@@ -18,6 +18,7 @@ |
#include "remoting/host/audio_capturer.h" |
#include "remoting/host/audio_scheduler.h" |
#include "remoting/host/desktop_environment.h" |
+#include "remoting/host/gnubby_connection_factory.h" |
#include "remoting/host/input_injector.h" |
#include "remoting/host/screen_controls.h" |
#include "remoting/host/screen_resolution.h" |
@@ -45,7 +46,8 @@ ClientSession::ClientSession( |
scoped_ptr<protocol::ConnectionToClient> connection, |
DesktopEnvironmentFactory* desktop_environment_factory, |
const base::TimeDelta& max_duration, |
- scoped_refptr<protocol::PairingRegistry> pairing_registry) |
+ scoped_refptr<protocol::PairingRegistry> pairing_registry, |
+ bool enable_gnubby_auth) |
: event_handler_(event_handler), |
connection_(connection.Pass()), |
client_jid_(connection_->session()->jid()), |
@@ -66,7 +68,8 @@ ClientSession::ClientSession( |
video_encode_task_runner_(video_encode_task_runner), |
network_task_runner_(network_task_runner), |
ui_task_runner_(ui_task_runner), |
- pairing_registry_(pairing_registry) { |
+ pairing_registry_(pairing_registry), |
+ enable_gnubby_auth_(enable_gnubby_auth) { |
connection_->SetEventHandler(this); |
// TODO(sergeyu): Currently ConnectionToClient expects stubs to be |
@@ -197,9 +200,15 @@ void ClientSession::DeliverClientMessage( |
reply.set_data(message.data().substr(0, 16)); |
connection_->client_stub()->DeliverHostMessage(reply); |
return; |
+ } else if (message.type() == "gnubby-auth") { |
Sergey Ulanov
2014/01/25 02:03:33
we added ExtensionMessage as a hack that allows to
psj
2014/01/29 09:07:15
Wez said that I should use the extension message.
|
+ if (gnubby_auth_handler_) { |
+ gnubby_auth_handler_->DeliverClientMessage(message.data()); |
+ } else { |
+ HOST_LOG << "gnubby auth is not enabled"; |
+ } |
+ return; |
} |
} |
- // No messages are currently supported. |
HOST_LOG << "Unexpected message received: " |
<< message.type() << ": " << message.data(); |
} |
@@ -288,6 +297,14 @@ void ClientSession::OnConnectionAuthenticated( |
audio_encoder.Pass(), |
connection_->audio_stub()); |
} |
+ |
+ if (enable_gnubby_auth_) { |
+ // Create a GnubbyAuthHandler to proxy gnubbyd messages. |
+ gnubby_auth_handler_.reset( |
+ new GnubbyAuthHandler(network_task_runner_, |
+ GnubbyConnectionFactory::GetDefaultFactory(), |
+ connection_->client_stub())); |
+ } |
} |
void ClientSession::OnConnectionChannelsConnected( |
@@ -412,6 +429,11 @@ void ClientSession::SetDisableInputs(bool disable_inputs) { |
disable_clipboard_filter_.set_enabled(!disable_inputs); |
} |
+void ClientSession::SetGnubbyAuthHandlerForTesting( |
+ GnubbyAuthHandler* gnubby_auth_handler) { |
+ gnubby_auth_handler_.reset(gnubby_auth_handler); |
+} |
+ |
scoped_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() { |
DCHECK(CalledOnValidThread()); |