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

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

Issue 8468015: The host sends simple log entries to the server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review. Created 9 years, 1 month 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"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 desktop_environment_.reset(DesktopEnvironment::Create(&host_context_)); 506 desktop_environment_.reset(DesktopEnvironment::Create(&host_context_));
506 if (desktop_environment_.get() == NULL) { 507 if (desktop_environment_.get() == NULL) {
507 SetState(kError); 508 SetState(kError);
508 return; 509 return;
509 } 510 }
510 511
511 // Beyond this point nothing can fail, so save the config and request. 512 // Beyond this point nothing can fail, so save the config and request.
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
516 if (enable_log_to_server_) {
Sergey Ulanov 2011/11/22 02:01:43 nit: please remove brackets for consistency with o
simonmorris 2011/11/22 23:27:35 Merged with another if, so braces are now needed.
517 log_to_server_.reset(new LogToServer(host_context_.network_message_loop()));
518 }
519
515 // Create the Host. 520 // Create the Host.
516 LOG(INFO) << "NAT state: " << nat_traversal_enabled_; 521 LOG(INFO) << "NAT state: " << nat_traversal_enabled_;
517 host_ = ChromotingHost::Create( 522 host_ = ChromotingHost::Create(
518 &host_context_, host_config_, desktop_environment_.get(), 523 &host_context_, host_config_, desktop_environment_.get(),
519 access_verifier.release(), nat_traversal_enabled_); 524 access_verifier.release(), nat_traversal_enabled_);
520 host_->AddStatusObserver(this); 525 host_->AddStatusObserver(this);
521 host_->AddStatusObserver(register_request_.get()); 526 host_->AddStatusObserver(register_request_.get());
527 if (log_to_server_.get()) {
Sergey Ulanov 2011/11/22 02:01:43 nit: I think you can merge this if and the previou
simonmorris 2011/11/22 23:27:35 Done.
528 host_->AddStatusObserver(log_to_server_.get());
529 }
522 host_->set_it2me(true); 530 host_->set_it2me(true);
523 531
524 { 532 {
525 base::AutoLock auto_lock(ui_strings_lock_); 533 base::AutoLock auto_lock(ui_strings_lock_);
526 host_->SetUiStrings(ui_strings_); 534 host_->SetUiStrings(ui_strings_);
527 } 535 }
528 536
529 // Start the Host. 537 // Start the Host.
530 host_->Start(); 538 host_->Start();
531 539
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 uint32_t argCount) { 846 uint32_t argCount) {
839 NPVariant np_result; 847 NPVariant np_result;
840 bool is_good = g_npnetscape_funcs->invokeDefault(plugin_, func, args, 848 bool is_good = g_npnetscape_funcs->invokeDefault(plugin_, func, args,
841 argCount, &np_result); 849 argCount, &np_result);
842 if (is_good) 850 if (is_good)
843 g_npnetscape_funcs->releasevariantvalue(&np_result); 851 g_npnetscape_funcs->releasevariantvalue(&np_result);
844 return is_good; 852 return is_good;
845 } 853 }
846 854
847 } // namespace remoting 855 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698