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

Unified Diff: remoting/host/chromoting_host.cc

Issue 6724033: Remove authenticated_ fields from stubs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix .gyp file for unit tests. Created 9 years, 9 months 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 | « no previous file | remoting/host/chromoting_host_unittest.cc » ('j') | remoting/host/chromoting_host_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/chromoting_host.cc
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index 6b5803ee872972772b43e30c8c3649ae7d2f5627..0a539f70f1836807cb565feb6f4503f2b5912504 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -4,6 +4,7 @@
#include "remoting/host/chromoting_host.h"
+#include "base/bind.h"
#include "base/stl_util-inl.h"
#include "base/task.h"
#include "build/build_config.h"
@@ -18,6 +19,7 @@
#include "remoting/host/host_config.h"
#include "remoting/host/host_key_pair.h"
#include "remoting/host/screen_recorder.h"
+#include "remoting/host/user_authenticator.h"
#include "remoting/proto/auth.pb.h"
#include "remoting/protocol/connection_to_client.h"
#include "remoting/protocol/client_stub.h"
@@ -177,13 +179,22 @@ void ChromotingHost::OnClientConnected(ConnectionToClient* connection) {
void ChromotingHost::OnClientDisconnected(ConnectionToClient* connection) {
DCHECK_EQ(context_->main_message_loop(), MessageLoop::current());
+ // Find the client session corresponding to the given connection.
+ std::vector<scoped_refptr<ClientSession> >::iterator client;
+ for (client = clients_.begin(); client != clients_.end(); ++client) {
+ if (client->get()->connection() == connection)
+ break;
+ }
+ if (client == clients_.end())
+ return;
+
// Remove the connection from the session manager and stop the session.
// TODO(hclam): Stop only if the last connection disconnected.
if (recorder_.get()) {
recorder_->RemoveConnection(connection);
// The recorder only exists to serve the unique authenticated client.
// If that client has disconnected, then we can kill the recorder.
- if (connection->client_authenticated()) {
+ if (client->get()->authenticated()) {
recorder_->Stop(NULL);
recorder_ = NULL;
}
@@ -193,13 +204,7 @@ void ChromotingHost::OnClientDisconnected(ConnectionToClient* connection) {
connection->Disconnect();
// Also remove reference to ConnectionToClient from this object.
- std::vector<scoped_refptr<ClientSession> >::iterator it;
- for (it = clients_.begin(); it != clients_.end(); ++it) {
- if (it->get()->connection() == connection) {
- clients_.erase(it);
- break;
- }
- }
+ clients_.erase(client);
}
////////////////////////////////////////////////////////////////////////////
@@ -316,13 +321,16 @@ void ChromotingHost::OnNewClientSession(
// We accept the connection, so create a connection object.
ConnectionToClient* connection = new ConnectionToClient(
- context_->network_message_loop(),
- this,
- desktop_environment_->input_stub());
+ context_->network_message_loop(), this);
// Create a client object.
- ClientSession* client = new ClientSession(this, connection);
+ ClientSession* client = new ClientSession(
+ this,
+ base::Bind(UserAuthenticator::Create),
+ connection,
+ desktop_environment_->input_stub());
connection->set_host_stub(client);
+ connection->set_input_stub(client);
connection->Init(session);
@@ -385,8 +393,6 @@ void ChromotingHost::LocalLoginSucceeded(
connection->client_stub()->BeginSessionResponse(
status, new DeleteTask<protocol::LocalLoginStatus>(status));
- connection->OnClientAuthenticated();
-
// Disconnect all other clients.
// Iterate over a copy of the list of clients, to avoid mutating the list
// while iterating over it.
« no previous file with comments | « no previous file | remoting/host/chromoting_host_unittest.cc » ('j') | remoting/host/chromoting_host_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698