| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 private: | 172 private: |
| 173 #if defined(OS_POSIX) | 173 #if defined(OS_POSIX) |
| 174 // Registers a SIGTERM handler on the network thread, to shutdown the host. | 174 // Registers a SIGTERM handler on the network thread, to shutdown the host. |
| 175 void ListenForShutdownSignal(); | 175 void ListenForShutdownSignal(); |
| 176 | 176 |
| 177 // Callback passed to RegisterSignalHandler() to handle SIGTERM events. | 177 // Callback passed to RegisterSignalHandler() to handle SIGTERM events. |
| 178 void SigTermHandler(int signal_number); | 178 void SigTermHandler(int signal_number); |
| 179 #endif | 179 #endif |
| 180 | 180 |
| 181 // Asks the daemon to inject Secure Attention Sequence to the console. |
| 182 void SendSasToConsole(); |
| 183 |
| 181 void ShutdownHostProcess(); | 184 void ShutdownHostProcess(); |
| 182 | 185 |
| 183 // Applies the host config, returning true if successful. | 186 // Applies the host config, returning true if successful. |
| 184 bool ApplyConfig(scoped_ptr<JsonHostConfig> config); | 187 bool ApplyConfig(scoped_ptr<JsonHostConfig> config); |
| 185 | 188 |
| 186 void OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies); | 189 void OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies); |
| 187 bool OnHostDomainPolicyUpdate(const std::string& host_domain); | 190 bool OnHostDomainPolicyUpdate(const std::string& host_domain); |
| 188 bool OnUsernamePolicyUpdate(bool username_match_required); | 191 bool OnUsernamePolicyUpdate(bool username_match_required); |
| 189 bool OnNatPolicyUpdate(bool nat_traversal_enabled); | 192 bool OnNatPolicyUpdate(bool nat_traversal_enabled); |
| 190 bool OnCurtainPolicyUpdate(bool curtain_required); | 193 bool OnCurtainPolicyUpdate(bool curtain_required); |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 IpcDesktopEnvironmentFactory* desktop_environment_factory = | 501 IpcDesktopEnvironmentFactory* desktop_environment_factory = |
| 499 new IpcDesktopEnvironmentFactory( | 502 new IpcDesktopEnvironmentFactory( |
| 500 daemon_channel_.get(), | 503 daemon_channel_.get(), |
| 501 context_->input_task_runner(), | 504 context_->input_task_runner(), |
| 502 context_->network_task_runner(), | 505 context_->network_task_runner(), |
| 503 context_->ui_task_runner()); | 506 context_->ui_task_runner()); |
| 504 desktop_session_connector_ = desktop_environment_factory; | 507 desktop_session_connector_ = desktop_environment_factory; |
| 505 #else // !defined(REMOTING_MULTI_PROCESS) | 508 #else // !defined(REMOTING_MULTI_PROCESS) |
| 506 DesktopEnvironmentFactory* desktop_environment_factory = | 509 DesktopEnvironmentFactory* desktop_environment_factory = |
| 507 new SessionDesktopEnvironmentFactory( | 510 new SessionDesktopEnvironmentFactory( |
| 508 context_->input_task_runner(), context_->ui_task_runner()); | 511 context_->input_task_runner(), context_->ui_task_runner(), |
| 512 base::Bind(&HostProcess::SendSasToConsole, base::Unretained(this))); |
| 509 #endif // !defined(REMOTING_MULTI_PROCESS) | 513 #endif // !defined(REMOTING_MULTI_PROCESS) |
| 510 | 514 |
| 511 #else // !defined(OS_WIN) | 515 #else // !defined(OS_WIN) |
| 512 DesktopEnvironmentFactory* desktop_environment_factory = | 516 DesktopEnvironmentFactory* desktop_environment_factory = |
| 513 new DesktopEnvironmentFactory( | 517 new DesktopEnvironmentFactory( |
| 514 context_->input_task_runner(), context_->ui_task_runner()); | 518 context_->input_task_runner(), context_->ui_task_runner()); |
| 515 #endif // !defined(OS_WIN) | 519 #endif // !defined(OS_WIN) |
| 516 | 520 |
| 517 desktop_environment_factory_.reset(desktop_environment_factory); | 521 desktop_environment_factory_.reset(desktop_environment_factory); |
| 518 | 522 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 545 host_user_interface_->Init(); | 549 host_user_interface_->Init(); |
| 546 } | 550 } |
| 547 | 551 |
| 548 StartWatchingConfigChanges(); | 552 StartWatchingConfigChanges(); |
| 549 } | 553 } |
| 550 | 554 |
| 551 int HostProcess::get_exit_code() const { | 555 int HostProcess::get_exit_code() const { |
| 552 return exit_code_; | 556 return exit_code_; |
| 553 } | 557 } |
| 554 | 558 |
| 559 void HostProcess::SendSasToConsole() { |
| 560 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); |
| 561 |
| 562 if (daemon_channel_) |
| 563 daemon_channel_->Send(new ChromotingNetworkDaemonMsg_SendSasToConsole()); |
| 564 } |
| 565 |
| 555 void HostProcess::ShutdownHostProcess() { | 566 void HostProcess::ShutdownHostProcess() { |
| 556 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); | 567 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); |
| 557 | 568 |
| 558 // Tear down resources that use ChromotingHostContext threads. | 569 // Tear down resources that use ChromotingHostContext threads. |
| 559 config_watcher_.reset(); | 570 config_watcher_.reset(); |
| 560 daemon_channel_.reset(); | 571 daemon_channel_.reset(); |
| 561 desktop_environment_factory_.reset(); | 572 desktop_environment_factory_.reset(); |
| 562 host_user_interface_.reset(); | 573 host_user_interface_.reset(); |
| 563 | 574 |
| 564 context_.reset(); | 575 context_.reset(); |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 user32.GetFunctionPointer("SetProcessDPIAware")); | 1017 user32.GetFunctionPointer("SetProcessDPIAware")); |
| 1007 set_process_dpi_aware(); | 1018 set_process_dpi_aware(); |
| 1008 } | 1019 } |
| 1009 | 1020 |
| 1010 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 1021 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
| 1011 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 1022 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
| 1012 return main(0, NULL); | 1023 return main(0, NULL); |
| 1013 } | 1024 } |
| 1014 | 1025 |
| 1015 #endif // defined(OS_WIN) | 1026 #endif // defined(OS_WIN) |
| OLD | NEW |