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

Unified Diff: remoting/host/client_session.cc

Issue 8476018: Move ConnectionToClient::EventHandler from ChromotingHost to ClientSession (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged Created 9 years, 1 month 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 6cf1c7f59d76134f83237c01b7c047703dc7a843..d59c3a61b75c54b3856b87f4d3061f019b413fe2 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,14 +39,16 @@ ClientSession::ClientSession(
authenticated_(false),
awaiting_continue_approval_(false),
remote_mouse_button_state_(0) {
-}
+ connection_->SetEventHandler(this);
-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_host_stub(this);
+ connection_->set_input_stub(this);
}
-void ClientSession::OnAuthenticationComplete() {
- authenticated_ = true;
- event_handler_->OnAuthenticationComplete(connection_.get());
+ClientSession::~ClientSession() {
}
void ClientSession::InjectKeyEvent(const KeyEvent& event) {
@@ -86,9 +89,40 @@ void ClientSession::InjectMouseEvent(const MouseEvent& event) {
}
}
-void ClientSession::OnDisconnected() {
- RestoreEventState();
+void ClientSession::OnConnectionOpened(
+ protocol::ConnectionToClient* connection) {
+ DCHECK_EQ(connection_.get(), connection);
+ 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);
+ // TODO(sergeyu): Log failure reason?
+ 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;
+ RestoreEventState();
}
void ClientSession::LocalMouseMoved(const SkIPoint& mouse_pos) {
« 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