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 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_( | |
| 339 CommandLine::ForCurrentProcess()->HasSwitch(kEnableVp9SwitchName)), | |
| 334 host_username_match_required_(false), | 340 host_username_match_required_(false), |
| 335 allow_nat_traversal_(true), | 341 allow_nat_traversal_(true), |
| 336 allow_relay_(true), | 342 allow_relay_(true), |
| 337 min_udp_port_(0), | 343 min_udp_port_(0), |
| 338 max_udp_port_(0), | 344 max_udp_port_(0), |
| 339 allow_pairing_(true), | 345 allow_pairing_(true), |
| 340 curtain_required_(false), | 346 curtain_required_(false), |
| 341 enable_gnubby_auth_(false), | 347 enable_gnubby_auth_(false), |
| 342 #if defined(REMOTING_MULTI_PROCESS) | 348 #if defined(REMOTING_MULTI_PROCESS) |
| 343 desktop_session_connector_(NULL), | 349 desktop_session_connector_(NULL), |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 809 } | 815 } |
| 810 | 816 |
| 811 if (config->GetString(kHostOwnerConfigPath, &host_owner_)) { | 817 if (config->GetString(kHostOwnerConfigPath, &host_owner_)) { |
| 812 // Service account configs have a host_owner, different from the xmpp_login. | 818 // Service account configs have a host_owner, different from the xmpp_login. |
| 813 use_service_account_ = true; | 819 use_service_account_ = true; |
| 814 } else { | 820 } else { |
| 815 // User credential configs only have an xmpp_login, which is also the owner. | 821 // User credential configs only have an xmpp_login, which is also the owner. |
| 816 host_owner_ = xmpp_server_config_.username; | 822 host_owner_ = xmpp_server_config_.username; |
| 817 use_service_account_ = false; | 823 use_service_account_ = false; |
| 818 } | 824 } |
| 825 | |
| 826 // If the enable VP9 option is unspecified, or false, then VP9 is not offered. | |
|
Jamie
2014/06/17 17:35:48
It actually falls back on the command-line, I thin
Sergey Ulanov
2014/06/17 17:37:58
I think this should also mention the optional CL f
| |
| 827 config->GetBoolean(kEnableVp9ConfigPath, &enable_vp9_); | |
|
Sergey Ulanov
2014/06/17 17:37:59
Shouldn't command-line option override the flag in
Wez
2014/06/17 17:58:23
Done.
| |
| 828 | |
| 819 return true; | 829 return true; |
| 820 } | 830 } |
| 821 | 831 |
| 822 void HostProcess::OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies) { | 832 void HostProcess::OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies) { |
| 823 if (!context_->network_task_runner()->BelongsToCurrentThread()) { | 833 if (!context_->network_task_runner()->BelongsToCurrentThread()) { |
| 824 context_->network_task_runner()->PostTask(FROM_HERE, base::Bind( | 834 context_->network_task_runner()->PostTask(FROM_HERE, base::Bind( |
| 825 &HostProcess::OnPolicyUpdate, this, base::Passed(&policies))); | 835 &HostProcess::OnPolicyUpdate, this, base::Passed(&policies))); |
| 826 return; | 836 return; |
| 827 } | 837 } |
| 828 | 838 |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1183 desktop_environment_factory_.get(), | 1193 desktop_environment_factory_.get(), |
| 1184 CreateHostSessionManager(signal_strategy_.get(), network_settings, | 1194 CreateHostSessionManager(signal_strategy_.get(), network_settings, |
| 1185 context_->url_request_context_getter()), | 1195 context_->url_request_context_getter()), |
| 1186 context_->audio_task_runner(), | 1196 context_->audio_task_runner(), |
| 1187 context_->input_task_runner(), | 1197 context_->input_task_runner(), |
| 1188 context_->video_capture_task_runner(), | 1198 context_->video_capture_task_runner(), |
| 1189 context_->video_encode_task_runner(), | 1199 context_->video_encode_task_runner(), |
| 1190 context_->network_task_runner(), | 1200 context_->network_task_runner(), |
| 1191 context_->ui_task_runner())); | 1201 context_->ui_task_runner())); |
| 1192 | 1202 |
| 1203 // Enable VP9 if configured via the host config. | |
|
Jamie
2014/06/17 17:35:48
It can also be configured on the command-line. I t
Wez
2014/06/17 17:58:23
Done.
| |
| 1204 if (enable_vp9_) { | |
| 1205 scoped_ptr<protocol::CandidateSessionConfig> config = | |
| 1206 host_->protocol_config()->Clone(); | |
| 1207 config->EnableVideoCodec(protocol::ChannelConfig::CODEC_VP9); | |
| 1208 host_->set_protocol_config(config.Pass()); | |
| 1209 } | |
| 1210 | |
| 1193 // TODO(simonmorris): Get the maximum session duration from a policy. | 1211 // TODO(simonmorris): Get the maximum session duration from a policy. |
| 1194 #if defined(OS_LINUX) | 1212 #if defined(OS_LINUX) |
| 1195 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); | 1213 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); |
| 1196 #endif | 1214 #endif |
| 1197 | 1215 |
| 1198 heartbeat_sender_.reset(new HeartbeatSender( | 1216 heartbeat_sender_.reset(new HeartbeatSender( |
| 1199 this, host_id_, signal_strategy_.get(), key_pair_, | 1217 this, host_id_, signal_strategy_.get(), key_pair_, |
| 1200 directory_bot_jid_)); | 1218 directory_bot_jid_)); |
| 1201 | 1219 |
| 1202 host_status_sender_.reset(new HostStatusSender( | 1220 host_status_sender_.reset(new HostStatusSender( |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1360 return exit_code; | 1378 return exit_code; |
| 1361 } | 1379 } |
| 1362 | 1380 |
| 1363 } // namespace remoting | 1381 } // namespace remoting |
| 1364 | 1382 |
| 1365 #if !defined(OS_WIN) | 1383 #if !defined(OS_WIN) |
| 1366 int main(int argc, char** argv) { | 1384 int main(int argc, char** argv) { |
| 1367 return remoting::HostMain(argc, argv); | 1385 return remoting::HostMain(argc, argv); |
| 1368 } | 1386 } |
| 1369 #endif // !defined(OS_WIN) | 1387 #endif // !defined(OS_WIN) |
| OLD | NEW |