OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/it2me/it2me_host.h" | 5 #include "remoting/host/it2me/it2me_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
11 #include "net/socket/client_socket_factory.h" | 11 #include "net/socket/client_socket_factory.h" |
12 #include "remoting/base/auto_thread.h" | 12 #include "remoting/base/auto_thread.h" |
13 #include "remoting/base/logging.h" | 13 #include "remoting/base/logging.h" |
14 #include "remoting/base/rsa_key_pair.h" | 14 #include "remoting/base/rsa_key_pair.h" |
15 #include "remoting/host/chromoting_host.h" | 15 #include "remoting/host/chromoting_host.h" |
16 #include "remoting/host/chromoting_host_context.h" | 16 #include "remoting/host/chromoting_host_context.h" |
17 #include "remoting/host/host_event_logger.h" | 17 #include "remoting/host/host_event_logger.h" |
18 #include "remoting/host/host_secret.h" | 18 #include "remoting/host/host_secret.h" |
| 19 #include "remoting/host/host_status_logger.h" |
19 #include "remoting/host/it2me_desktop_environment.h" | 20 #include "remoting/host/it2me_desktop_environment.h" |
20 #include "remoting/host/policy_hack/policy_watcher.h" | 21 #include "remoting/host/policy_hack/policy_watcher.h" |
21 #include "remoting/host/register_support_host_request.h" | 22 #include "remoting/host/register_support_host_request.h" |
22 #include "remoting/host/session_manager_factory.h" | 23 #include "remoting/host/session_manager_factory.h" |
23 #include "remoting/jingle_glue/network_settings.h" | 24 #include "remoting/jingle_glue/network_settings.h" |
24 #include "remoting/jingle_glue/server_log_entry.h" | 25 #include "remoting/jingle_glue/server_log_entry.h" |
25 #include "remoting/protocol/it2me_host_authenticator_factory.h" | 26 #include "remoting/protocol/it2me_host_authenticator_factory.h" |
26 | 27 |
27 namespace remoting { | 28 namespace remoting { |
28 | 29 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 desktop_environment_factory_.get(), | 199 desktop_environment_factory_.get(), |
199 CreateHostSessionManager(signal_strategy_.get(), network_settings, | 200 CreateHostSessionManager(signal_strategy_.get(), network_settings, |
200 host_context_->url_request_context_getter()), | 201 host_context_->url_request_context_getter()), |
201 host_context_->audio_task_runner(), | 202 host_context_->audio_task_runner(), |
202 host_context_->input_task_runner(), | 203 host_context_->input_task_runner(), |
203 host_context_->video_capture_task_runner(), | 204 host_context_->video_capture_task_runner(), |
204 host_context_->video_encode_task_runner(), | 205 host_context_->video_encode_task_runner(), |
205 host_context_->network_task_runner(), | 206 host_context_->network_task_runner(), |
206 host_context_->ui_task_runner())); | 207 host_context_->ui_task_runner())); |
207 host_->AddStatusObserver(this); | 208 host_->AddStatusObserver(this); |
208 log_to_server_.reset( | 209 host_status_logger_.reset( |
209 new LogToServer(host_->AsWeakPtr(), ServerLogEntry::IT2ME, | 210 new HostStatusLogger(host_->AsWeakPtr(), ServerLogEntry::IT2ME, |
210 signal_strategy_.get(), directory_bot_jid_)); | 211 signal_strategy_.get(), directory_bot_jid_)); |
211 | 212 |
212 // Disable audio by default. | 213 // Disable audio by default. |
213 // TODO(sergeyu): Add UI to enable it. | 214 // TODO(sergeyu): Add UI to enable it. |
214 scoped_ptr<protocol::CandidateSessionConfig> protocol_config = | 215 scoped_ptr<protocol::CandidateSessionConfig> protocol_config = |
215 protocol::CandidateSessionConfig::CreateDefault(); | 216 protocol::CandidateSessionConfig::CreateDefault(); |
216 protocol_config->DisableAudioChannel(); | 217 protocol_config->DisableAudioChannel(); |
217 | 218 |
218 host_->set_protocol_config(protocol_config.Pass()); | 219 host_->set_protocol_config(protocol_config.Pass()); |
219 | 220 |
220 // Create event logger. | 221 // Create event logger. |
(...skipping 11 matching lines...) Expand all Loading... |
232 void It2MeHost::ShutdownOnNetworkThread() { | 233 void It2MeHost::ShutdownOnNetworkThread() { |
233 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); | 234 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); |
234 DCHECK(state_ == kDisconnecting || state_ == kDisconnected); | 235 DCHECK(state_ == kDisconnecting || state_ == kDisconnected); |
235 | 236 |
236 if (state_ == kDisconnecting) { | 237 if (state_ == kDisconnecting) { |
237 host_event_logger_.reset(); | 238 host_event_logger_.reset(); |
238 host_->RemoveStatusObserver(this); | 239 host_->RemoveStatusObserver(this); |
239 host_.reset(); | 240 host_.reset(); |
240 | 241 |
241 register_request_.reset(); | 242 register_request_.reset(); |
242 log_to_server_.reset(); | 243 host_status_logger_.reset(); |
243 signal_strategy_.reset(); | 244 signal_strategy_.reset(); |
244 SetState(kDisconnected); | 245 SetState(kDisconnected); |
245 } | 246 } |
246 | 247 |
247 host_context_->ui_task_runner()->PostTask( | 248 host_context_->ui_task_runner()->PostTask( |
248 FROM_HERE, base::Bind(&It2MeHost::ShutdownOnUiThread, this)); | 249 FROM_HERE, base::Bind(&It2MeHost::ShutdownOnUiThread, this)); |
249 } | 250 } |
250 | 251 |
251 void It2MeHost::ShutdownOnUiThread() { | 252 void It2MeHost::ShutdownOnUiThread() { |
252 DCHECK(host_context_->ui_task_runner()->BelongsToCurrentThread()); | 253 DCHECK(host_context_->ui_task_runner()->BelongsToCurrentThread()); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 ChromotingHostContext* context, | 467 ChromotingHostContext* context, |
467 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 468 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
468 base::WeakPtr<It2MeHost::Observer> observer, | 469 base::WeakPtr<It2MeHost::Observer> observer, |
469 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, | 470 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, |
470 const std::string& directory_bot_jid) { | 471 const std::string& directory_bot_jid) { |
471 return new It2MeHost( | 472 return new It2MeHost( |
472 context, task_runner, observer, xmpp_server_config, directory_bot_jid); | 473 context, task_runner, observer, xmpp_server_config, directory_bot_jid); |
473 } | 474 } |
474 | 475 |
475 } // namespace remoting | 476 } // namespace remoting |
OLD | NEW |