Index: remoting/host/client_session.cc |
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc |
index 6cf1c7f59d76134f83237c01b7c047703dc7a843..b7df430f1db1bec8cf640fbe15076eb86c83f440 100644 |
--- a/remoting/host/client_session.cc |
+++ b/remoting/host/client_session.cc |
@@ -6,6 +6,7 @@ |
#include <algorithm> |
+#include "base/message_loop_proxy.h" |
#include "base/task.h" |
#include "remoting/host/capturer.h" |
#include "remoting/proto/event.pb.h" |
@@ -38,16 +39,14 @@ ClientSession::ClientSession( |
authenticated_(false), |
awaiting_continue_approval_(false), |
remote_mouse_button_state_(0) { |
+ connection_->SetEventHandler(this); |
+ connection_->set_host_stub(this); |
+ connection_->set_input_stub(this); |
} |
ClientSession::~ClientSession() { |
} |
-void ClientSession::OnAuthenticationComplete() { |
- authenticated_ = true; |
- event_handler_->OnAuthenticationComplete(connection_.get()); |
-} |
- |
void ClientSession::InjectKeyEvent(const KeyEvent& event) { |
if (authenticated_ && !ShouldIgnoreRemoteKeyboardInput(event)) { |
RecordKeyEvent(event); |
@@ -86,9 +85,40 @@ void ClientSession::InjectMouseEvent(const MouseEvent& event) { |
} |
} |
-void ClientSession::OnDisconnected() { |
- RestoreEventState(); |
+void ClientSession::OnConnectionOpened( |
+ protocol::ConnectionToClient* connection) { |
+ DCHECK_EQ(connection_.get(), connection); |
+ // TODO(sergeyu): Acutally authenticate the session. |
Wez
2011/11/09 01:35:07
typo: Acutally.
Clarify what level of authenticati
Sergey Ulanov
2011/11/09 19:26:13
Removed this TODO for now. The intention is that C
|
+ authenticated_ = true; |
+ event_handler_->OnSessionAuthenticated(this); |
+} |
+ |
+void ClientSession::OnConnectionClosed( |
+ protocol::ConnectionToClient* connection) { |
+ DCHECK_EQ(connection_.get(), connection); |
+ scoped_refptr<ClientSession> self = this; |
+ event_handler_->OnSessionClosed(this); |
+ Disconnect(); |
Wez
2011/11/09 01:35:07
Could OnSessionClosed() be dispatched from Disconn
Sergey Ulanov
2011/11/09 19:26:13
No. In any case I removed this line in one of the
|
+} |
+ |
+void ClientSession::OnConnectionFailed( |
+ protocol::ConnectionToClient* connection) { |
Wez
2011/11/09 01:35:07
Fetch and log some reason for the "failure"?
Sergey Ulanov
2011/11/09 19:26:13
Added TODO for this.
|
+ DCHECK_EQ(connection_.get(), connection); |
+ scoped_refptr<ClientSession> self = this; |
+ event_handler_->OnSessionClosed(this); |
+ Disconnect(); |
+} |
+ |
+void ClientSession::OnSequenceNumberUpdated( |
+ protocol::ConnectionToClient* connection, int64 sequence_number) { |
+ DCHECK_EQ(connection_.get(), connection); |
+ event_handler_->OnSessionSequenceNumber(this, sequence_number); |
+} |
+ |
+void ClientSession::Disconnect() { |
+ connection_->Disconnect(); |
authenticated_ = false; |
Wez
2011/11/09 01:35:07
Rather than keeping a separate |authenticated_| fl
Sergey Ulanov
2011/11/09 19:26:13
I agree it would be better, but currently Connecti
|
+ RestoreEventState(); |
} |
void ClientSession::LocalMouseMoved(const SkIPoint& mouse_pos) { |