| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cstdint> | 9 #include <cstdint> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 // Value used for --host-config option to indicate that the path must be read | 146 // Value used for --host-config option to indicate that the path must be read |
| 147 // from stdin. | 147 // from stdin. |
| 148 const char kStdinConfigPath[] = "-"; | 148 const char kStdinConfigPath[] = "-"; |
| 149 #endif // !defined(REMOTING_MULTI_PROCESS) | 149 #endif // !defined(REMOTING_MULTI_PROCESS) |
| 150 | 150 |
| 151 #if defined(OS_LINUX) | 151 #if defined(OS_LINUX) |
| 152 // The command line switch used to pass name of the pipe to capture audio on | 152 // The command line switch used to pass name of the pipe to capture audio on |
| 153 // linux. | 153 // linux. |
| 154 const char kAudioPipeSwitchName[] = "audio-pipe-name"; | 154 const char kAudioPipeSwitchName[] = "audio-pipe-name"; |
| 155 #endif // defined(OS_LINUX) |
| 155 | 156 |
| 157 #if defined(OS_POSIX) |
| 156 // The command line switch used to pass name of the unix domain socket used to | 158 // The command line switch used to pass name of the unix domain socket used to |
| 157 // listen for security key requests. | 159 // listen for security key requests. |
| 158 const char kAuthSocknameSwitchName[] = "ssh-auth-sockname"; | 160 const char kAuthSocknameSwitchName[] = "ssh-auth-sockname"; |
| 159 #endif // defined(OS_LINUX) | 161 #endif // defined(OS_POSIX) |
| 160 | 162 |
| 161 // The command line switch used by the parent to request the host to signal it | 163 // The command line switch used by the parent to request the host to signal it |
| 162 // when it is successfully started. | 164 // when it is successfully started. |
| 163 const char kSignalParentSwitchName[] = "signal-parent"; | 165 const char kSignalParentSwitchName[] = "signal-parent"; |
| 164 | 166 |
| 165 // Command line switch used to enable VP9 encoding. | 167 // Command line switch used to enable VP9 encoding. |
| 166 const char kEnableVp9SwitchName[] = "enable-vp9"; | 168 const char kEnableVp9SwitchName[] = "enable-vp9"; |
| 167 | 169 |
| 168 const char kWindowIdSwitchName[] = "window-id"; | 170 const char kWindowIdSwitchName[] = "window-id"; |
| 169 | 171 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 bool host_username_match_required_ = false; | 373 bool host_username_match_required_ = false; |
| 372 bool allow_nat_traversal_ = true; | 374 bool allow_nat_traversal_ = true; |
| 373 bool allow_relay_ = true; | 375 bool allow_relay_ = true; |
| 374 PortRange udp_port_range_; | 376 PortRange udp_port_range_; |
| 375 std::string talkgadget_prefix_; | 377 std::string talkgadget_prefix_; |
| 376 bool allow_pairing_ = true; | 378 bool allow_pairing_ = true; |
| 377 | 379 |
| 378 bool curtain_required_ = false; | 380 bool curtain_required_ = false; |
| 379 ThirdPartyAuthConfig third_party_auth_config_; | 381 ThirdPartyAuthConfig third_party_auth_config_; |
| 380 bool security_key_auth_policy_enabled_ = false; | 382 bool security_key_auth_policy_enabled_ = false; |
| 381 bool security_key_extension_supported_ = false; | 383 bool security_key_extension_supported_ = true; |
| 382 | 384 |
| 383 // Boolean to change flow, where necessary, if we're | 385 // Boolean to change flow, where necessary, if we're |
| 384 // capturing a window instead of the entire desktop. | 386 // capturing a window instead of the entire desktop. |
| 385 bool enable_window_capture_ = false; | 387 bool enable_window_capture_ = false; |
| 386 | 388 |
| 387 // Used to specify which window to stream, if enabled. | 389 // Used to specify which window to stream, if enabled. |
| 388 webrtc::WindowId window_id_ = 0; | 390 webrtc::WindowId window_id_ = 0; |
| 389 | 391 |
| 390 // Must outlive |gcd_state_updater_| and |signaling_connector_|. | 392 // Must outlive |gcd_state_updater_| and |signaling_connector_|. |
| 391 std::unique_ptr<OAuthTokenGetter> oauth_token_getter_; | 393 std::unique_ptr<OAuthTokenGetter> oauth_token_getter_; |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 | 807 |
| 806 #if defined(OS_LINUX) | 808 #if defined(OS_LINUX) |
| 807 // If an audio pipe is specific on the command-line then initialize | 809 // If an audio pipe is specific on the command-line then initialize |
| 808 // AudioCapturerLinux to capture from it. | 810 // AudioCapturerLinux to capture from it. |
| 809 base::FilePath audio_pipe_name = base::CommandLine::ForCurrentProcess()-> | 811 base::FilePath audio_pipe_name = base::CommandLine::ForCurrentProcess()-> |
| 810 GetSwitchValuePath(kAudioPipeSwitchName); | 812 GetSwitchValuePath(kAudioPipeSwitchName); |
| 811 if (!audio_pipe_name.empty()) { | 813 if (!audio_pipe_name.empty()) { |
| 812 remoting::AudioCapturerLinux::InitializePipeReader( | 814 remoting::AudioCapturerLinux::InitializePipeReader( |
| 813 context_->audio_task_runner(), audio_pipe_name); | 815 context_->audio_task_runner(), audio_pipe_name); |
| 814 } | 816 } |
| 817 #endif // defined(OS_LINUX) |
| 815 | 818 |
| 819 #if defined(OS_POSIX) |
| 816 base::FilePath security_key_socket_name = | 820 base::FilePath security_key_socket_name = |
| 817 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 821 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
| 818 kAuthSocknameSwitchName); | 822 kAuthSocknameSwitchName); |
| 819 if (!security_key_socket_name.empty()) { | 823 if (!security_key_socket_name.empty()) { |
| 820 remoting::SecurityKeyAuthHandler::SetSecurityKeySocketName( | 824 remoting::SecurityKeyAuthHandler::SetSecurityKeySocketName( |
| 821 security_key_socket_name); | 825 security_key_socket_name); |
| 822 security_key_extension_supported_ = true; | 826 } else { |
| 827 security_key_extension_supported_ = false; |
| 823 } | 828 } |
| 824 #elif defined(OS_WIN) | 829 #endif // defined(OS_POSIX) |
| 825 // TODO(joedow): Remove the conditional once this is supported on OSX. | |
| 826 security_key_extension_supported_ = true; | |
| 827 #endif // defined(OS_WIN) | |
| 828 | 830 |
| 829 // Create a desktop environment factory appropriate to the build type & | 831 // Create a desktop environment factory appropriate to the build type & |
| 830 // platform. | 832 // platform. |
| 831 #if defined(REMOTING_MULTI_PROCESS) | 833 #if defined(REMOTING_MULTI_PROCESS) |
| 832 IpcDesktopEnvironmentFactory* desktop_environment_factory = | 834 IpcDesktopEnvironmentFactory* desktop_environment_factory = |
| 833 new IpcDesktopEnvironmentFactory( | 835 new IpcDesktopEnvironmentFactory( |
| 834 context_->audio_task_runner(), context_->network_task_runner(), | 836 context_->audio_task_runner(), context_->network_task_runner(), |
| 835 context_->network_task_runner(), daemon_channel_.get()); | 837 context_->network_task_runner(), daemon_channel_.get()); |
| 836 desktop_session_connector_ = desktop_environment_factory; | 838 desktop_session_connector_ = desktop_environment_factory; |
| 837 #else // !defined(REMOTING_MULTI_PROCESS) | 839 #else // !defined(REMOTING_MULTI_PROCESS) |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 // When curtain mode is in effect on Mac, the host process runs in the | 1238 // When curtain mode is in effect on Mac, the host process runs in the |
| 1237 // user's switched-out session, but launchd will also run an instance at | 1239 // user's switched-out session, but launchd will also run an instance at |
| 1238 // the console login screen. Even if no user is currently logged-on, we | 1240 // the console login screen. Even if no user is currently logged-on, we |
| 1239 // can't support remote-access to the login screen because the current host | 1241 // can't support remote-access to the login screen because the current host |
| 1240 // process model disconnects the client during login, which would leave | 1242 // process model disconnects the client during login, which would leave |
| 1241 // the logged in session un-curtained on the console until they reconnect. | 1243 // the logged in session un-curtained on the console until they reconnect. |
| 1242 // | 1244 // |
| 1243 // TODO(jamiewalch): Fix this once we have implemented the multi-process | 1245 // TODO(jamiewalch): Fix this once we have implemented the multi-process |
| 1244 // daemon architecture (crbug.com/134894) | 1246 // daemon architecture (crbug.com/134894) |
| 1245 if (getuid() == 0) { | 1247 if (getuid() == 0) { |
| 1246 LOG(ERROR) << "Running the host in the console login session is yet not " | 1248 LOG(ERROR) << "Running the host in the console login session is not yet " |
| 1247 "supported."; | 1249 "supported."; |
| 1248 ShutdownHost(kLoginScreenNotSupportedExitCode); | 1250 ShutdownHost(kLoginScreenNotSupportedExitCode); |
| 1249 return false; | 1251 return false; |
| 1250 } | 1252 } |
| 1251 } | 1253 } |
| 1252 #endif | 1254 #endif |
| 1253 | 1255 |
| 1254 if (curtain_required_) { | 1256 if (curtain_required_) { |
| 1255 HOST_LOG << "Policy requires curtain-mode."; | 1257 HOST_LOG << "Policy requires curtain-mode."; |
| 1256 } else { | 1258 } else { |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1657 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); | 1659 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); |
| 1658 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); | 1660 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); |
| 1659 | 1661 |
| 1660 // Run the main (also UI) message loop until the host no longer needs it. | 1662 // Run the main (also UI) message loop until the host no longer needs it. |
| 1661 base::RunLoop().Run(); | 1663 base::RunLoop().Run(); |
| 1662 | 1664 |
| 1663 return exit_code; | 1665 return exit_code; |
| 1664 } | 1666 } |
| 1665 | 1667 |
| 1666 } // namespace remoting | 1668 } // namespace remoting |
| OLD | NEW |