| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "remoting/host/it2me/it2me_host.h" | 5 #include "remoting/host/it2me/it2me_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
| 11 #include "net/socket/client_socket_factory.h" | 11 #include "net/socket/client_socket_factory.h" |
| 12 #include "net/url_request/url_request_context_getter.h" |
| 12 #include "policy/policy_constants.h" | 13 #include "policy/policy_constants.h" |
| 13 #include "remoting/base/auto_thread.h" | 14 #include "remoting/base/auto_thread.h" |
| 14 #include "remoting/base/logging.h" | 15 #include "remoting/base/logging.h" |
| 15 #include "remoting/base/rsa_key_pair.h" | 16 #include "remoting/base/rsa_key_pair.h" |
| 16 #include "remoting/host/chromoting_host.h" | 17 #include "remoting/host/chromoting_host.h" |
| 17 #include "remoting/host/chromoting_host_context.h" | 18 #include "remoting/host/chromoting_host_context.h" |
| 18 #include "remoting/host/host_event_logger.h" | 19 #include "remoting/host/host_event_logger.h" |
| 19 #include "remoting/host/host_secret.h" | 20 #include "remoting/host/host_secret.h" |
| 20 #include "remoting/host/host_status_logger.h" | 21 #include "remoting/host/host_status_logger.h" |
| 21 #include "remoting/host/it2me/it2me_confirmation_dialog.h" | 22 #include "remoting/host/it2me/it2me_confirmation_dialog.h" |
| 22 #include "remoting/host/it2me_desktop_environment.h" | 23 #include "remoting/host/it2me_desktop_environment.h" |
| 23 #include "remoting/host/policy_watcher.h" | 24 #include "remoting/host/policy_watcher.h" |
| 24 #include "remoting/host/register_support_host_request.h" | 25 #include "remoting/host/register_support_host_request.h" |
| 25 #include "remoting/host/session_manager_factory.h" | 26 #include "remoting/protocol/chromium_port_allocator.h" |
| 27 #include "remoting/protocol/ice_transport.h" |
| 26 #include "remoting/protocol/it2me_host_authenticator_factory.h" | 28 #include "remoting/protocol/it2me_host_authenticator_factory.h" |
| 29 #include "remoting/protocol/jingle_session_manager.h" |
| 27 #include "remoting/protocol/network_settings.h" | 30 #include "remoting/protocol/network_settings.h" |
| 31 #include "remoting/protocol/transport_context.h" |
| 28 #include "remoting/signaling/server_log_entry.h" | 32 #include "remoting/signaling/server_log_entry.h" |
| 29 | 33 |
| 30 namespace remoting { | 34 namespace remoting { |
| 31 | 35 |
| 32 namespace { | 36 namespace { |
| 33 | 37 |
| 34 // This is used for tagging system event logs. | 38 // This is used for tagging system event logs. |
| 35 const char kApplicationName[] = "chromoting"; | 39 const char kApplicationName[] = "chromoting"; |
| 36 const int kMaxLoginAttempts = 5; | 40 const int kMaxLoginAttempts = 5; |
| 37 | 41 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 nat_traversal_enabled_ ? | 224 nat_traversal_enabled_ ? |
| 221 protocol::NetworkSettings::NAT_TRAVERSAL_FULL : | 225 protocol::NetworkSettings::NAT_TRAVERSAL_FULL : |
| 222 protocol::NetworkSettings::NAT_TRAVERSAL_DISABLED); | 226 protocol::NetworkSettings::NAT_TRAVERSAL_DISABLED); |
| 223 if (!nat_traversal_enabled_) { | 227 if (!nat_traversal_enabled_) { |
| 224 network_settings.port_range.min_port = | 228 network_settings.port_range.min_port = |
| 225 protocol::NetworkSettings::kDefaultMinPort; | 229 protocol::NetworkSettings::kDefaultMinPort; |
| 226 network_settings.port_range.max_port = | 230 network_settings.port_range.max_port = |
| 227 protocol::NetworkSettings::kDefaultMaxPort; | 231 protocol::NetworkSettings::kDefaultMaxPort; |
| 228 } | 232 } |
| 229 | 233 |
| 230 scoped_ptr<protocol::SessionManager> session_manager = | 234 scoped_ptr<protocol::TransportFactory> transport_factory( |
| 231 CreateHostSessionManager(signal_strategy_.get(), network_settings, | 235 new protocol::IceTransportFactory(new protocol::TransportContext( |
| 232 host_context_->url_request_context_getter()); | 236 signal_strategy_.get(), |
| 237 make_scoped_ptr(new protocol::ChromiumPortAllocatorFactory( |
| 238 host_context_->url_request_context_getter())), |
| 239 network_settings, protocol::TransportRole::SERVER))); |
| 240 |
| 241 scoped_ptr<protocol::SessionManager> session_manager( |
| 242 new protocol::JingleSessionManager(transport_factory.Pass())); |
| 243 |
| 233 scoped_ptr<protocol::CandidateSessionConfig> protocol_config = | 244 scoped_ptr<protocol::CandidateSessionConfig> protocol_config = |
| 234 protocol::CandidateSessionConfig::CreateDefault(); | 245 protocol::CandidateSessionConfig::CreateDefault(); |
| 235 // Disable audio by default. | 246 // Disable audio by default. |
| 236 // TODO(sergeyu): Add UI to enable it. | 247 // TODO(sergeyu): Add UI to enable it. |
| 237 protocol_config->DisableAudioChannel(); | 248 protocol_config->DisableAudioChannel(); |
| 238 session_manager->set_protocol_config(protocol_config.Pass()); | 249 session_manager->set_protocol_config(protocol_config.Pass()); |
| 239 | 250 |
| 240 // Create the host. | 251 // Create the host. |
| 241 host_.reset(new ChromotingHost( | 252 host_.reset(new ChromotingHost( |
| 242 signal_strategy_.get(), desktop_environment_factory_.get(), | 253 signal_strategy_.get(), desktop_environment_factory_.get(), |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 scoped_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory( | 488 scoped_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory( |
| 478 new It2MeConfirmationDialogFactory()); | 489 new It2MeConfirmationDialogFactory()); |
| 479 scoped_ptr<PolicyWatcher> policy_watcher = | 490 scoped_ptr<PolicyWatcher> policy_watcher = |
| 480 PolicyWatcher::Create(policy_service_, context->file_task_runner()); | 491 PolicyWatcher::Create(policy_service_, context->file_task_runner()); |
| 481 return new It2MeHost(context.Pass(), policy_watcher.Pass(), | 492 return new It2MeHost(context.Pass(), policy_watcher.Pass(), |
| 482 confirmation_dialog_factory.Pass(), | 493 confirmation_dialog_factory.Pass(), |
| 483 observer, xmpp_server_config, directory_bot_jid); | 494 observer, xmpp_server_config, directory_bot_jid); |
| 484 } | 495 } |
| 485 | 496 |
| 486 } // namespace remoting | 497 } // namespace remoting |
| OLD | NEW |