| 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 recorder_ = new ScreenRecorder(context_->main_message_loop(), | 489 recorder_ = new ScreenRecorder(context_->main_message_loop(), |
| 490 context_->encode_message_loop(), | 490 context_->encode_message_loop(), |
| 491 context_->network_message_loop(), | 491 context_->network_message_loop(), |
| 492 desktop_environment_->capturer(), | 492 desktop_environment_->capturer(), |
| 493 encoder); | 493 encoder); |
| 494 } | 494 } |
| 495 | 495 |
| 496 // Immediately add the connection and start the session. | 496 // Immediately add the connection and start the session. |
| 497 recorder_->AddConnection(connection); | 497 recorder_->AddConnection(connection); |
| 498 recorder_->Start(); | 498 recorder_->Start(); |
| 499 // Notify observers that there is at least one authenticated client. |
| 500 for (StatusObserverList::iterator it = status_observers_.begin(); |
| 501 it != status_observers_.end(); ++it) { |
| 502 (*it)->OnClientAuthenticated(connection); |
| 503 } |
| 499 // TODO(jamiewalch): Tidy up actions to be taken on connect/disconnect, | 504 // TODO(jamiewalch): Tidy up actions to be taken on connect/disconnect, |
| 500 // including closing the connection on failure of a critical operation. | 505 // including closing the connection on failure of a critical operation. |
| 501 EnableCurtainMode(true); | 506 EnableCurtainMode(true); |
| 502 if (is_it2me_) { | 507 if (is_it2me_) { |
| 503 std::string username = connection->session()->jid(); | 508 std::string username = connection->session()->jid(); |
| 504 size_t pos = username.find('/'); | 509 size_t pos = username.find('/'); |
| 505 if (pos != std::string::npos) | 510 if (pos != std::string::npos) |
| 506 username.replace(pos, std::string::npos, ""); | 511 username.replace(pos, std::string::npos, ""); |
| 507 desktop_environment_->OnConnect(username); | 512 desktop_environment_->OnConnect(username); |
| 508 } | 513 } |
| 509 | |
| 510 // Notify observers that there is at least one authenticated client. | |
| 511 for (StatusObserverList::iterator it = status_observers_.begin(); | |
| 512 it != status_observers_.end(); ++it) { | |
| 513 (*it)->OnClientAuthenticated(connection); | |
| 514 } | |
| 515 } | 514 } |
| 516 | 515 |
| 517 void ChromotingHost::LocalLoginFailed( | 516 void ChromotingHost::LocalLoginFailed( |
| 518 scoped_refptr<ConnectionToClient> connection) { | 517 scoped_refptr<ConnectionToClient> connection) { |
| 519 if (MessageLoop::current() != context_->main_message_loop()) { | 518 if (MessageLoop::current() != context_->main_message_loop()) { |
| 520 context_->main_message_loop()->PostTask( | 519 context_->main_message_loop()->PostTask( |
| 521 FROM_HERE, base::Bind(&ChromotingHost::LocalLoginFailed, this, | 520 FROM_HERE, base::Bind(&ChromotingHost::LocalLoginFailed, this, |
| 522 connection)); | 521 connection)); |
| 523 return; | 522 return; |
| 524 } | 523 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 | 602 |
| 604 for (std::vector<Task*>::iterator it = shutdown_tasks_.begin(); | 603 for (std::vector<Task*>::iterator it = shutdown_tasks_.begin(); |
| 605 it != shutdown_tasks_.end(); ++it) { | 604 it != shutdown_tasks_.end(); ++it) { |
| 606 (*it)->Run(); | 605 (*it)->Run(); |
| 607 delete *it; | 606 delete *it; |
| 608 } | 607 } |
| 609 shutdown_tasks_.clear(); | 608 shutdown_tasks_.clear(); |
| 610 } | 609 } |
| 611 | 610 |
| 612 } // namespace remoting | 611 } // namespace remoting |
| OLD | NEW |