| 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 "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 | 395 |
| 396 // Also remove reference to ConnectionToClient from this object. | 396 // Also remove reference to ConnectionToClient from this object. |
| 397 int old_authenticated_clients = AuthenticatedClientsCount(); | 397 int old_authenticated_clients = AuthenticatedClientsCount(); |
| 398 clients_.erase(client); | 398 clients_.erase(client); |
| 399 | 399 |
| 400 // Notify the observers of the change, if any. | 400 // Notify the observers of the change, if any. |
| 401 int authenticated_clients = AuthenticatedClientsCount(); | 401 int authenticated_clients = AuthenticatedClientsCount(); |
| 402 if (old_authenticated_clients != authenticated_clients) { | 402 if (old_authenticated_clients != authenticated_clients) { |
| 403 for (StatusObserverList::iterator it = status_observers_.begin(); | 403 for (StatusObserverList::iterator it = status_observers_.begin(); |
| 404 it != status_observers_.end(); ++it) { | 404 it != status_observers_.end(); ++it) { |
| 405 (*it)->OnAuthenticatedClientsChanged(authenticated_clients); | 405 (*it)->OnClientDisconnected(connection); |
| 406 } | 406 } |
| 407 } | 407 } |
| 408 | 408 |
| 409 // Disable the "curtain" if there are no more active clients. | 409 // Disable the "curtain" if there are no more active clients. |
| 410 if (AuthenticatedClientsCount() == 0) { | 410 if (AuthenticatedClientsCount() == 0) { |
| 411 EnableCurtainMode(false); | 411 EnableCurtainMode(false); |
| 412 if (is_it2me_) { | 412 if (is_it2me_) { |
| 413 desktop_environment_->OnLastDisconnect(); | 413 desktop_environment_->OnLastDisconnect(); |
| 414 } | 414 } |
| 415 } | 415 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 std::string username = connection->session()->jid(); | 511 std::string username = connection->session()->jid(); |
| 512 size_t pos = username.find('/'); | 512 size_t pos = username.find('/'); |
| 513 if (pos != std::string::npos) | 513 if (pos != std::string::npos) |
| 514 username.replace(pos, std::string::npos, ""); | 514 username.replace(pos, std::string::npos, ""); |
| 515 desktop_environment_->OnConnect(username); | 515 desktop_environment_->OnConnect(username); |
| 516 } | 516 } |
| 517 | 517 |
| 518 // Notify observers that there is at least one authenticated client. | 518 // Notify observers that there is at least one authenticated client. |
| 519 for (StatusObserverList::iterator it = status_observers_.begin(); | 519 for (StatusObserverList::iterator it = status_observers_.begin(); |
| 520 it != status_observers_.end(); ++it) { | 520 it != status_observers_.end(); ++it) { |
| 521 (*it)->OnAuthenticatedClientsChanged(AuthenticatedClientsCount()); | 521 (*it)->OnClientAuthenticated(connection); |
| 522 } | 522 } |
| 523 } | 523 } |
| 524 | 524 |
| 525 void ChromotingHost::LocalLoginFailed( | 525 void ChromotingHost::LocalLoginFailed( |
| 526 scoped_refptr<ConnectionToClient> connection) { | 526 scoped_refptr<ConnectionToClient> connection) { |
| 527 if (MessageLoop::current() != context_->main_message_loop()) { | 527 if (MessageLoop::current() != context_->main_message_loop()) { |
| 528 context_->main_message_loop()->PostTask( | 528 context_->main_message_loop()->PostTask( |
| 529 FROM_HERE, base::Bind(&ChromotingHost::LocalLoginFailed, this, | 529 FROM_HERE, base::Bind(&ChromotingHost::LocalLoginFailed, this, |
| 530 connection)); | 530 connection)); |
| 531 return; | 531 return; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 | 611 |
| 612 for (std::vector<Task*>::iterator it = shutdown_tasks_.begin(); | 612 for (std::vector<Task*>::iterator it = shutdown_tasks_.begin(); |
| 613 it != shutdown_tasks_.end(); ++it) { | 613 it != shutdown_tasks_.end(); ++it) { |
| 614 (*it)->Run(); | 614 (*it)->Run(); |
| 615 delete *it; | 615 delete *it; |
| 616 } | 616 } |
| 617 shutdown_tasks_.clear(); | 617 shutdown_tasks_.clear(); |
| 618 } | 618 } |
| 619 | 619 |
| 620 } // namespace remoting | 620 } // namespace remoting |
| OLD | NEW |