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 #include "remoting/host/plugin/host_script_object.h" | 5 #include "remoting/host/plugin/host_script_object.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
14 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "base/threading/platform_thread.h" | 16 #include "base/threading/platform_thread.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "net/base/net_util.h" | 18 #include "net/base/net_util.h" |
19 #include "remoting/base/auth_token_util.h" | 19 #include "remoting/base/auth_token_util.h" |
20 #include "remoting/base/auto_thread.h" | 20 #include "remoting/base/auto_thread.h" |
21 #include "remoting/base/rsa_key_pair.h" | 21 #include "remoting/base/rsa_key_pair.h" |
22 #include "remoting/host/chromoting_host.h" | 22 #include "remoting/host/chromoting_host.h" |
23 #include "remoting/host/chromoting_host_context.h" | 23 #include "remoting/host/chromoting_host_context.h" |
24 #include "remoting/host/host_config.h" | 24 #include "remoting/host/host_config.h" |
25 #include "remoting/host/host_event_logger.h" | 25 #include "remoting/host/host_event_logger.h" |
26 #include "remoting/host/host_secret.h" | 26 #include "remoting/host/host_secret.h" |
27 #include "remoting/host/host_status_observer.h" | 27 #include "remoting/host/host_status_observer.h" |
28 #include "remoting/host/it2me_desktop_environment.h" | 28 #include "remoting/host/it2me_desktop_environment.h" |
29 #include "remoting/host/network_settings.h" | |
30 #include "remoting/host/pin_hash.h" | 29 #include "remoting/host/pin_hash.h" |
31 #include "remoting/host/plugin/host_log_handler.h" | 30 #include "remoting/host/plugin/host_log_handler.h" |
32 #include "remoting/host/policy_hack/policy_watcher.h" | 31 #include "remoting/host/policy_hack/policy_watcher.h" |
33 #include "remoting/host/register_support_host_request.h" | 32 #include "remoting/host/register_support_host_request.h" |
34 #include "remoting/host/service_urls.h" | 33 #include "remoting/host/service_urls.h" |
35 #include "remoting/host/session_manager_factory.h" | |
36 #include "remoting/jingle_glue/xmpp_signal_strategy.h" | 34 #include "remoting/jingle_glue/xmpp_signal_strategy.h" |
37 #include "remoting/protocol/it2me_host_authenticator_factory.h" | 35 #include "remoting/protocol/it2me_host_authenticator_factory.h" |
| 36 #include "remoting/protocol/network_settings.h" |
| 37 #include "remoting/protocol/session_manager_factory.h" |
38 #include "third_party/npapi/bindings/npruntime.h" | 38 #include "third_party/npapi/bindings/npruntime.h" |
39 | 39 |
40 namespace remoting { | 40 namespace remoting { |
41 | 41 |
42 namespace { | 42 namespace { |
43 | 43 |
44 // This is used for tagging system event logs. | 44 // This is used for tagging system event logs. |
45 const char kApplicationName[] = "chromoting"; | 45 const char kApplicationName[] = "chromoting"; |
46 | 46 |
47 const char* kAttrNameAccessCode = "accessCode"; | 47 const char* kAttrNameAccessCode = "accessCode"; |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 signal_strategy.get(), host_key_pair_, directory_bot_jid_, | 354 signal_strategy.get(), host_key_pair_, directory_bot_jid_, |
355 base::Bind(&It2MeImpl::OnReceivedSupportID, | 355 base::Bind(&It2MeImpl::OnReceivedSupportID, |
356 base::Unretained(this)))); | 356 base::Unretained(this)))); |
357 | 357 |
358 // Beyond this point nothing can fail, so save the config and request. | 358 // Beyond this point nothing can fail, so save the config and request. |
359 signal_strategy_ = signal_strategy.Pass(); | 359 signal_strategy_ = signal_strategy.Pass(); |
360 register_request_ = register_request.Pass(); | 360 register_request_ = register_request.Pass(); |
361 | 361 |
362 // If NAT traversal is off then limit port range to allow firewall pin-holing. | 362 // If NAT traversal is off then limit port range to allow firewall pin-holing. |
363 LOG(INFO) << "NAT state: " << nat_traversal_enabled_; | 363 LOG(INFO) << "NAT state: " << nat_traversal_enabled_; |
364 NetworkSettings network_settings( | 364 protocol::NetworkSettings network_settings( |
365 nat_traversal_enabled_ ? | 365 nat_traversal_enabled_ ? |
366 NetworkSettings::NAT_TRAVERSAL_ENABLED : | 366 protocol::NetworkSettings::NAT_TRAVERSAL_ENABLED : |
367 NetworkSettings::NAT_TRAVERSAL_DISABLED); | 367 protocol::NetworkSettings::NAT_TRAVERSAL_DISABLED); |
368 if (!nat_traversal_enabled_) { | 368 if (!nat_traversal_enabled_) { |
369 network_settings.min_port = NetworkSettings::kDefaultMinPort; | 369 network_settings.min_port = protocol::NetworkSettings::kDefaultMinPort; |
370 network_settings.max_port = NetworkSettings::kDefaultMaxPort; | 370 network_settings.max_port = protocol::NetworkSettings::kDefaultMaxPort; |
371 } | 371 } |
372 | 372 |
373 // Create the host. | 373 // Create the host. |
374 host_.reset(new ChromotingHost( | 374 host_.reset(new ChromotingHost( |
375 signal_strategy_.get(), | 375 signal_strategy_.get(), |
376 desktop_environment_factory_.get(), | 376 desktop_environment_factory_.get(), |
377 CreateHostSessionManager(network_settings, | 377 protocol::CreateNativeSessionManager(network_settings, |
378 host_context_->url_request_context_getter()), | 378 host_context_->url_request_context_getter()), |
379 host_context_->audio_task_runner(), | 379 host_context_->audio_task_runner(), |
380 host_context_->input_task_runner(), | 380 host_context_->input_task_runner(), |
381 host_context_->video_capture_task_runner(), | 381 host_context_->video_capture_task_runner(), |
382 host_context_->video_encode_task_runner(), | 382 host_context_->video_encode_task_runner(), |
383 host_context_->network_task_runner(), | 383 host_context_->network_task_runner(), |
384 host_context_->ui_task_runner())); | 384 host_context_->ui_task_runner())); |
385 host_->AddStatusObserver(this); | 385 host_->AddStatusObserver(this); |
386 log_to_server_.reset( | 386 log_to_server_.reset( |
387 new LogToServer(host_->AsWeakPtr(), ServerLogEntry::IT2ME, | 387 new LogToServer(host_->AsWeakPtr(), ServerLogEntry::IT2ME, |
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1582 } | 1582 } |
1583 | 1583 |
1584 void HostNPScriptObject::SetException(const std::string& exception_string) { | 1584 void HostNPScriptObject::SetException(const std::string& exception_string) { |
1585 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); | 1585 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); |
1586 | 1586 |
1587 g_npnetscape_funcs->setexception(parent_, exception_string.c_str()); | 1587 g_npnetscape_funcs->setexception(parent_, exception_string.c_str()); |
1588 LOG(INFO) << exception_string; | 1588 LOG(INFO) << exception_string; |
1589 } | 1589 } |
1590 | 1590 |
1591 } // namespace remoting | 1591 } // namespace remoting |
OLD | NEW |