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 <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 skip_gnubby_extension_creation_; | |
|
Lambros
2016/02/18 01:02:39
Optional: Maybe better to invert the meaning and c
joedow
2016/02/18 02:24:37
That's a good point, I was originally thinking I w
| |
| 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 skip_gnubby_extension_creation_(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 } else { | |
| 894 // No socket name means no gnubby support. | |
| 895 skip_gnubby_extension_creation_ = true; | |
| 896 } | |
| 891 #endif // defined(OS_LINUX) | 897 #endif // defined(OS_LINUX) |
| 892 | 898 |
| 893 // Create a desktop environment factory appropriate to the build type & | 899 // Create a desktop environment factory appropriate to the build type & |
| 894 // platform. | 900 // platform. |
| 895 #if defined(REMOTING_MULTI_PROCESS) | 901 #if defined(REMOTING_MULTI_PROCESS) |
| 896 IpcDesktopEnvironmentFactory* desktop_environment_factory = | 902 IpcDesktopEnvironmentFactory* desktop_environment_factory = |
| 897 new IpcDesktopEnvironmentFactory( | 903 new IpcDesktopEnvironmentFactory( |
| 898 context_->audio_task_runner(), context_->network_task_runner(), | 904 context_->audio_task_runner(), context_->network_task_runner(), |
| 899 context_->network_task_runner(), daemon_channel_.get()); | 905 context_->network_task_runner(), daemon_channel_.get()); |
| 900 desktop_session_connector_ = desktop_environment_factory; | 906 desktop_session_connector_ = desktop_environment_factory; |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1388 } else { | 1394 } else { |
| 1389 HOST_LOG << "Policy disables client pairing."; | 1395 HOST_LOG << "Policy disables client pairing."; |
| 1390 } | 1396 } |
| 1391 return true; | 1397 return true; |
| 1392 } | 1398 } |
| 1393 | 1399 |
| 1394 bool HostProcess::OnGnubbyAuthPolicyUpdate(base::DictionaryValue* policies) { | 1400 bool HostProcess::OnGnubbyAuthPolicyUpdate(base::DictionaryValue* policies) { |
| 1395 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); | 1401 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); |
| 1396 | 1402 |
| 1397 if (!policies->GetBoolean(policy::key::kRemoteAccessHostAllowGnubbyAuth, | 1403 if (!policies->GetBoolean(policy::key::kRemoteAccessHostAllowGnubbyAuth, |
| 1398 &enable_gnubby_auth_)) { | 1404 &gnubby_auth_policy_enabled_)) { |
| 1399 return false; | 1405 return false; |
| 1400 } | 1406 } |
| 1401 | 1407 |
| 1402 if (enable_gnubby_auth_) { | 1408 if (gnubby_auth_policy_enabled_) { |
| 1403 HOST_LOG << "Policy enables gnubby auth."; | 1409 HOST_LOG << "Policy enables gnubby auth."; |
| 1404 } else { | 1410 } else { |
| 1405 HOST_LOG << "Policy disables gnubby auth."; | 1411 HOST_LOG << "Policy disables gnubby auth."; |
| 1406 } | 1412 } |
| 1407 | 1413 |
| 1408 return true; | 1414 return true; |
| 1409 } | 1415 } |
| 1410 | 1416 |
| 1411 void HostProcess::InitializeSignaling() { | 1417 void HostProcess::InitializeSignaling() { |
| 1412 DCHECK(!host_id_.empty()); // ApplyConfig() should already have been run. | 1418 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)) { | 1535 kEnableWebrtcSwitchName)) { |
| 1530 protocol_config->set_webrtc_supported(true); | 1536 protocol_config->set_webrtc_supported(true); |
| 1531 } | 1537 } |
| 1532 session_manager->set_protocol_config(std::move(protocol_config)); | 1538 session_manager->set_protocol_config(std::move(protocol_config)); |
| 1533 | 1539 |
| 1534 host_.reset(new ChromotingHost(desktop_environment_factory_.get(), | 1540 host_.reset(new ChromotingHost(desktop_environment_factory_.get(), |
| 1535 std::move(session_manager), transport_context, | 1541 std::move(session_manager), transport_context, |
| 1536 context_->audio_task_runner(), | 1542 context_->audio_task_runner(), |
| 1537 context_->video_encode_task_runner())); | 1543 context_->video_encode_task_runner())); |
| 1538 | 1544 |
| 1539 if (enable_gnubby_auth_) { | 1545 if (gnubby_auth_policy_enabled_ && !skip_gnubby_extension_creation_) { |
| 1540 host_->AddExtension(make_scoped_ptr(new GnubbyExtension())); | 1546 host_->AddExtension(make_scoped_ptr(new GnubbyExtension())); |
| 1541 } | 1547 } |
| 1542 | 1548 |
| 1543 if (frame_recorder_buffer_size_ > 0) { | 1549 if (frame_recorder_buffer_size_ > 0) { |
| 1544 scoped_ptr<VideoFrameRecorderHostExtension> frame_recorder_extension( | 1550 scoped_ptr<VideoFrameRecorderHostExtension> frame_recorder_extension( |
| 1545 new VideoFrameRecorderHostExtension()); | 1551 new VideoFrameRecorderHostExtension()); |
| 1546 frame_recorder_extension->SetMaxContentBytes(frame_recorder_buffer_size_); | 1552 frame_recorder_extension->SetMaxContentBytes(frame_recorder_buffer_size_); |
| 1547 host_->AddExtension(std::move(frame_recorder_extension)); | 1553 host_->AddExtension(std::move(frame_recorder_extension)); |
| 1548 } | 1554 } |
| 1549 | 1555 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1741 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); | 1747 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); |
| 1742 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); | 1748 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); |
| 1743 | 1749 |
| 1744 // Run the main (also UI) message loop until the host no longer needs it. | 1750 // Run the main (also UI) message loop until the host no longer needs it. |
| 1745 message_loop.Run(); | 1751 message_loop.Run(); |
| 1746 | 1752 |
| 1747 return exit_code; | 1753 return exit_code; |
| 1748 } | 1754 } |
| 1749 | 1755 |
| 1750 } // namespace remoting | 1756 } // namespace remoting |
| OLD | NEW |