Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: remoting/host/plugin/host_script_object.cc

Issue 8725016: Refactor IT2Me-specific functions into a HostObserver subclass. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix other nits. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/threading/platform_thread.h" 11 #include "base/threading/platform_thread.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "remoting/base/auth_token_util.h" 13 #include "remoting/base/auth_token_util.h"
14 #include "remoting/host/chromoting_host.h" 14 #include "remoting/host/chromoting_host.h"
15 #include "remoting/host/chromoting_host_context.h" 15 #include "remoting/host/chromoting_host_context.h"
16 #include "remoting/host/desktop_environment.h" 16 #include "remoting/host/desktop_environment.h"
17 #include "remoting/host/host_config.h" 17 #include "remoting/host/host_config.h"
18 #include "remoting/host/host_key_pair.h" 18 #include "remoting/host/host_key_pair.h"
19 #include "remoting/host/in_memory_host_config.h" 19 #include "remoting/host/in_memory_host_config.h"
20 #include "remoting/host/it2me_host_user_interface.h"
20 #include "remoting/host/plugin/host_log_handler.h" 21 #include "remoting/host/plugin/host_log_handler.h"
21 #include "remoting/host/plugin/policy_hack/nat_policy.h" 22 #include "remoting/host/plugin/policy_hack/nat_policy.h"
22 #include "remoting/host/register_support_host_request.h" 23 #include "remoting/host/register_support_host_request.h"
23 #include "remoting/host/support_access_verifier.h" 24 #include "remoting/host/support_access_verifier.h"
24 25
25 namespace remoting { 26 namespace remoting {
26 27
27 // Supported Javascript interface: 28 // Supported Javascript interface:
28 // readonly attribute string accessCode; 29 // readonly attribute string accessCode;
29 // readonly attribute int accessCodeLifetime; 30 // readonly attribute int accessCodeLifetime;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 disconnected_event_(true, false), 93 disconnected_event_(true, false),
93 am_currently_logging_(false), 94 am_currently_logging_(false),
94 nat_traversal_enabled_(false), 95 nat_traversal_enabled_(false),
95 policy_received_(false), 96 policy_received_(false),
96 enable_log_to_server_(false) { 97 enable_log_to_server_(false) {
97 } 98 }
98 99
99 HostNPScriptObject::~HostNPScriptObject() { 100 HostNPScriptObject::~HostNPScriptObject() {
100 CHECK_EQ(base::PlatformThread::CurrentId(), np_thread_id_); 101 CHECK_EQ(base::PlatformThread::CurrentId(), np_thread_id_);
101 102
102 // Shutdown DesktopEnvironment first so that it doesn't try to post 103 // Shutdown It2MeHostUserInterface first so that it doesn't try to post
103 // tasks on the UI thread while we are stopping the host. 104 // tasks on the UI thread while we are stopping the host.
104 if (desktop_environment_.get()) { 105 if (it2me_host_user_interface_.get()) {
105 desktop_environment_->Shutdown(); 106 it2me_host_user_interface_->Shutdown();
106 } 107 }
107 108
108 HostLogHandler::UnregisterLoggingScriptObject(this); 109 HostLogHandler::UnregisterLoggingScriptObject(this);
109 110
110 plugin_message_loop_proxy_->Detach(); 111 plugin_message_loop_proxy_->Detach();
111 112
112 // Stop listening for policy updates. 113 // Stop listening for policy updates.
113 if (nat_policy_.get()) { 114 if (nat_policy_.get()) {
114 base::WaitableEvent nat_policy_stopped_(true, false); 115 base::WaitableEvent nat_policy_stopped_(true, false);
115 nat_policy_->StopWatching(&nat_policy_stopped_); 116 nat_policy_->StopWatching(&nat_policy_stopped_);
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 host_ = ChromotingHost::Create( 519 host_ = ChromotingHost::Create(
519 &host_context_, host_config_, desktop_environment_.get(), 520 &host_context_, host_config_, desktop_environment_.get(),
520 access_verifier.release(), nat_traversal_enabled_); 521 access_verifier.release(), nat_traversal_enabled_);
521 host_->AddStatusObserver(this); 522 host_->AddStatusObserver(this);
522 host_->AddStatusObserver(register_request_.get()); 523 host_->AddStatusObserver(register_request_.get());
523 if (enable_log_to_server_) { 524 if (enable_log_to_server_) {
524 log_to_server_.reset(new LogToServer(host_context_.network_message_loop())); 525 log_to_server_.reset(new LogToServer(host_context_.network_message_loop()));
525 host_->AddStatusObserver(log_to_server_.get()); 526 host_->AddStatusObserver(log_to_server_.get());
526 } 527 }
527 host_->set_it2me(true); 528 host_->set_it2me(true);
529 it2me_host_user_interface_.reset(new It2MeHostUserInterface(host_.get(),
530 &host_context_));
531 it2me_host_user_interface_->Init();
532 host_->AddStatusObserver(it2me_host_user_interface_.get());
528 533
529 { 534 {
530 base::AutoLock auto_lock(ui_strings_lock_); 535 base::AutoLock auto_lock(ui_strings_lock_);
531 host_->SetUiStrings(ui_strings_); 536 host_->SetUiStrings(ui_strings_);
532 } 537 }
533 538
534 // Start the Host. 539 // Start the Host.
535 host_->Start(); 540 host_->Start();
536 541
537 SetState(kRequestedAccessCode); 542 SetState(kRequestedAccessCode);
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 uint32_t argCount) { 848 uint32_t argCount) {
844 NPVariant np_result; 849 NPVariant np_result;
845 bool is_good = g_npnetscape_funcs->invokeDefault(plugin_, func, args, 850 bool is_good = g_npnetscape_funcs->invokeDefault(plugin_, func, args,
846 argCount, &np_result); 851 argCount, &np_result);
847 if (is_good) 852 if (is_good)
848 g_npnetscape_funcs->releasevariantvalue(&np_result); 853 g_npnetscape_funcs->releasevariantvalue(&np_result);
849 return is_good; 854 return is_good;
850 } 855 }
851 856
852 } // namespace remoting 857 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698