| 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 // This file implements a standalone host process for Me2Me. | 5 // This file implements a standalone host process for Me2Me. |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 private: | 142 private: |
| 143 #if defined(OS_POSIX) | 143 #if defined(OS_POSIX) |
| 144 // Registers a SIGTERM handler on the network thread, to shutdown the host. | 144 // Registers a SIGTERM handler on the network thread, to shutdown the host. |
| 145 void ListenForShutdownSignal(); | 145 void ListenForShutdownSignal(); |
| 146 | 146 |
| 147 // Callback passed to RegisterSignalHandler() to handle SIGTERM events. | 147 // Callback passed to RegisterSignalHandler() to handle SIGTERM events. |
| 148 void SigTermHandler(int signal_number); | 148 void SigTermHandler(int signal_number); |
| 149 #endif | 149 #endif |
| 150 | 150 |
| 151 // Asks the daemon to inject Secure Attention Sequence to the console. |
| 152 void SendSasToConsole(); |
| 153 |
| 151 void ShutdownHostProcess(); | 154 void ShutdownHostProcess(); |
| 152 | 155 |
| 153 // Applies the host config, returning true if successful. | 156 // Applies the host config, returning true if successful. |
| 154 bool ApplyConfig(scoped_ptr<JsonHostConfig> config); | 157 bool ApplyConfig(scoped_ptr<JsonHostConfig> config); |
| 155 | 158 |
| 156 void OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies); | 159 void OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies); |
| 157 bool OnHostDomainPolicyUpdate(const std::string& host_domain); | 160 bool OnHostDomainPolicyUpdate(const std::string& host_domain); |
| 158 bool OnNatPolicyUpdate(bool nat_traversal_enabled); | 161 bool OnNatPolicyUpdate(bool nat_traversal_enabled); |
| 159 bool OnCurtainPolicyUpdate(bool curtain_required); | 162 bool OnCurtainPolicyUpdate(bool curtain_required); |
| 160 bool OnHostTalkGadgetPrefixPolicyUpdate(const std::string& talkgadget_prefix); | 163 bool OnHostTalkGadgetPrefixPolicyUpdate(const std::string& talkgadget_prefix); |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 IpcDesktopEnvironmentFactory* desktop_environment_factory = | 455 IpcDesktopEnvironmentFactory* desktop_environment_factory = |
| 453 new IpcDesktopEnvironmentFactory( | 456 new IpcDesktopEnvironmentFactory( |
| 454 daemon_channel_.get(), | 457 daemon_channel_.get(), |
| 455 context_->input_task_runner(), | 458 context_->input_task_runner(), |
| 456 context_->network_task_runner(), | 459 context_->network_task_runner(), |
| 457 context_->ui_task_runner()); | 460 context_->ui_task_runner()); |
| 458 desktop_session_connector_ = desktop_environment_factory; | 461 desktop_session_connector_ = desktop_environment_factory; |
| 459 #else // !defined(REMOTING_MULTI_PROCESS) | 462 #else // !defined(REMOTING_MULTI_PROCESS) |
| 460 DesktopEnvironmentFactory* desktop_environment_factory = | 463 DesktopEnvironmentFactory* desktop_environment_factory = |
| 461 new SessionDesktopEnvironmentFactory( | 464 new SessionDesktopEnvironmentFactory( |
| 462 context_->input_task_runner(), context_->ui_task_runner()); | 465 context_->input_task_runner(), context_->ui_task_runner(), |
| 466 base::Bind(&HostProcess::SendSasToConsole, base::Unretained(this))); |
| 463 #endif // !defined(REMOTING_MULTI_PROCESS) | 467 #endif // !defined(REMOTING_MULTI_PROCESS) |
| 464 | 468 |
| 465 #else // !defined(OS_WIN) | 469 #else // !defined(OS_WIN) |
| 466 DesktopEnvironmentFactory* desktop_environment_factory = | 470 DesktopEnvironmentFactory* desktop_environment_factory = |
| 467 new DesktopEnvironmentFactory( | 471 new DesktopEnvironmentFactory( |
| 468 context_->input_task_runner(), context_->ui_task_runner()); | 472 context_->input_task_runner(), context_->ui_task_runner()); |
| 469 #endif // !defined(OS_WIN) | 473 #endif // !defined(OS_WIN) |
| 470 | 474 |
| 471 desktop_environment_factory_.reset(desktop_environment_factory); | 475 desktop_environment_factory_.reset(desktop_environment_factory); |
| 472 | 476 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 499 host_user_interface_->Init(); | 503 host_user_interface_->Init(); |
| 500 } | 504 } |
| 501 | 505 |
| 502 StartWatchingConfigChanges(); | 506 StartWatchingConfigChanges(); |
| 503 } | 507 } |
| 504 | 508 |
| 505 int HostProcess::get_exit_code() const { | 509 int HostProcess::get_exit_code() const { |
| 506 return exit_code_; | 510 return exit_code_; |
| 507 } | 511 } |
| 508 | 512 |
| 513 void HostProcess::SendSasToConsole() { |
| 514 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); |
| 515 |
| 516 if (daemon_channel_) |
| 517 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_SendSasToConsole()); |
| 518 } |
| 519 |
| 509 void HostProcess::ShutdownHostProcess() { | 520 void HostProcess::ShutdownHostProcess() { |
| 510 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); | 521 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); |
| 511 | 522 |
| 512 // Tear down resources that use ChromotingHostContext threads. | 523 // Tear down resources that use ChromotingHostContext threads. |
| 513 config_watcher_.reset(); | 524 config_watcher_.reset(); |
| 514 daemon_channel_.reset(); | 525 daemon_channel_.reset(); |
| 515 desktop_environment_factory_.reset(); | 526 desktop_environment_factory_.reset(); |
| 516 host_user_interface_.reset(); | 527 host_user_interface_.reset(); |
| 517 | 528 |
| 518 context_.reset(); | 529 context_.reset(); |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 user32.GetFunctionPointer("SetProcessDPIAware")); | 960 user32.GetFunctionPointer("SetProcessDPIAware")); |
| 950 set_process_dpi_aware(); | 961 set_process_dpi_aware(); |
| 951 } | 962 } |
| 952 | 963 |
| 953 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 964 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
| 954 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 965 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
| 955 return main(0, NULL); | 966 return main(0, NULL); |
| 956 } | 967 } |
| 957 | 968 |
| 958 #endif // defined(OS_WIN) | 969 #endif // defined(OS_WIN) |
| OLD | NEW |