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

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 indentation 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
« no previous file with comments | « remoting/host/plugin/host_script_object.h ('k') | remoting/host/simple_host_process.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/host_secret.h" 19 #include "remoting/host/host_secret.h"
20 #include "remoting/host/in_memory_host_config.h" 20 #include "remoting/host/in_memory_host_config.h"
21 #include "remoting/host/it2me_host_user_interface.h"
21 #include "remoting/host/plugin/host_log_handler.h" 22 #include "remoting/host/plugin/host_log_handler.h"
22 #include "remoting/host/plugin/policy_hack/nat_policy.h" 23 #include "remoting/host/plugin/policy_hack/nat_policy.h"
23 #include "remoting/host/register_support_host_request.h" 24 #include "remoting/host/register_support_host_request.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;
30 // readonly attribute string client; 31 // readonly attribute string client;
(...skipping 61 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 host_ = ChromotingHost::Create( 514 host_ = ChromotingHost::Create(
514 &host_context_, host_config_, desktop_environment_.get(), 515 &host_context_, host_config_, desktop_environment_.get(),
515 nat_traversal_enabled_); 516 nat_traversal_enabled_);
516 host_->AddStatusObserver(this); 517 host_->AddStatusObserver(this);
517 host_->AddStatusObserver(register_request_.get()); 518 host_->AddStatusObserver(register_request_.get());
518 if (enable_log_to_server_) { 519 if (enable_log_to_server_) {
519 log_to_server_.reset(new LogToServer(host_context_.network_message_loop())); 520 log_to_server_.reset(new LogToServer(host_context_.network_message_loop()));
520 host_->AddStatusObserver(log_to_server_.get()); 521 host_->AddStatusObserver(log_to_server_.get());
521 } 522 }
522 host_->set_it2me(true); 523 host_->set_it2me(true);
524 it2me_host_user_interface_.reset(new It2MeHostUserInterface(host_.get(),
525 &host_context_));
526 it2me_host_user_interface_->Init();
527 host_->AddStatusObserver(it2me_host_user_interface_.get());
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
532 SetState(kRequestedAccessCode); 537 SetState(kRequestedAccessCode);
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 uint32_t argCount) { 842 uint32_t argCount) {
838 NPVariant np_result; 843 NPVariant np_result;
839 bool is_good = g_npnetscape_funcs->invokeDefault(plugin_, func, args, 844 bool is_good = g_npnetscape_funcs->invokeDefault(plugin_, func, args,
840 argCount, &np_result); 845 argCount, &np_result);
841 if (is_good) 846 if (is_good)
842 g_npnetscape_funcs->releasevariantvalue(&np_result); 847 g_npnetscape_funcs->releasevariantvalue(&np_result);
843 return is_good; 848 return is_good;
844 } 849 }
845 850
846 } // namespace remoting 851 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/plugin/host_script_object.h ('k') | remoting/host/simple_host_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698