| 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/plugin/host_script_object.h" | 5 #include "remoting/host/plugin/host_script_object.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/message_loop_proxy.h" | 11 #include "base/message_loop_proxy.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/sys_string_conversions.h" | 13 #include "base/sys_string_conversions.h" |
| 14 #include "base/threading/platform_thread.h" | 14 #include "base/threading/platform_thread.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "net/base/net_util.h" | 17 #include "net/base/net_util.h" |
| 18 #include "remoting/base/auth_token_util.h" | 18 #include "remoting/base/auth_token_util.h" |
| 19 #include "remoting/base/auto_thread.h" | 19 #include "remoting/base/auto_thread.h" |
| 20 #include "remoting/host/basic_desktop_environment.h" |
| 20 #include "remoting/host/chromoting_host.h" | 21 #include "remoting/host/chromoting_host.h" |
| 21 #include "remoting/host/chromoting_host_context.h" | 22 #include "remoting/host/chromoting_host_context.h" |
| 22 #include "remoting/host/desktop_environment_factory.h" | |
| 23 #include "remoting/host/host_config.h" | 23 #include "remoting/host/host_config.h" |
| 24 #include "remoting/host/host_event_logger.h" | 24 #include "remoting/host/host_event_logger.h" |
| 25 #include "remoting/host/host_key_pair.h" | 25 #include "remoting/host/host_key_pair.h" |
| 26 #include "remoting/host/host_secret.h" | 26 #include "remoting/host/host_secret.h" |
| 27 #include "remoting/host/host_status_observer.h" | 27 #include "remoting/host/host_status_observer.h" |
| 28 #include "remoting/host/it2me_host_user_interface.h" | 28 #include "remoting/host/it2me_host_user_interface.h" |
| 29 #include "remoting/host/network_settings.h" | 29 #include "remoting/host/network_settings.h" |
| 30 #include "remoting/host/pin_hash.h" | 30 #include "remoting/host/pin_hash.h" |
| 31 #include "remoting/host/plugin/host_log_handler.h" | 31 #include "remoting/host/plugin/host_log_handler.h" |
| 32 #include "remoting/host/policy_hack/policy_watcher.h" | 32 #include "remoting/host/policy_hack/policy_watcher.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 const std::string& auth_service) { | 207 const std::string& auth_service) { |
| 208 if (!host_context_->ui_task_runner()->BelongsToCurrentThread()) { | 208 if (!host_context_->ui_task_runner()->BelongsToCurrentThread()) { |
| 209 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); | 209 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); |
| 210 host_context_->ui_task_runner()->PostTask( | 210 host_context_->ui_task_runner()->PostTask( |
| 211 FROM_HERE, | 211 FROM_HERE, |
| 212 base::Bind(&It2MeImpl::Connect, this, uid, auth_token, auth_service)); | 212 base::Bind(&It2MeImpl::Connect, this, uid, auth_token, auth_service)); |
| 213 return; | 213 return; |
| 214 } | 214 } |
| 215 | 215 |
| 216 // Create the desktop environment factory. | 216 // Create the desktop environment factory. |
| 217 desktop_environment_factory_.reset(new DesktopEnvironmentFactory( | 217 desktop_environment_factory_.reset(new BasicDesktopEnvironmentFactory()); |
| 218 host_context_->input_task_runner(), host_context_->ui_task_runner())); | |
| 219 | 218 |
| 220 // Start monitoring configured policies. | 219 // Start monitoring configured policies. |
| 221 policy_watcher_.reset( | 220 policy_watcher_.reset( |
| 222 policy_hack::PolicyWatcher::Create(host_context_->network_task_runner())); | 221 policy_hack::PolicyWatcher::Create(host_context_->network_task_runner())); |
| 223 policy_watcher_->StartWatching( | 222 policy_watcher_->StartWatching( |
| 224 base::Bind(&It2MeImpl::OnPolicyUpdate, this)); | 223 base::Bind(&It2MeImpl::OnPolicyUpdate, this)); |
| 225 | 224 |
| 226 // The UserInterface object needs to be created on the UI thread. | 225 // The UserInterface object needs to be created on the UI thread. |
| 227 it2me_host_user_interface_.reset( | 226 it2me_host_user_interface_.reset( |
| 228 new It2MeHostUserInterface(host_context_->network_task_runner(), | 227 new It2MeHostUserInterface(host_context_->network_task_runner(), |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 network_settings.max_port = NetworkSettings::kDefaultMaxPort; | 358 network_settings.max_port = NetworkSettings::kDefaultMaxPort; |
| 360 } | 359 } |
| 361 | 360 |
| 362 // Create the host. | 361 // Create the host. |
| 363 host_ = new ChromotingHost( | 362 host_ = new ChromotingHost( |
| 364 signal_strategy_.get(), | 363 signal_strategy_.get(), |
| 365 desktop_environment_factory_.get(), | 364 desktop_environment_factory_.get(), |
| 366 CreateHostSessionManager(network_settings, | 365 CreateHostSessionManager(network_settings, |
| 367 host_context_->url_request_context_getter()), | 366 host_context_->url_request_context_getter()), |
| 368 host_context_->audio_task_runner(), | 367 host_context_->audio_task_runner(), |
| 368 host_context_->input_task_runner(), |
| 369 host_context_->video_capture_task_runner(), | 369 host_context_->video_capture_task_runner(), |
| 370 host_context_->video_encode_task_runner(), | 370 host_context_->video_encode_task_runner(), |
| 371 host_context_->network_task_runner()); | 371 host_context_->network_task_runner(), |
| 372 host_context_->ui_task_runner()); |
| 372 host_->AddStatusObserver(this); | 373 host_->AddStatusObserver(this); |
| 373 log_to_server_.reset( | 374 log_to_server_.reset( |
| 374 new LogToServer(host_, ServerLogEntry::IT2ME, signal_strategy_.get())); | 375 new LogToServer(host_, ServerLogEntry::IT2ME, signal_strategy_.get())); |
| 375 | 376 |
| 376 // Disable audio by default. | 377 // Disable audio by default. |
| 377 // TODO(sergeyu): Add UI to enable it. | 378 // TODO(sergeyu): Add UI to enable it. |
| 378 scoped_ptr<protocol::CandidateSessionConfig> protocol_config = | 379 scoped_ptr<protocol::CandidateSessionConfig> protocol_config = |
| 379 protocol::CandidateSessionConfig::CreateDefault(); | 380 protocol::CandidateSessionConfig::CreateDefault(); |
| 380 protocol::CandidateSessionConfig::DisableAudioChannel(protocol_config.get()); | 381 protocol::CandidateSessionConfig::DisableAudioChannel(protocol_config.get()); |
| 381 host_->set_protocol_config(protocol_config.Pass()); | 382 host_->set_protocol_config(protocol_config.Pass()); |
| (...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1482 } | 1483 } |
| 1483 | 1484 |
| 1484 void HostNPScriptObject::SetException(const std::string& exception_string) { | 1485 void HostNPScriptObject::SetException(const std::string& exception_string) { |
| 1485 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); | 1486 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); |
| 1486 | 1487 |
| 1487 g_npnetscape_funcs->setexception(parent_, exception_string.c_str()); | 1488 g_npnetscape_funcs->setexception(parent_, exception_string.c_str()); |
| 1488 LOG(INFO) << exception_string; | 1489 LOG(INFO) << exception_string; |
| 1489 } | 1490 } |
| 1490 | 1491 |
| 1491 } // namespace remoting | 1492 } // namespace remoting |
| OLD | NEW |