OLD | NEW |
---|---|
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" |
11 #include "base/message_loop_proxy.h" | 11 #include "base/message_loop_proxy.h" |
12 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
13 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "net/base/net_util.h" | 16 #include "net/base/net_util.h" |
17 #include "remoting/base/auth_token_util.h" | 17 #include "remoting/base/auth_token_util.h" |
18 #include "remoting/host/chromoting_host.h" | 18 #include "remoting/host/chromoting_host.h" |
19 #include "remoting/host/chromoting_host_context.h" | 19 #include "remoting/host/chromoting_host_context.h" |
20 #include "remoting/host/desktop_environment.h" | 20 #include "remoting/host/desktop_environment.h" |
21 #include "remoting/host/host_config.h" | 21 #include "remoting/host/host_config.h" |
22 #include "remoting/host/host_event_logger.h" | |
22 #include "remoting/host/host_key_pair.h" | 23 #include "remoting/host/host_key_pair.h" |
23 #include "remoting/host/host_secret.h" | 24 #include "remoting/host/host_secret.h" |
24 #include "remoting/host/it2me_host_user_interface.h" | 25 #include "remoting/host/it2me_host_user_interface.h" |
25 #include "remoting/host/network_settings.h" | 26 #include "remoting/host/network_settings.h" |
26 #include "remoting/host/pin_hash.h" | 27 #include "remoting/host/pin_hash.h" |
27 #include "remoting/host/plugin/daemon_controller.h" | 28 #include "remoting/host/plugin/daemon_controller.h" |
28 #include "remoting/host/plugin/host_log_handler.h" | 29 #include "remoting/host/plugin/host_log_handler.h" |
29 #include "remoting/host/policy_hack/policy_watcher.h" | 30 #include "remoting/host/policy_hack/policy_watcher.h" |
30 #include "remoting/host/register_support_host_request.h" | 31 #include "remoting/host/register_support_host_request.h" |
31 #include "remoting/host/session_manager_factory.h" | 32 #include "remoting/host/session_manager_factory.h" |
32 #include "remoting/jingle_glue/xmpp_signal_strategy.h" | 33 #include "remoting/jingle_glue/xmpp_signal_strategy.h" |
33 #include "remoting/protocol/it2me_host_authenticator_factory.h" | 34 #include "remoting/protocol/it2me_host_authenticator_factory.h" |
34 | 35 |
35 namespace remoting { | 36 namespace remoting { |
36 | 37 |
37 namespace { | 38 namespace { |
38 | 39 |
40 // This is used for tagging system event logs. | |
41 const char kApplicationName[] = "chromoting"; | |
Sergey Ulanov
2012/07/27 21:59:53
I don't think this is the name we want to use here
alexeypa (please no reviews)
2012/07/27 22:10:44
This name has been used in a released version of m
| |
42 | |
39 const char* kAttrNameAccessCode = "accessCode"; | 43 const char* kAttrNameAccessCode = "accessCode"; |
40 const char* kAttrNameAccessCodeLifetime = "accessCodeLifetime"; | 44 const char* kAttrNameAccessCodeLifetime = "accessCodeLifetime"; |
41 const char* kAttrNameClient = "client"; | 45 const char* kAttrNameClient = "client"; |
42 const char* kAttrNameDaemonState = "daemonState"; | 46 const char* kAttrNameDaemonState = "daemonState"; |
43 const char* kAttrNameState = "state"; | 47 const char* kAttrNameState = "state"; |
44 const char* kAttrNameLogDebugInfo = "logDebugInfo"; | 48 const char* kAttrNameLogDebugInfo = "logDebugInfo"; |
45 const char* kAttrNameOnNatTraversalPolicyChanged = | 49 const char* kAttrNameOnNatTraversalPolicyChanged = |
46 "onNatTraversalPolicyChanged"; | 50 "onNatTraversalPolicyChanged"; |
47 const char* kAttrNameOnStateChanged = "onStateChanged"; | 51 const char* kAttrNameOnStateChanged = "onStateChanged"; |
48 const char* kFuncNameConnect = "connect"; | 52 const char* kFuncNameConnect = "connect"; |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
417 client_username_.clear(); | 421 client_username_.clear(); |
418 DisconnectInternal(); | 422 DisconnectInternal(); |
419 } | 423 } |
420 | 424 |
421 void HostNPScriptObject::OnShutdown() { | 425 void HostNPScriptObject::OnShutdown() { |
422 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); | 426 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); |
423 | 427 |
424 register_request_.reset(); | 428 register_request_.reset(); |
425 log_to_server_.reset(); | 429 log_to_server_.reset(); |
426 signal_strategy_.reset(); | 430 signal_strategy_.reset(); |
431 host_event_logger_.reset(); | |
427 host_->RemoveStatusObserver(this); | 432 host_->RemoveStatusObserver(this); |
428 host_ = NULL; | 433 host_ = NULL; |
429 | 434 |
430 if (state_ != kDisconnected) { | 435 if (state_ != kDisconnected) { |
431 SetState(kDisconnected); | 436 SetState(kDisconnected); |
432 } | 437 } |
433 } | 438 } |
434 | 439 |
435 // string uid, string auth_token | 440 // string uid, string auth_token |
436 bool HostNPScriptObject::Connect(const NPVariant* args, | 441 bool HostNPScriptObject::Connect(const NPVariant* args, |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
572 NetworkSettings::NAT_TRAVERSAL_ENABLED : | 577 NetworkSettings::NAT_TRAVERSAL_ENABLED : |
573 NetworkSettings::NAT_TRAVERSAL_DISABLED), | 578 NetworkSettings::NAT_TRAVERSAL_DISABLED), |
574 host_context_->url_request_context_getter())); | 579 host_context_->url_request_context_getter())); |
575 host_->AddStatusObserver(this); | 580 host_->AddStatusObserver(this); |
576 log_to_server_.reset( | 581 log_to_server_.reset( |
577 new LogToServer(host_, ServerLogEntry::IT2ME, signal_strategy_.get())); | 582 new LogToServer(host_, ServerLogEntry::IT2ME, signal_strategy_.get())); |
578 base::Closure disconnect_callback = base::Bind( | 583 base::Closure disconnect_callback = base::Bind( |
579 &ChromotingHost::Shutdown, base::Unretained(host_.get()), | 584 &ChromotingHost::Shutdown, base::Unretained(host_.get()), |
580 base::Closure()); | 585 base::Closure()); |
581 it2me_host_user_interface_->Start(host_.get(), disconnect_callback); | 586 it2me_host_user_interface_->Start(host_.get(), disconnect_callback); |
587 host_event_logger_ = HostEventLogger::Create(host_, kApplicationName); | |
582 | 588 |
583 { | 589 { |
584 base::AutoLock auto_lock(ui_strings_lock_); | 590 base::AutoLock auto_lock(ui_strings_lock_); |
585 host_->SetUiStrings(ui_strings_); | 591 host_->SetUiStrings(ui_strings_); |
586 } | 592 } |
587 | 593 |
588 signal_strategy_->Connect(); | 594 signal_strategy_->Connect(); |
589 host_->Start(); | 595 host_->Start(); |
590 | 596 |
591 SetState(kRequestedAccessCode); | 597 SetState(kRequestedAccessCode); |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1256 return is_good; | 1262 return is_good; |
1257 } | 1263 } |
1258 | 1264 |
1259 void HostNPScriptObject::SetException(const std::string& exception_string) { | 1265 void HostNPScriptObject::SetException(const std::string& exception_string) { |
1260 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); | 1266 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); |
1261 g_npnetscape_funcs->setexception(parent_, exception_string.c_str()); | 1267 g_npnetscape_funcs->setexception(parent_, exception_string.c_str()); |
1262 LOG(INFO) << exception_string; | 1268 LOG(INFO) << exception_string; |
1263 } | 1269 } |
1264 | 1270 |
1265 } // namespace remoting | 1271 } // namespace remoting |
OLD | NEW |