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 21 matching lines...) Expand all Loading... | |
32 #include "net/socket/ssl_server_socket.h" | 32 #include "net/socket/ssl_server_socket.h" |
33 #include "net/url_request/url_fetcher.h" | 33 #include "net/url_request/url_fetcher.h" |
34 #include "remoting/base/auto_thread_task_runner.h" | 34 #include "remoting/base/auto_thread_task_runner.h" |
35 #include "remoting/base/breakpad.h" | 35 #include "remoting/base/breakpad.h" |
36 #include "remoting/base/constants.h" | 36 #include "remoting/base/constants.h" |
37 #include "remoting/base/logging.h" | 37 #include "remoting/base/logging.h" |
38 #include "remoting/base/rsa_key_pair.h" | 38 #include "remoting/base/rsa_key_pair.h" |
39 #include "remoting/base/service_urls.h" | 39 #include "remoting/base/service_urls.h" |
40 #include "remoting/base/util.h" | 40 #include "remoting/base/util.h" |
41 #include "remoting/host/branding.h" | 41 #include "remoting/host/branding.h" |
42 // #include "remoting/host/cast_extension.h" | |
42 #include "remoting/host/chromoting_host.h" | 43 #include "remoting/host/chromoting_host.h" |
43 #include "remoting/host/chromoting_host_context.h" | 44 #include "remoting/host/chromoting_host_context.h" |
44 #include "remoting/host/chromoting_messages.h" | 45 #include "remoting/host/chromoting_messages.h" |
45 #include "remoting/host/config_file_watcher.h" | 46 #include "remoting/host/config_file_watcher.h" |
46 #include "remoting/host/config_watcher.h" | 47 #include "remoting/host/config_watcher.h" |
47 #include "remoting/host/desktop_environment.h" | 48 #include "remoting/host/desktop_environment.h" |
48 #include "remoting/host/desktop_session_connector.h" | 49 #include "remoting/host/desktop_session_connector.h" |
49 #include "remoting/host/dns_blackhole_checker.h" | 50 #include "remoting/host/dns_blackhole_checker.h" |
50 #include "remoting/host/heartbeat_sender.h" | 51 #include "remoting/host/heartbeat_sender.h" |
51 #include "remoting/host/host_change_notification_listener.h" | 52 #include "remoting/host/host_change_notification_listener.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 const char kApplicationName[] = "chromoting"; | 108 const char kApplicationName[] = "chromoting"; |
108 | 109 |
109 #if defined(OS_LINUX) | 110 #if defined(OS_LINUX) |
110 // The command line switch used to pass name of the pipe to capture audio on | 111 // The command line switch used to pass name of the pipe to capture audio on |
111 // linux. | 112 // linux. |
112 const char kAudioPipeSwitchName[] = "audio-pipe-name"; | 113 const char kAudioPipeSwitchName[] = "audio-pipe-name"; |
113 | 114 |
114 // The command line switch used to pass name of the unix domain socket used to | 115 // The command line switch used to pass name of the unix domain socket used to |
115 // listen for gnubby requests. | 116 // listen for gnubby requests. |
116 const char kAuthSocknameSwitchName[] = "ssh-auth-sockname"; | 117 const char kAuthSocknameSwitchName[] = "ssh-auth-sockname"; |
118 | |
119 // The command line switch used to enable casting in linux. | |
120 const char kEnableCastSwitchName[] = "enable-cast"; | |
121 | |
117 #endif // defined(OS_LINUX) | 122 #endif // defined(OS_LINUX) |
118 | 123 |
119 // The command line switch used by the parent to request the host to signal it | 124 // The command line switch used by the parent to request the host to signal it |
120 // when it is successfully started. | 125 // when it is successfully started. |
121 const char kSignalParentSwitchName[] = "signal-parent"; | 126 const char kSignalParentSwitchName[] = "signal-parent"; |
122 | 127 |
123 // Command line switch used to enable VP9 encoding. | 128 // Command line switch used to enable VP9 encoding. |
124 const char kEnableVp9SwitchName[] = "enable-vp9"; | 129 const char kEnableVp9SwitchName[] = "enable-vp9"; |
125 | 130 |
126 // Value used for --host-config option to indicate that the path must be read | 131 // Value used for --host-config option to indicate that the path must be read |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
280 scoped_ptr<ConfigWatcher> config_watcher_; | 285 scoped_ptr<ConfigWatcher> config_watcher_; |
281 | 286 |
282 std::string host_id_; | 287 std::string host_id_; |
283 protocol::SharedSecretHash host_secret_hash_; | 288 protocol::SharedSecretHash host_secret_hash_; |
284 scoped_refptr<RsaKeyPair> key_pair_; | 289 scoped_refptr<RsaKeyPair> key_pair_; |
285 std::string oauth_refresh_token_; | 290 std::string oauth_refresh_token_; |
286 std::string serialized_config_; | 291 std::string serialized_config_; |
287 std::string host_owner_; | 292 std::string host_owner_; |
288 bool use_service_account_; | 293 bool use_service_account_; |
289 bool enable_vp9_; | 294 bool enable_vp9_; |
295 bool enable_cast_; | |
290 | 296 |
291 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; | 297 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; |
292 std::string host_domain_; | 298 std::string host_domain_; |
293 bool host_username_match_required_; | 299 bool host_username_match_required_; |
294 bool allow_nat_traversal_; | 300 bool allow_nat_traversal_; |
295 bool allow_relay_; | 301 bool allow_relay_; |
296 int min_udp_port_; | 302 int min_udp_port_; |
297 int max_udp_port_; | 303 int max_udp_port_; |
298 std::string talkgadget_prefix_; | 304 std::string talkgadget_prefix_; |
299 bool allow_pairing_; | 305 bool allow_pairing_; |
(...skipping 25 matching lines...) Expand all Loading... | |
325 | 331 |
326 scoped_ptr<PairingRegistry::Delegate> pairing_registry_delegate_; | 332 scoped_ptr<PairingRegistry::Delegate> pairing_registry_delegate_; |
327 }; | 333 }; |
328 | 334 |
329 HostProcess::HostProcess(scoped_ptr<ChromotingHostContext> context, | 335 HostProcess::HostProcess(scoped_ptr<ChromotingHostContext> context, |
330 int* exit_code_out) | 336 int* exit_code_out) |
331 : context_(context.Pass()), | 337 : context_(context.Pass()), |
332 state_(HOST_INITIALIZING), | 338 state_(HOST_INITIALIZING), |
333 use_service_account_(false), | 339 use_service_account_(false), |
334 enable_vp9_(false), | 340 enable_vp9_(false), |
341 enable_cast_(false), | |
335 host_username_match_required_(false), | 342 host_username_match_required_(false), |
336 allow_nat_traversal_(true), | 343 allow_nat_traversal_(true), |
337 allow_relay_(true), | 344 allow_relay_(true), |
338 min_udp_port_(0), | 345 min_udp_port_(0), |
339 max_udp_port_(0), | 346 max_udp_port_(0), |
340 allow_pairing_(true), | 347 allow_pairing_(true), |
341 curtain_required_(false), | 348 curtain_required_(false), |
342 enable_gnubby_auth_(false), | 349 enable_gnubby_auth_(false), |
343 #if defined(REMOTING_MULTI_PROCESS) | 350 #if defined(REMOTING_MULTI_PROCESS) |
344 desktop_session_connector_(NULL), | 351 desktop_session_connector_(NULL), |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
439 if (!xmpp_server_valid) { | 446 if (!xmpp_server_valid) { |
440 LOG(ERROR) << "Invalid XMPP server: " << | 447 LOG(ERROR) << "Invalid XMPP server: " << |
441 service_urls->xmpp_server_address(); | 448 service_urls->xmpp_server_address(); |
442 return false; | 449 return false; |
443 } | 450 } |
444 xmpp_server_config_.use_tls = service_urls->xmpp_server_use_tls(); | 451 xmpp_server_config_.use_tls = service_urls->xmpp_server_use_tls(); |
445 directory_bot_jid_ = service_urls->directory_bot_jid(); | 452 directory_bot_jid_ = service_urls->directory_bot_jid(); |
446 | 453 |
447 signal_parent_ = cmd_line->HasSwitch(kSignalParentSwitchName); | 454 signal_parent_ = cmd_line->HasSwitch(kSignalParentSwitchName); |
448 | 455 |
456 #if defined(OS_LINUX) | |
457 enable_cast_ = cmd_line->HasSwitch(kEnableCastSwitchName); | |
458 #endif // !defined(OS_LINUX) | |
459 | |
449 return true; | 460 return true; |
450 } | 461 } |
451 | 462 |
452 void HostProcess::OnConfigUpdated( | 463 void HostProcess::OnConfigUpdated( |
453 const std::string& serialized_config) { | 464 const std::string& serialized_config) { |
454 if (!context_->network_task_runner()->BelongsToCurrentThread()) { | 465 if (!context_->network_task_runner()->BelongsToCurrentThread()) { |
455 context_->network_task_runner()->PostTask(FROM_HERE, | 466 context_->network_task_runner()->PostTask(FROM_HERE, |
456 base::Bind(&HostProcess::OnConfigUpdated, this, serialized_config)); | 467 base::Bind(&HostProcess::OnConfigUpdated, this, serialized_config)); |
457 return; | 468 return; |
458 } | 469 } |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1201 if (enable_vp9_) { | 1212 if (enable_vp9_) { |
1202 scoped_ptr<protocol::CandidateSessionConfig> config = | 1213 scoped_ptr<protocol::CandidateSessionConfig> config = |
1203 host_->protocol_config()->Clone(); | 1214 host_->protocol_config()->Clone(); |
1204 config->EnableVideoCodec(protocol::ChannelConfig::CODEC_VP9); | 1215 config->EnableVideoCodec(protocol::ChannelConfig::CODEC_VP9); |
1205 host_->set_protocol_config(config.Pass()); | 1216 host_->set_protocol_config(config.Pass()); |
1206 } | 1217 } |
1207 | 1218 |
1208 // TODO(simonmorris): Get the maximum session duration from a policy. | 1219 // TODO(simonmorris): Get the maximum session duration from a policy. |
1209 #if defined(OS_LINUX) | 1220 #if defined(OS_LINUX) |
1210 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); | 1221 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); |
1222 | |
1223 // Enable Cast if specified on the command-line. | |
1224 // TODO(aiguha): The way the enable_cast flag is propagated through to the | |
1225 // ChromotingHost and ClientSession could be made cleaner. | |
1226 if (enable_cast_) { | |
1227 LOG(INFO) << "Cast Enabled."; | |
1228 // scoped_ptr<HostExtension> extension(new CastExtension( | |
1229 // network_settings, context_->url_request_context_getter())); | |
1230 // host_->AddExtension(extension.Pass()); | |
Wez
2014/07/17 22:56:37
You shouldn't need to do this; you can land the CL
aiguha
2014/07/18 21:30:37
Done.
| |
1231 host_->set_enable_cast(enable_cast_); | |
Wez
2014/07/17 22:56:37
As implemented this CL causes the host to disable
| |
1232 } | |
aiguha
2014/07/17 17:51:03
Lines 1228-1230 are commented out only so I could
| |
1233 | |
1211 #endif | 1234 #endif |
1212 | 1235 |
1213 heartbeat_sender_.reset(new HeartbeatSender( | 1236 heartbeat_sender_.reset(new HeartbeatSender( |
1214 this, host_id_, signal_strategy_.get(), key_pair_, | 1237 this, host_id_, signal_strategy_.get(), key_pair_, |
1215 directory_bot_jid_)); | 1238 directory_bot_jid_)); |
1216 | 1239 |
1217 host_status_sender_.reset(new HostStatusSender( | 1240 host_status_sender_.reset(new HostStatusSender( |
1218 host_id_, signal_strategy_.get(), key_pair_, directory_bot_jid_)); | 1241 host_id_, signal_strategy_.get(), key_pair_, directory_bot_jid_)); |
1219 | 1242 |
1220 host_change_notification_listener_.reset(new HostChangeNotificationListener( | 1243 host_change_notification_listener_.reset(new HostChangeNotificationListener( |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1375 return exit_code; | 1398 return exit_code; |
1376 } | 1399 } |
1377 | 1400 |
1378 } // namespace remoting | 1401 } // namespace remoting |
1379 | 1402 |
1380 #if !defined(OS_WIN) | 1403 #if !defined(OS_WIN) |
1381 int main(int argc, char** argv) { | 1404 int main(int argc, char** argv) { |
1382 return remoting::HostMain(argc, argv); | 1405 return remoting::HostMain(argc, argv); |
1383 } | 1406 } |
1384 #endif // !defined(OS_WIN) | 1407 #endif // !defined(OS_WIN) |
OLD | NEW |