| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 // The command line switch used to pass name of the unix domain socket used to | 118 // The command line switch used to pass name of the unix domain socket used to |
| 119 // listen for gnubby requests. | 119 // listen for gnubby requests. |
| 120 const char kAuthSocknameSwitchName[] = "ssh-auth-sockname"; | 120 const char kAuthSocknameSwitchName[] = "ssh-auth-sockname"; |
| 121 #endif // defined(OS_LINUX) | 121 #endif // defined(OS_LINUX) |
| 122 | 122 |
| 123 // The command line switch used by the parent to request the host to signal it | 123 // The command line switch used by the parent to request the host to signal it |
| 124 // when it is successfully started. | 124 // when it is successfully started. |
| 125 const char kSignalParentSwitchName[] = "signal-parent"; | 125 const char kSignalParentSwitchName[] = "signal-parent"; |
| 126 | 126 |
| 127 // Command line switch used to enable VP9 encoding. |
| 128 const char kEnableVp9SwitchName[] = "enable-vp9"; |
| 129 |
| 127 // Value used for --host-config option to indicate that the path must be read | 130 // Value used for --host-config option to indicate that the path must be read |
| 128 // from stdin. | 131 // from stdin. |
| 129 const char kStdinConfigPath[] = "-"; | 132 const char kStdinConfigPath[] = "-"; |
| 130 | 133 |
| 131 } // namespace | 134 } // namespace |
| 132 | 135 |
| 133 namespace remoting { | 136 namespace remoting { |
| 134 | 137 |
| 135 class HostProcess | 138 class HostProcess |
| 136 : public ConfigWatcher::Delegate, | 139 : public ConfigWatcher::Delegate, |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 | 283 |
| 281 scoped_ptr<ConfigWatcher> config_watcher_; | 284 scoped_ptr<ConfigWatcher> config_watcher_; |
| 282 | 285 |
| 283 std::string host_id_; | 286 std::string host_id_; |
| 284 protocol::SharedSecretHash host_secret_hash_; | 287 protocol::SharedSecretHash host_secret_hash_; |
| 285 scoped_refptr<RsaKeyPair> key_pair_; | 288 scoped_refptr<RsaKeyPair> key_pair_; |
| 286 std::string oauth_refresh_token_; | 289 std::string oauth_refresh_token_; |
| 287 std::string serialized_config_; | 290 std::string serialized_config_; |
| 288 std::string host_owner_; | 291 std::string host_owner_; |
| 289 bool use_service_account_; | 292 bool use_service_account_; |
| 293 bool enable_vp9_; |
| 290 | 294 |
| 291 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; | 295 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; |
| 292 std::string host_domain_; | 296 std::string host_domain_; |
| 293 bool host_username_match_required_; | 297 bool host_username_match_required_; |
| 294 bool allow_nat_traversal_; | 298 bool allow_nat_traversal_; |
| 295 bool allow_relay_; | 299 bool allow_relay_; |
| 296 int min_udp_port_; | 300 int min_udp_port_; |
| 297 int max_udp_port_; | 301 int max_udp_port_; |
| 298 std::string talkgadget_prefix_; | 302 std::string talkgadget_prefix_; |
| 299 bool allow_pairing_; | 303 bool allow_pairing_; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 324 bool signal_parent_; | 328 bool signal_parent_; |
| 325 | 329 |
| 326 scoped_ptr<PairingRegistry::Delegate> pairing_registry_delegate_; | 330 scoped_ptr<PairingRegistry::Delegate> pairing_registry_delegate_; |
| 327 }; | 331 }; |
| 328 | 332 |
| 329 HostProcess::HostProcess(scoped_ptr<ChromotingHostContext> context, | 333 HostProcess::HostProcess(scoped_ptr<ChromotingHostContext> context, |
| 330 int* exit_code_out) | 334 int* exit_code_out) |
| 331 : context_(context.Pass()), | 335 : context_(context.Pass()), |
| 332 state_(HOST_INITIALIZING), | 336 state_(HOST_INITIALIZING), |
| 333 use_service_account_(false), | 337 use_service_account_(false), |
| 338 enable_vp9_(false), |
| 334 host_username_match_required_(false), | 339 host_username_match_required_(false), |
| 335 allow_nat_traversal_(true), | 340 allow_nat_traversal_(true), |
| 336 allow_relay_(true), | 341 allow_relay_(true), |
| 337 min_udp_port_(0), | 342 min_udp_port_(0), |
| 338 max_udp_port_(0), | 343 max_udp_port_(0), |
| 339 allow_pairing_(true), | 344 allow_pairing_(true), |
| 340 curtain_required_(false), | 345 curtain_required_(false), |
| 341 enable_gnubby_auth_(false), | 346 enable_gnubby_auth_(false), |
| 342 #if defined(REMOTING_MULTI_PROCESS) | 347 #if defined(REMOTING_MULTI_PROCESS) |
| 343 desktop_session_connector_(NULL), | 348 desktop_session_connector_(NULL), |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 } | 814 } |
| 810 | 815 |
| 811 if (config->GetString(kHostOwnerConfigPath, &host_owner_)) { | 816 if (config->GetString(kHostOwnerConfigPath, &host_owner_)) { |
| 812 // Service account configs have a host_owner, different from the xmpp_login. | 817 // Service account configs have a host_owner, different from the xmpp_login. |
| 813 use_service_account_ = true; | 818 use_service_account_ = true; |
| 814 } else { | 819 } else { |
| 815 // User credential configs only have an xmpp_login, which is also the owner. | 820 // User credential configs only have an xmpp_login, which is also the owner. |
| 816 host_owner_ = xmpp_server_config_.username; | 821 host_owner_ = xmpp_server_config_.username; |
| 817 use_service_account_ = false; | 822 use_service_account_ = false; |
| 818 } | 823 } |
| 824 |
| 825 // Allow offering of VP9 encoding to be overridden by the command-line. |
| 826 if (CommandLine::ForCurrentProcess()->HasSwitch(kEnableVp9SwitchName)) { |
| 827 enable_vp9_ = true; |
| 828 } else { |
| 829 config->GetBoolean(kEnableVp9ConfigPath, &enable_vp9_); |
| 830 } |
| 831 |
| 819 return true; | 832 return true; |
| 820 } | 833 } |
| 821 | 834 |
| 822 void HostProcess::OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies) { | 835 void HostProcess::OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies) { |
| 823 if (!context_->network_task_runner()->BelongsToCurrentThread()) { | 836 if (!context_->network_task_runner()->BelongsToCurrentThread()) { |
| 824 context_->network_task_runner()->PostTask(FROM_HERE, base::Bind( | 837 context_->network_task_runner()->PostTask(FROM_HERE, base::Bind( |
| 825 &HostProcess::OnPolicyUpdate, this, base::Passed(&policies))); | 838 &HostProcess::OnPolicyUpdate, this, base::Passed(&policies))); |
| 826 return; | 839 return; |
| 827 } | 840 } |
| 828 | 841 |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1183 desktop_environment_factory_.get(), | 1196 desktop_environment_factory_.get(), |
| 1184 CreateHostSessionManager(signal_strategy_.get(), network_settings, | 1197 CreateHostSessionManager(signal_strategy_.get(), network_settings, |
| 1185 context_->url_request_context_getter()), | 1198 context_->url_request_context_getter()), |
| 1186 context_->audio_task_runner(), | 1199 context_->audio_task_runner(), |
| 1187 context_->input_task_runner(), | 1200 context_->input_task_runner(), |
| 1188 context_->video_capture_task_runner(), | 1201 context_->video_capture_task_runner(), |
| 1189 context_->video_encode_task_runner(), | 1202 context_->video_encode_task_runner(), |
| 1190 context_->network_task_runner(), | 1203 context_->network_task_runner(), |
| 1191 context_->ui_task_runner())); | 1204 context_->ui_task_runner())); |
| 1192 | 1205 |
| 1206 if (enable_vp9_) { |
| 1207 scoped_ptr<protocol::CandidateSessionConfig> config = |
| 1208 host_->protocol_config()->Clone(); |
| 1209 config->EnableVideoCodec(protocol::ChannelConfig::CODEC_VP9); |
| 1210 host_->set_protocol_config(config.Pass()); |
| 1211 } |
| 1212 |
| 1193 // TODO(simonmorris): Get the maximum session duration from a policy. | 1213 // TODO(simonmorris): Get the maximum session duration from a policy. |
| 1194 #if defined(OS_LINUX) | 1214 #if defined(OS_LINUX) |
| 1195 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); | 1215 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); |
| 1196 #endif | 1216 #endif |
| 1197 | 1217 |
| 1198 heartbeat_sender_.reset(new HeartbeatSender( | 1218 heartbeat_sender_.reset(new HeartbeatSender( |
| 1199 this, host_id_, signal_strategy_.get(), key_pair_, | 1219 this, host_id_, signal_strategy_.get(), key_pair_, |
| 1200 directory_bot_jid_)); | 1220 directory_bot_jid_)); |
| 1201 | 1221 |
| 1202 host_status_sender_.reset(new HostStatusSender( | 1222 host_status_sender_.reset(new HostStatusSender( |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1360 return exit_code; | 1380 return exit_code; |
| 1361 } | 1381 } |
| 1362 | 1382 |
| 1363 } // namespace remoting | 1383 } // namespace remoting |
| 1364 | 1384 |
| 1365 #if !defined(OS_WIN) | 1385 #if !defined(OS_WIN) |
| 1366 int main(int argc, char** argv) { | 1386 int main(int argc, char** argv) { |
| 1367 return remoting::HostMain(argc, argv); | 1387 return remoting::HostMain(argc, argv); |
| 1368 } | 1388 } |
| 1369 #endif // !defined(OS_WIN) | 1389 #endif // !defined(OS_WIN) |
| OLD | NEW |