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