Chromium Code Reviews| Index: remoting/host/client_session.cc |
| diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc |
| index 6cf1c7f59d76134f83237c01b7c047703dc7a843..a88d48bcfc856b2cca4c6689f841f232b51e2201 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
The session has already been authe
|
| + 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(); |
| +} |
| + |
| +void ClientSession::OnConnectionFailed( |
| + protocol::ConnectionToClient* connection) { |
| + DCHECK_EQ(connection_.get(), connection); |
| + scoped_refptr<ClientSession> self = this; |
| + event_handler_->OnSessionFailed(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; |
| + RestoreEventState(); |
| } |
| void ClientSession::LocalMouseMoved(const SkIPoint& mouse_pos) { |