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 | 8 |
9 #include <cstdint> | 9 #include <cstdint> |
10 #include <memory> | 10 #include <memory> |
(...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 // For legacy reasons we have to restrict the port range to a set of default | 1429 // For legacy reasons we have to restrict the port range to a set of default |
1430 // values when nat traversal is disabled, even if the port range was not | 1430 // values when nat traversal is disabled, even if the port range was not |
1431 // set in policy. | 1431 // set in policy. |
1432 network_settings.port_range.min_port = NetworkSettings::kDefaultMinPort; | 1432 network_settings.port_range.min_port = NetworkSettings::kDefaultMinPort; |
1433 network_settings.port_range.max_port = NetworkSettings::kDefaultMaxPort; | 1433 network_settings.port_range.max_port = NetworkSettings::kDefaultMaxPort; |
1434 } | 1434 } |
1435 | 1435 |
1436 scoped_refptr<protocol::TransportContext> transport_context = | 1436 scoped_refptr<protocol::TransportContext> transport_context = |
1437 new protocol::TransportContext( | 1437 new protocol::TransportContext( |
1438 signal_strategy_.get(), | 1438 signal_strategy_.get(), |
1439 base::WrapUnique(new protocol::ChromiumPortAllocatorFactory()), | 1439 base::MakeUnique<protocol::ChromiumPortAllocatorFactory>(), |
1440 base::WrapUnique(new ChromiumUrlRequestFactory( | 1440 base::MakeUnique<ChromiumUrlRequestFactory>( |
1441 context_->url_request_context_getter())), | 1441 context_->url_request_context_getter()), |
1442 network_settings, protocol::TransportRole::SERVER); | 1442 network_settings, protocol::TransportRole::SERVER); |
1443 transport_context->set_ice_config_url( | 1443 transport_context->set_ice_config_url( |
1444 ServiceUrls::GetInstance()->ice_config_url()); | 1444 ServiceUrls::GetInstance()->ice_config_url()); |
1445 | 1445 |
1446 std::unique_ptr<protocol::SessionManager> session_manager( | 1446 std::unique_ptr<protocol::SessionManager> session_manager( |
1447 new protocol::JingleSessionManager(signal_strategy_.get())); | 1447 new protocol::JingleSessionManager(signal_strategy_.get())); |
1448 | 1448 |
1449 std::unique_ptr<protocol::CandidateSessionConfig> protocol_config = | 1449 std::unique_ptr<protocol::CandidateSessionConfig> protocol_config = |
1450 protocol::CandidateSessionConfig::CreateDefault(); | 1450 protocol::CandidateSessionConfig::CreateDefault(); |
1451 if (!desktop_environment_factory_->SupportsAudioCapture()) | 1451 if (!desktop_environment_factory_->SupportsAudioCapture()) |
1452 protocol_config->DisableAudioChannel(); | 1452 protocol_config->DisableAudioChannel(); |
1453 if (enable_vp9_) | 1453 if (enable_vp9_) |
1454 protocol_config->set_vp9_experiment_enabled(true); | 1454 protocol_config->set_vp9_experiment_enabled(true); |
1455 protocol_config->set_webrtc_supported(true); | 1455 protocol_config->set_webrtc_supported(true); |
1456 session_manager->set_protocol_config(std::move(protocol_config)); | 1456 session_manager->set_protocol_config(std::move(protocol_config)); |
1457 | 1457 |
1458 host_.reset(new ChromotingHost(desktop_environment_factory_.get(), | 1458 host_.reset(new ChromotingHost(desktop_environment_factory_.get(), |
1459 std::move(session_manager), transport_context, | 1459 std::move(session_manager), transport_context, |
1460 context_->audio_task_runner(), | 1460 context_->audio_task_runner(), |
1461 context_->video_encode_task_runner())); | 1461 context_->video_encode_task_runner())); |
1462 | 1462 |
1463 if (security_key_auth_policy_enabled_ && security_key_extension_supported_) { | 1463 if (security_key_auth_policy_enabled_ && security_key_extension_supported_) { |
1464 host_->AddExtension(base::WrapUnique( | 1464 host_->AddExtension( |
1465 new SecurityKeyExtension(context_->file_task_runner()))); | 1465 base::MakeUnique<SecurityKeyExtension>(context_->file_task_runner())); |
1466 } | 1466 } |
1467 | 1467 |
1468 // TODO(simonmorris): Get the maximum session duration from a policy. | 1468 // TODO(simonmorris): Get the maximum session duration from a policy. |
1469 #if defined(OS_LINUX) | 1469 #if defined(OS_LINUX) |
1470 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); | 1470 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); |
1471 #endif | 1471 #endif |
1472 | 1472 |
1473 host_change_notification_listener_.reset(new HostChangeNotificationListener( | 1473 host_change_notification_listener_.reset(new HostChangeNotificationListener( |
1474 this, host_id_, signal_strategy_.get(), directory_bot_jid_)); | 1474 this, host_id_, signal_strategy_.get(), directory_bot_jid_)); |
1475 | 1475 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1666 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); | 1666 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); |
1667 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); | 1667 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); |
1668 | 1668 |
1669 // Run the main (also UI) message loop until the host no longer needs it. | 1669 // Run the main (also UI) message loop until the host no longer needs it. |
1670 message_loop.Run(); | 1670 message_loop.Run(); |
1671 | 1671 |
1672 return exit_code; | 1672 return exit_code; |
1673 } | 1673 } |
1674 | 1674 |
1675 } // namespace remoting | 1675 } // namespace remoting |
OLD | NEW |