OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 protocol_config_->mutable_audio_configs()->clear(); | 89 protocol_config_->mutable_audio_configs()->clear(); |
90 protocol_config_->mutable_audio_configs()->push_back( | 90 protocol_config_->mutable_audio_configs()->push_back( |
91 protocol::ChannelConfig()); | 91 protocol::ChannelConfig()); |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 ChromotingHost::~ChromotingHost() { | 95 ChromotingHost::~ChromotingHost() { |
96 DCHECK(clients_.empty()); | 96 DCHECK(clients_.empty()); |
97 } | 97 } |
98 | 98 |
99 void ChromotingHost::Start() { | 99 void ChromotingHost::Start(const std::string& xmpp_login) { |
100 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); | 100 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); |
101 | 101 |
102 LOG(INFO) << "Starting host"; | 102 LOG(INFO) << "Starting host"; |
103 | 103 |
104 // Make sure this object is not started. | 104 // Make sure this object is not started. |
105 if (state_ != kInitial) | 105 if (state_ != kInitial) |
106 return; | 106 return; |
107 state_ = kStarted; | 107 state_ = kStarted; |
108 | 108 |
| 109 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, |
| 110 OnStart(xmpp_login)); |
| 111 |
109 // Start the SessionManager, supplying this ChromotingHost as the listener. | 112 // Start the SessionManager, supplying this ChromotingHost as the listener. |
110 session_manager_->Init(signal_strategy_, this); | 113 session_manager_->Init(signal_strategy_, this); |
111 } | 114 } |
112 | 115 |
113 // This method is called when we need to destroy the host process. | 116 // This method is called when we need to destroy the host process. |
114 void ChromotingHost::Shutdown(const base::Closure& shutdown_task) { | 117 void ChromotingHost::Shutdown(const base::Closure& shutdown_task) { |
115 if (!context_->network_task_runner()->BelongsToCurrentThread()) { | 118 if (!context_->network_task_runner()->BelongsToCurrentThread()) { |
116 context_->network_task_runner()->PostTask( | 119 context_->network_task_runner()->PostTask( |
117 FROM_HERE, base::Bind(&ChromotingHost::Shutdown, this, shutdown_task)); | 120 FROM_HERE, base::Bind(&ChromotingHost::Shutdown, this, shutdown_task)); |
118 return; | 121 return; |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 OnShutdown()); | 504 OnShutdown()); |
502 | 505 |
503 for (std::vector<base::Closure>::iterator it = shutdown_tasks_.begin(); | 506 for (std::vector<base::Closure>::iterator it = shutdown_tasks_.begin(); |
504 it != shutdown_tasks_.end(); ++it) { | 507 it != shutdown_tasks_.end(); ++it) { |
505 it->Run(); | 508 it->Run(); |
506 } | 509 } |
507 shutdown_tasks_.clear(); | 510 shutdown_tasks_.clear(); |
508 } | 511 } |
509 | 512 |
510 } // namespace remoting | 513 } // namespace remoting |
OLD | NEW |