Chromium Code Reviews| 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 // This file implements a standalone host process for Me2Me. | 5 // This file implements a standalone host process for Me2Me. |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 config_(FilePath()), | 121 config_(FilePath()), |
| 122 #ifdef OFFICIAL_BUILD | 122 #ifdef OFFICIAL_BUILD |
| 123 oauth_use_official_client_id_(true), | 123 oauth_use_official_client_id_(true), |
| 124 #else | 124 #else |
| 125 oauth_use_official_client_id_(false), | 125 oauth_use_official_client_id_(false), |
| 126 #endif | 126 #endif |
| 127 allow_nat_traversal_(true), | 127 allow_nat_traversal_(true), |
| 128 restarting_(false), | 128 restarting_(false), |
| 129 shutting_down_(false), | 129 shutting_down_(false), |
| 130 #if defined(OS_WIN) | 130 #if defined(OS_WIN) |
| 131 desktop_environment_factory_(new SessionDesktopEnvironmentFactory()), | 131 desktop_environment_factory_(new SessionDesktopEnvironmentFactory()), |
|
alexeypa (please no reviews)
2012/10/02 17:00:13
SessiondesktopEnviromentFactory's constructor take
| |
| 132 #else // !defined(OS_WIN) | 132 #else // !defined(OS_WIN) |
| 133 desktop_environment_factory_(new DesktopEnvironmentFactory()), | 133 desktop_environment_factory_(new DesktopEnvironmentFactory( |
| 134 context_->input_task_runner(), context_->ui_task_runner())), | |
| 134 #endif // !defined(OS_WIN) | 135 #endif // !defined(OS_WIN) |
| 135 desktop_resizer_(DesktopResizer::Create()), | 136 desktop_resizer_(DesktopResizer::Create()), |
| 136 exit_code_(kSuccessExitCode) | 137 exit_code_(kSuccessExitCode) |
| 137 #if defined(OS_MACOSX) | 138 #if defined(OS_MACOSX) |
| 138 , curtain_(base::Bind(&HostProcess::OnDisconnectRequested, | 139 , curtain_(base::Bind(&HostProcess::OnDisconnectRequested, |
| 139 base::Unretained(this)), | 140 base::Unretained(this)), |
| 140 base::Bind(&HostProcess::OnDisconnectRequested, | 141 base::Bind(&HostProcess::OnDisconnectRequested, |
| 141 base::Unretained(this))) | 142 base::Unretained(this))) |
| 142 #endif | 143 #endif |
| 143 { | 144 { |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 304 | 305 |
| 305 StartWatchingConfigChanges(); | 306 StartWatchingConfigChanges(); |
| 306 } | 307 } |
| 307 | 308 |
| 308 int get_exit_code() const { return exit_code_; } | 309 int get_exit_code() const { return exit_code_; } |
| 309 | 310 |
| 310 private: | 311 private: |
| 311 void ShutdownHostProcess() { | 312 void ShutdownHostProcess() { |
| 312 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); | 313 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); |
| 313 | 314 |
| 315 // Tear down resources that use ChromotingHostContext threads. | |
| 314 config_watcher_.reset(); | 316 config_watcher_.reset(); |
| 315 | |
| 316 daemon_channel_.reset(); | 317 daemon_channel_.reset(); |
| 318 desktop_environment_factory_.reset(); | |
| 317 host_user_interface_.reset(); | 319 host_user_interface_.reset(); |
| 318 | 320 |
| 319 if (policy_watcher_.get()) { | 321 if (policy_watcher_.get()) { |
| 320 base::WaitableEvent done_event(true, false); | 322 base::WaitableEvent done_event(true, false); |
| 321 policy_watcher_->StopWatching(&done_event); | 323 policy_watcher_->StopWatching(&done_event); |
| 322 done_event.Wait(); | 324 done_event.Wait(); |
| 323 policy_watcher_.reset(); | 325 policy_watcher_.reset(); |
| 324 } | 326 } |
| 325 | 327 |
| 326 context_.reset(); | 328 context_.reset(); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 551 NetworkSettings network_settings( | 553 NetworkSettings network_settings( |
| 552 allow_nat_traversal_ ? | 554 allow_nat_traversal_ ? |
| 553 NetworkSettings::NAT_TRAVERSAL_ENABLED : | 555 NetworkSettings::NAT_TRAVERSAL_ENABLED : |
| 554 NetworkSettings::NAT_TRAVERSAL_DISABLED); | 556 NetworkSettings::NAT_TRAVERSAL_DISABLED); |
| 555 if (!allow_nat_traversal_) { | 557 if (!allow_nat_traversal_) { |
| 556 network_settings.min_port = NetworkSettings::kDefaultMinPort; | 558 network_settings.min_port = NetworkSettings::kDefaultMinPort; |
| 557 network_settings.max_port = NetworkSettings::kDefaultMaxPort; | 559 network_settings.max_port = NetworkSettings::kDefaultMaxPort; |
| 558 } | 560 } |
| 559 | 561 |
| 560 host_ = new ChromotingHost( | 562 host_ = new ChromotingHost( |
| 561 context_.get(), signal_strategy_.get(), | 563 signal_strategy_.get(), |
| 562 desktop_environment_factory_.get(), | 564 desktop_environment_factory_.get(), |
| 563 CreateHostSessionManager(network_settings, | 565 CreateHostSessionManager(network_settings, |
| 564 context_->url_request_context_getter())); | 566 context_->url_request_context_getter()), |
| 567 context_->capture_task_runner(), | |
| 568 context_->encode_task_runner(), | |
| 569 context_->network_task_runner()); | |
| 565 | 570 |
| 566 // TODO(simonmorris): Get the maximum session duration from a policy. | 571 // TODO(simonmorris): Get the maximum session duration from a policy. |
| 567 #if defined(OS_LINUX) | 572 #if defined(OS_LINUX) |
| 568 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); | 573 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); |
| 569 #endif | 574 #endif |
| 570 | 575 |
| 571 heartbeat_sender_.reset(new HeartbeatSender( | 576 heartbeat_sender_.reset(new HeartbeatSender( |
| 572 this, host_id_, signal_strategy_.get(), &key_pair_)); | 577 this, host_id_, signal_strategy_.get(), &key_pair_)); |
| 573 | 578 |
| 574 log_to_server_.reset( | 579 log_to_server_.reset( |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 821 user32.GetFunctionPointer("SetProcessDPIAware")); | 826 user32.GetFunctionPointer("SetProcessDPIAware")); |
| 822 set_process_dpi_aware(); | 827 set_process_dpi_aware(); |
| 823 } | 828 } |
| 824 | 829 |
| 825 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 830 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
| 826 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 831 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
| 827 return main(0, NULL); | 832 return main(0, NULL); |
| 828 } | 833 } |
| 829 | 834 |
| 830 #endif // defined(OS_WIN) | 835 #endif // defined(OS_WIN) |
| OLD | NEW |