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

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: - 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
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) {

Powered by Google App Engine
This is Rietveld 408576698