| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 parent_(parent), | 85 parent_(parent), |
| 86 state_(kDisconnected), | 86 state_(kDisconnected), |
| 87 np_thread_id_(base::PlatformThread::CurrentId()), | 87 np_thread_id_(base::PlatformThread::CurrentId()), |
| 88 plugin_message_loop_proxy_( | 88 plugin_message_loop_proxy_( |
| 89 new PluginMessageLoopProxy(plugin_thread_delegate)), | 89 new PluginMessageLoopProxy(plugin_thread_delegate)), |
| 90 host_context_(plugin_message_loop_proxy_), | 90 host_context_(plugin_message_loop_proxy_), |
| 91 failed_login_attempts_(0), | 91 failed_login_attempts_(0), |
| 92 disconnected_event_(true, false), | 92 disconnected_event_(true, false), |
| 93 am_currently_logging_(false), | 93 am_currently_logging_(false), |
| 94 nat_traversal_enabled_(false), | 94 nat_traversal_enabled_(false), |
| 95 policy_received_(false) { | 95 policy_received_(false), |
| 96 enable_log_to_server_(false) { |
| 96 } | 97 } |
| 97 | 98 |
| 98 HostNPScriptObject::~HostNPScriptObject() { | 99 HostNPScriptObject::~HostNPScriptObject() { |
| 99 CHECK_EQ(base::PlatformThread::CurrentId(), np_thread_id_); | 100 CHECK_EQ(base::PlatformThread::CurrentId(), np_thread_id_); |
| 100 | 101 |
| 101 // Shutdown DesktopEnvironment first so that it doesn't try to post | 102 // Shutdown DesktopEnvironment first so that it doesn't try to post |
| 102 // tasks on the UI thread while we are stopping the host. | 103 // tasks on the UI thread while we are stopping the host. |
| 103 if (desktop_environment_.get()) { | 104 if (desktop_environment_.get()) { |
| 104 desktop_environment_->Shutdown(); | 105 desktop_environment_->Shutdown(); |
| 105 } | 106 } |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 host_config_ = host_config; | 513 host_config_ = host_config; |
| 513 register_request_.reset(register_request.release()); | 514 register_request_.reset(register_request.release()); |
| 514 | 515 |
| 515 // Create the Host. | 516 // Create the Host. |
| 516 LOG(INFO) << "NAT state: " << nat_traversal_enabled_; | 517 LOG(INFO) << "NAT state: " << nat_traversal_enabled_; |
| 517 host_ = ChromotingHost::Create( | 518 host_ = ChromotingHost::Create( |
| 518 &host_context_, host_config_, desktop_environment_.get(), | 519 &host_context_, host_config_, desktop_environment_.get(), |
| 519 access_verifier.release(), nat_traversal_enabled_); | 520 access_verifier.release(), nat_traversal_enabled_); |
| 520 host_->AddStatusObserver(this); | 521 host_->AddStatusObserver(this); |
| 521 host_->AddStatusObserver(register_request_.get()); | 522 host_->AddStatusObserver(register_request_.get()); |
| 523 if (enable_log_to_server_) { |
| 524 log_to_server_.reset(new LogToServer(host_context_.network_message_loop())); |
| 525 host_->AddStatusObserver(log_to_server_.get()); |
| 526 } |
| 522 host_->set_it2me(true); | 527 host_->set_it2me(true); |
| 523 | 528 |
| 524 { | 529 { |
| 525 base::AutoLock auto_lock(ui_strings_lock_); | 530 base::AutoLock auto_lock(ui_strings_lock_); |
| 526 host_->SetUiStrings(ui_strings_); | 531 host_->SetUiStrings(ui_strings_); |
| 527 } | 532 } |
| 528 | 533 |
| 529 // Start the Host. | 534 // Start the Host. |
| 530 host_->Start(); | 535 host_->Start(); |
| 531 | 536 |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 uint32_t argCount) { | 843 uint32_t argCount) { |
| 839 NPVariant np_result; | 844 NPVariant np_result; |
| 840 bool is_good = g_npnetscape_funcs->invokeDefault(plugin_, func, args, | 845 bool is_good = g_npnetscape_funcs->invokeDefault(plugin_, func, args, |
| 841 argCount, &np_result); | 846 argCount, &np_result); |
| 842 if (is_good) | 847 if (is_good) |
| 843 g_npnetscape_funcs->releasevariantvalue(&np_result); | 848 g_npnetscape_funcs->releasevariantvalue(&np_result); |
| 844 return is_good; | 849 return is_good; |
| 845 } | 850 } |
| 846 | 851 |
| 847 } // namespace remoting | 852 } // namespace remoting |
| OLD | NEW |