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 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 std::string host_domain_; | 420 std::string host_domain_; |
421 bool host_username_match_required_; | 421 bool host_username_match_required_; |
422 bool allow_nat_traversal_; | 422 bool allow_nat_traversal_; |
423 bool allow_relay_; | 423 bool allow_relay_; |
424 PortRange udp_port_range_; | 424 PortRange udp_port_range_; |
425 std::string talkgadget_prefix_; | 425 std::string talkgadget_prefix_; |
426 bool allow_pairing_; | 426 bool allow_pairing_; |
427 | 427 |
428 bool curtain_required_; | 428 bool curtain_required_; |
429 ThirdPartyAuthConfig third_party_auth_config_; | 429 ThirdPartyAuthConfig third_party_auth_config_; |
430 bool enable_gnubby_auth_; | 430 bool gnubby_auth_policy_enabled_; |
| 431 bool gnubby_extension_supported_; |
431 | 432 |
432 // Boolean to change flow, where necessary, if we're | 433 // Boolean to change flow, where necessary, if we're |
433 // capturing a window instead of the entire desktop. | 434 // capturing a window instead of the entire desktop. |
434 bool enable_window_capture_; | 435 bool enable_window_capture_; |
435 | 436 |
436 // Used to specify which window to stream, if enabled. | 437 // Used to specify which window to stream, if enabled. |
437 webrtc::WindowId window_id_; | 438 webrtc::WindowId window_id_; |
438 | 439 |
439 // Must outlive |gcd_state_updater_| and |signaling_connector_|. | 440 // Must outlive |gcd_state_updater_| and |signaling_connector_|. |
440 scoped_ptr<OAuthTokenGetter> oauth_token_getter_; | 441 scoped_ptr<OAuthTokenGetter> oauth_token_getter_; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 state_(HOST_STARTING), | 485 state_(HOST_STARTING), |
485 use_service_account_(false), | 486 use_service_account_(false), |
486 enable_vp9_(false), | 487 enable_vp9_(false), |
487 frame_recorder_buffer_size_(0), | 488 frame_recorder_buffer_size_(0), |
488 policy_state_(POLICY_INITIALIZING), | 489 policy_state_(POLICY_INITIALIZING), |
489 host_username_match_required_(false), | 490 host_username_match_required_(false), |
490 allow_nat_traversal_(true), | 491 allow_nat_traversal_(true), |
491 allow_relay_(true), | 492 allow_relay_(true), |
492 allow_pairing_(true), | 493 allow_pairing_(true), |
493 curtain_required_(false), | 494 curtain_required_(false), |
494 enable_gnubby_auth_(false), | 495 gnubby_auth_policy_enabled_(false), |
| 496 gnubby_extension_supported_(false), |
495 enable_window_capture_(false), | 497 enable_window_capture_(false), |
496 window_id_(0), | 498 window_id_(0), |
497 self_(this), | 499 self_(this), |
498 exit_code_out_(exit_code_out), | 500 exit_code_out_(exit_code_out), |
499 signal_parent_(false), | 501 signal_parent_(false), |
500 shutdown_watchdog_(shutdown_watchdog) { | 502 shutdown_watchdog_(shutdown_watchdog) { |
501 StartOnUiThread(); | 503 StartOnUiThread(); |
502 } | 504 } |
503 | 505 |
504 HostProcess::~HostProcess() { | 506 HostProcess::~HostProcess() { |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 // AudioCapturerLinux to capture from it. | 881 // AudioCapturerLinux to capture from it. |
880 base::FilePath audio_pipe_name = base::CommandLine::ForCurrentProcess()-> | 882 base::FilePath audio_pipe_name = base::CommandLine::ForCurrentProcess()-> |
881 GetSwitchValuePath(kAudioPipeSwitchName); | 883 GetSwitchValuePath(kAudioPipeSwitchName); |
882 if (!audio_pipe_name.empty()) { | 884 if (!audio_pipe_name.empty()) { |
883 remoting::AudioCapturerLinux::InitializePipeReader( | 885 remoting::AudioCapturerLinux::InitializePipeReader( |
884 context_->audio_task_runner(), audio_pipe_name); | 886 context_->audio_task_runner(), audio_pipe_name); |
885 } | 887 } |
886 | 888 |
887 base::FilePath gnubby_socket_name = base::CommandLine::ForCurrentProcess()-> | 889 base::FilePath gnubby_socket_name = base::CommandLine::ForCurrentProcess()-> |
888 GetSwitchValuePath(kAuthSocknameSwitchName); | 890 GetSwitchValuePath(kAuthSocknameSwitchName); |
889 if (!gnubby_socket_name.empty()) | 891 if (!gnubby_socket_name.empty()) { |
890 remoting::GnubbyAuthHandler::SetGnubbySocketName(gnubby_socket_name); | 892 remoting::GnubbyAuthHandler::SetGnubbySocketName(gnubby_socket_name); |
| 893 gnubby_extension_supported_ = true; |
| 894 } |
891 #endif // defined(OS_LINUX) | 895 #endif // defined(OS_LINUX) |
892 | 896 |
893 // Create a desktop environment factory appropriate to the build type & | 897 // Create a desktop environment factory appropriate to the build type & |
894 // platform. | 898 // platform. |
895 #if defined(REMOTING_MULTI_PROCESS) | 899 #if defined(REMOTING_MULTI_PROCESS) |
896 IpcDesktopEnvironmentFactory* desktop_environment_factory = | 900 IpcDesktopEnvironmentFactory* desktop_environment_factory = |
897 new IpcDesktopEnvironmentFactory( | 901 new IpcDesktopEnvironmentFactory( |
898 context_->audio_task_runner(), context_->network_task_runner(), | 902 context_->audio_task_runner(), context_->network_task_runner(), |
899 context_->network_task_runner(), daemon_channel_.get()); | 903 context_->network_task_runner(), daemon_channel_.get()); |
900 desktop_session_connector_ = desktop_environment_factory; | 904 desktop_session_connector_ = desktop_environment_factory; |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 } else { | 1392 } else { |
1389 HOST_LOG << "Policy disables client pairing."; | 1393 HOST_LOG << "Policy disables client pairing."; |
1390 } | 1394 } |
1391 return true; | 1395 return true; |
1392 } | 1396 } |
1393 | 1397 |
1394 bool HostProcess::OnGnubbyAuthPolicyUpdate(base::DictionaryValue* policies) { | 1398 bool HostProcess::OnGnubbyAuthPolicyUpdate(base::DictionaryValue* policies) { |
1395 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); | 1399 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); |
1396 | 1400 |
1397 if (!policies->GetBoolean(policy::key::kRemoteAccessHostAllowGnubbyAuth, | 1401 if (!policies->GetBoolean(policy::key::kRemoteAccessHostAllowGnubbyAuth, |
1398 &enable_gnubby_auth_)) { | 1402 &gnubby_auth_policy_enabled_)) { |
1399 return false; | 1403 return false; |
1400 } | 1404 } |
1401 | 1405 |
1402 if (enable_gnubby_auth_) { | 1406 if (gnubby_auth_policy_enabled_) { |
1403 HOST_LOG << "Policy enables gnubby auth."; | 1407 HOST_LOG << "Policy enables gnubby auth."; |
1404 } else { | 1408 } else { |
1405 HOST_LOG << "Policy disables gnubby auth."; | 1409 HOST_LOG << "Policy disables gnubby auth."; |
1406 } | 1410 } |
1407 | 1411 |
1408 return true; | 1412 return true; |
1409 } | 1413 } |
1410 | 1414 |
1411 void HostProcess::InitializeSignaling() { | 1415 void HostProcess::InitializeSignaling() { |
1412 DCHECK(!host_id_.empty()); // ApplyConfig() should already have been run. | 1416 DCHECK(!host_id_.empty()); // ApplyConfig() should already have been run. |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 kEnableWebrtcSwitchName)) { | 1533 kEnableWebrtcSwitchName)) { |
1530 protocol_config->set_webrtc_supported(true); | 1534 protocol_config->set_webrtc_supported(true); |
1531 } | 1535 } |
1532 session_manager->set_protocol_config(std::move(protocol_config)); | 1536 session_manager->set_protocol_config(std::move(protocol_config)); |
1533 | 1537 |
1534 host_.reset(new ChromotingHost(desktop_environment_factory_.get(), | 1538 host_.reset(new ChromotingHost(desktop_environment_factory_.get(), |
1535 std::move(session_manager), transport_context, | 1539 std::move(session_manager), transport_context, |
1536 context_->audio_task_runner(), | 1540 context_->audio_task_runner(), |
1537 context_->video_encode_task_runner())); | 1541 context_->video_encode_task_runner())); |
1538 | 1542 |
1539 if (enable_gnubby_auth_) { | 1543 if (gnubby_auth_policy_enabled_ && gnubby_extension_supported_) { |
1540 host_->AddExtension(make_scoped_ptr(new GnubbyExtension())); | 1544 host_->AddExtension(make_scoped_ptr(new GnubbyExtension())); |
1541 } | 1545 } |
1542 | 1546 |
1543 if (frame_recorder_buffer_size_ > 0) { | 1547 if (frame_recorder_buffer_size_ > 0) { |
1544 scoped_ptr<VideoFrameRecorderHostExtension> frame_recorder_extension( | 1548 scoped_ptr<VideoFrameRecorderHostExtension> frame_recorder_extension( |
1545 new VideoFrameRecorderHostExtension()); | 1549 new VideoFrameRecorderHostExtension()); |
1546 frame_recorder_extension->SetMaxContentBytes(frame_recorder_buffer_size_); | 1550 frame_recorder_extension->SetMaxContentBytes(frame_recorder_buffer_size_); |
1547 host_->AddExtension(std::move(frame_recorder_extension)); | 1551 host_->AddExtension(std::move(frame_recorder_extension)); |
1548 } | 1552 } |
1549 | 1553 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); | 1745 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); |
1742 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); | 1746 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); |
1743 | 1747 |
1744 // Run the main (also UI) message loop until the host no longer needs it. | 1748 // Run the main (also UI) message loop until the host no longer needs it. |
1745 message_loop.Run(); | 1749 message_loop.Run(); |
1746 | 1750 |
1747 return exit_code; | 1751 return exit_code; |
1748 } | 1752 } |
1749 | 1753 |
1750 } // namespace remoting | 1754 } // namespace remoting |
OLD | NEW |