| 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 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 if (!allow_nat_traversal_) { | 708 if (!allow_nat_traversal_) { |
| 709 network_settings.min_port = NetworkSettings::kDefaultMinPort; | 709 network_settings.min_port = NetworkSettings::kDefaultMinPort; |
| 710 network_settings.max_port = NetworkSettings::kDefaultMaxPort; | 710 network_settings.max_port = NetworkSettings::kDefaultMaxPort; |
| 711 } | 711 } |
| 712 | 712 |
| 713 host_ = new ChromotingHost( | 713 host_ = new ChromotingHost( |
| 714 signal_strategy_.get(), | 714 signal_strategy_.get(), |
| 715 desktop_environment_factory_.get(), | 715 desktop_environment_factory_.get(), |
| 716 CreateHostSessionManager(network_settings, | 716 CreateHostSessionManager(network_settings, |
| 717 context_->url_request_context_getter()), | 717 context_->url_request_context_getter()), |
| 718 context_->audio_task_runner(), |
| 718 context_->capture_task_runner(), | 719 context_->capture_task_runner(), |
| 719 context_->encode_task_runner(), | 720 context_->encode_task_runner(), |
| 720 context_->network_task_runner()); | 721 context_->network_task_runner()); |
| 721 | 722 |
| 722 // TODO(simonmorris): Get the maximum session duration from a policy. | 723 // TODO(simonmorris): Get the maximum session duration from a policy. |
| 723 #if defined(OS_LINUX) | 724 #if defined(OS_LINUX) |
| 724 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); | 725 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); |
| 725 #endif | 726 #endif |
| 726 | 727 |
| 727 heartbeat_sender_.reset(new HeartbeatSender( | 728 heartbeat_sender_.reset(new HeartbeatSender( |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 base::Closure quit_message_loop = base::Bind(&QuitMessageLoop, &message_loop); | 891 base::Closure quit_message_loop = base::Bind(&QuitMessageLoop, &message_loop); |
| 891 scoped_ptr<remoting::ChromotingHostContext> context( | 892 scoped_ptr<remoting::ChromotingHostContext> context( |
| 892 new remoting::ChromotingHostContext( | 893 new remoting::ChromotingHostContext( |
| 893 new remoting::AutoThreadTaskRunner(message_loop.message_loop_proxy(), | 894 new remoting::AutoThreadTaskRunner(message_loop.message_loop_proxy(), |
| 894 quit_message_loop))); | 895 quit_message_loop))); |
| 895 | 896 |
| 896 #if defined(OS_LINUX) | 897 #if defined(OS_LINUX) |
| 897 // TODO(sergeyu): Pass configuration parameters to the Linux-specific version | 898 // TODO(sergeyu): Pass configuration parameters to the Linux-specific version |
| 898 // of DesktopEnvironmentFactory when we have it. | 899 // of DesktopEnvironmentFactory when we have it. |
| 899 remoting::VideoFrameCapturer::EnableXDamage(true); | 900 remoting::VideoFrameCapturer::EnableXDamage(true); |
| 900 remoting::AudioCapturerLinux::SetPipeName(CommandLine::ForCurrentProcess()-> | 901 remoting::AudioCapturerLinux::SetPipeName( |
| 901 GetSwitchValuePath(kAudioPipeSwitchName)); | 902 CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
| 903 kAudioPipeSwitchName)); |
| 902 #endif // defined(OS_LINUX) | 904 #endif // defined(OS_LINUX) |
| 903 | 905 |
| 904 if (!context->Start()) | 906 if (!context->Start()) |
| 905 return remoting::kInitializationFailed; | 907 return remoting::kInitializationFailed; |
| 906 | 908 |
| 907 // Create the host process instance and enter the main message loop. | 909 // Create the host process instance and enter the main message loop. |
| 908 remoting::HostProcess me2me_host(context.Pass()); | 910 remoting::HostProcess me2me_host(context.Pass()); |
| 909 me2me_host.StartHostProcess(); | 911 me2me_host.StartHostProcess(); |
| 910 message_loop.Run(); | 912 message_loop.Run(); |
| 911 return me2me_host.get_exit_code(); | 913 return me2me_host.get_exit_code(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 user32.GetFunctionPointer("SetProcessDPIAware")); | 947 user32.GetFunctionPointer("SetProcessDPIAware")); |
| 946 set_process_dpi_aware(); | 948 set_process_dpi_aware(); |
| 947 } | 949 } |
| 948 | 950 |
| 949 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 951 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
| 950 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 952 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
| 951 return main(0, NULL); | 953 return main(0, NULL); |
| 952 } | 954 } |
| 953 | 955 |
| 954 #endif // defined(OS_WIN) | 956 #endif // defined(OS_WIN) |
| OLD | NEW |