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

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

Issue 10384127: Chromoting: the Me2me host now presents a notification on the console allowing a user to disconnect… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Unix-line endings. The license text. Created 8 years, 7 months 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_plugin_resource.h ('k') | remoting/host/remoting_me2me_host.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) 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"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 daemon_controller_(DaemonController::Create()), 91 daemon_controller_(DaemonController::Create()),
92 worker_thread_("RemotingHostPlugin") { 92 worker_thread_("RemotingHostPlugin") {
93 worker_thread_.Start(); 93 worker_thread_.Start();
94 } 94 }
95 95
96 HostNPScriptObject::~HostNPScriptObject() { 96 HostNPScriptObject::~HostNPScriptObject() {
97 CHECK_EQ(base::PlatformThread::CurrentId(), np_thread_id_); 97 CHECK_EQ(base::PlatformThread::CurrentId(), np_thread_id_);
98 98
99 // Shutdown It2MeHostUserInterface first so that it doesn't try to post 99 // Shutdown It2MeHostUserInterface first so that it doesn't try to post
100 // tasks on the UI thread while we are stopping the host. 100 // tasks on the UI thread while we are stopping the host.
101 if (it2me_host_user_interface_.get()) { 101 it2me_host_user_interface_.reset();
102 it2me_host_user_interface_->Shutdown();
103 }
104 102
105 HostLogHandler::UnregisterLoggingScriptObject(this); 103 HostLogHandler::UnregisterLoggingScriptObject(this);
106 104
107 plugin_message_loop_proxy_->Detach(); 105 plugin_message_loop_proxy_->Detach();
108 106
109 // Stop listening for policy updates. 107 // Stop listening for policy updates.
110 if (nat_policy_.get()) { 108 if (nat_policy_.get()) {
111 base::WaitableEvent nat_policy_stopped_(true, false); 109 base::WaitableEvent nat_policy_stopped_(true, false);
112 nat_policy_->StopWatching(&nat_policy_stopped_); 110 nat_policy_->StopWatching(&nat_policy_stopped_);
113 nat_policy_stopped_.Wait(); 111 nat_policy_stopped_.Wait();
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 // Create the Host. 552 // Create the Host.
555 LOG(INFO) << "NAT state: " << nat_traversal_enabled_; 553 LOG(INFO) << "NAT state: " << nat_traversal_enabled_;
556 host_ = new ChromotingHost( 554 host_ = new ChromotingHost(
557 host_context_.get(), signal_strategy_.get(), desktop_environment_.get(), 555 host_context_.get(), signal_strategy_.get(), desktop_environment_.get(),
558 NetworkSettings(nat_traversal_enabled_ ? 556 NetworkSettings(nat_traversal_enabled_ ?
559 NetworkSettings::NAT_TRAVERSAL_ENABLED : 557 NetworkSettings::NAT_TRAVERSAL_ENABLED :
560 NetworkSettings::NAT_TRAVERSAL_DISABLED)); 558 NetworkSettings::NAT_TRAVERSAL_DISABLED));
561 host_->AddStatusObserver(this); 559 host_->AddStatusObserver(this);
562 log_to_server_.reset( 560 log_to_server_.reset(
563 new LogToServer(host_, ServerLogEntry::IT2ME, signal_strategy_.get())); 561 new LogToServer(host_, ServerLogEntry::IT2ME, signal_strategy_.get()));
562 base::Closure disconnect_callback = base::Bind(
563 &ChromotingHost::Shutdown, base::Unretained(host_.get()),
564 base::Closure());
564 it2me_host_user_interface_.reset( 565 it2me_host_user_interface_.reset(
565 new It2MeHostUserInterface(host_.get(), host_context_.get())); 566 new It2MeHostUserInterface(host_context_.get()));
566 it2me_host_user_interface_->Init(); 567 it2me_host_user_interface_->Start(host_.get(), disconnect_callback);
567 568
568 { 569 {
569 base::AutoLock auto_lock(ui_strings_lock_); 570 base::AutoLock auto_lock(ui_strings_lock_);
570 host_->SetUiStrings(ui_strings_); 571 host_->SetUiStrings(ui_strings_);
571 } 572 }
572 573
573 signal_strategy_->Connect(); 574 signal_strategy_->Connect();
574 host_->Start(); 575 host_->Start();
575 576
576 SetState(kRequestedAccessCode); 577 SetState(kRequestedAccessCode);
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 return is_good; 1160 return is_good;
1160 } 1161 }
1161 1162
1162 void HostNPScriptObject::SetException(const std::string& exception_string) { 1163 void HostNPScriptObject::SetException(const std::string& exception_string) {
1163 DCHECK(plugin_message_loop_proxy_->BelongsToCurrentThread()); 1164 DCHECK(plugin_message_loop_proxy_->BelongsToCurrentThread());
1164 g_npnetscape_funcs->setexception(parent_, exception_string.c_str()); 1165 g_npnetscape_funcs->setexception(parent_, exception_string.c_str());
1165 LOG(INFO) << exception_string; 1166 LOG(INFO) << exception_string;
1166 } 1167 }
1167 1168
1168 } // namespace remoting 1169 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/plugin/host_plugin_resource.h ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698