OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/chromoting_host.h" | 5 #include "remoting/host/chromoting_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 | 458 |
459 void ChromotingHost::AddAuthenticatedClient( | 459 void ChromotingHost::AddAuthenticatedClient( |
460 scoped_refptr<ConnectionToClient> connection, | 460 scoped_refptr<ConnectionToClient> connection, |
461 const protocol::SessionConfig& config, | 461 const protocol::SessionConfig& config, |
462 const std::string& jid) { | 462 const std::string& jid) { |
463 DCHECK_EQ(context_->main_message_loop(), MessageLoop::current()); | 463 DCHECK_EQ(context_->main_message_loop(), MessageLoop::current()); |
464 | 464 |
465 protocol::LocalLoginStatus* status = new protocol::LocalLoginStatus(); | 465 protocol::LocalLoginStatus* status = new protocol::LocalLoginStatus(); |
466 status->set_success(true); | 466 status->set_success(true); |
467 connection->client_stub()->BeginSessionResponse( | 467 connection->client_stub()->BeginSessionResponse( |
468 status, new DeleteTask<protocol::LocalLoginStatus>(status)); | 468 status, base::Bind(&DeletePointer<protocol::LocalLoginStatus>, status)); |
469 | 469 |
470 // Disconnect all other clients. | 470 // Disconnect all other clients. |
471 // Iterate over a copy of the list of clients, to avoid mutating the list | 471 // Iterate over a copy of the list of clients, to avoid mutating the list |
472 // while iterating over it. | 472 // while iterating over it. |
473 ClientList clients_copy(clients_); | 473 ClientList clients_copy(clients_); |
474 for (ClientList::const_iterator client = clients_copy.begin(); | 474 for (ClientList::const_iterator client = clients_copy.begin(); |
475 client != clients_copy.end(); client++) { | 475 client != clients_copy.end(); client++) { |
476 ConnectionToClient* connection_other = client->get()->connection(); | 476 ConnectionToClient* connection_other = client->get()->connection(); |
477 if (connection_other != connection) { | 477 if (connection_other != connection) { |
478 OnClientDisconnected(connection_other); | 478 OnClientDisconnected(connection_other); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 if (MessageLoop::current() != context_->main_message_loop()) { | 519 if (MessageLoop::current() != context_->main_message_loop()) { |
520 context_->main_message_loop()->PostTask( | 520 context_->main_message_loop()->PostTask( |
521 FROM_HERE, base::Bind(&ChromotingHost::LocalLoginFailed, this, | 521 FROM_HERE, base::Bind(&ChromotingHost::LocalLoginFailed, this, |
522 connection)); | 522 connection)); |
523 return; | 523 return; |
524 } | 524 } |
525 | 525 |
526 protocol::LocalLoginStatus* status = new protocol::LocalLoginStatus(); | 526 protocol::LocalLoginStatus* status = new protocol::LocalLoginStatus(); |
527 status->set_success(false); | 527 status->set_success(false); |
528 connection->client_stub()->BeginSessionResponse( | 528 connection->client_stub()->BeginSessionResponse( |
529 status, new DeleteTask<protocol::LocalLoginStatus>(status)); | 529 status, base::Bind(&DeletePointer<protocol::LocalLoginStatus>, status)); |
530 } | 530 } |
531 | 531 |
532 void ChromotingHost::ProcessPreAuthentication( | 532 void ChromotingHost::ProcessPreAuthentication( |
533 const scoped_refptr<ConnectionToClient>& connection) { | 533 const scoped_refptr<ConnectionToClient>& connection) { |
534 DCHECK_EQ(context_->main_message_loop(), MessageLoop::current()); | 534 DCHECK_EQ(context_->main_message_loop(), MessageLoop::current()); |
535 // Find the client session corresponding to the given connection. | 535 // Find the client session corresponding to the given connection. |
536 ClientList::iterator client; | 536 ClientList::iterator client; |
537 for (client = clients_.begin(); client != clients_.end(); ++client) { | 537 for (client = clients_.begin(); client != clients_.end(); ++client) { |
538 if (client->get()->connection() == connection) | 538 if (client->get()->connection() == connection) |
539 break; | 539 break; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 | 639 |
640 for (std::vector<Task*>::iterator it = shutdown_tasks_.begin(); | 640 for (std::vector<Task*>::iterator it = shutdown_tasks_.begin(); |
641 it != shutdown_tasks_.end(); ++it) { | 641 it != shutdown_tasks_.end(); ++it) { |
642 (*it)->Run(); | 642 (*it)->Run(); |
643 delete *it; | 643 delete *it; |
644 } | 644 } |
645 shutdown_tasks_.clear(); | 645 shutdown_tasks_.clear(); |
646 } | 646 } |
647 | 647 |
648 } // namespace remoting | 648 } // namespace remoting |
OLD | NEW |