| 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 virtual bool OnMessageReceived(const IPC::Message& message) { | 302 virtual bool OnMessageReceived(const IPC::Message& message) { |
| 303 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); | 303 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); |
| 304 | 304 |
| 305 #if defined(REMOTING_MULTI_PROCESS) | 305 #if defined(REMOTING_MULTI_PROCESS) |
| 306 bool handled = true; | 306 bool handled = true; |
| 307 IPC_BEGIN_MESSAGE_MAP(HostProcess, message) | 307 IPC_BEGIN_MESSAGE_MAP(HostProcess, message) |
| 308 IPC_MESSAGE_HANDLER(ChromotingDaemonNetworkMsg_Crash, | 308 IPC_MESSAGE_HANDLER(ChromotingDaemonNetworkMsg_Crash, |
| 309 OnCrash) | 309 OnCrash) |
| 310 IPC_MESSAGE_HANDLER(ChromotingDaemonNetworkMsg_Configuration, | 310 IPC_MESSAGE_HANDLER(ChromotingDaemonNetworkMsg_Configuration, |
| 311 OnConfigUpdated) | 311 OnConfigUpdated) |
| 312 IPC_MESSAGE_FORWARD( |
| 313 ChromotingDaemonNetworkMsg_DesktopAttached, |
| 314 desktop_session_connector_, |
| 315 DesktopSessionConnector::OnDesktopSessionAgentAttached) |
| 312 IPC_MESSAGE_FORWARD(ChromotingDaemonNetworkMsg_TerminalDisconnected, | 316 IPC_MESSAGE_FORWARD(ChromotingDaemonNetworkMsg_TerminalDisconnected, |
| 313 desktop_session_connector_, | 317 desktop_session_connector_, |
| 314 DesktopSessionConnector::OnTerminalDisconnected) | 318 DesktopSessionConnector::OnTerminalDisconnected) |
| 315 IPC_MESSAGE_UNHANDLED(handled = false) | 319 IPC_MESSAGE_UNHANDLED(handled = false) |
| 316 IPC_END_MESSAGE_MAP() | 320 IPC_END_MESSAGE_MAP() |
| 317 return handled; | 321 return handled; |
| 318 #else // !defined(REMOTING_MULTI_PROCESS) | 322 #else // !defined(REMOTING_MULTI_PROCESS) |
| 319 return false; | 323 return false; |
| 320 #endif // !defined(REMOTING_MULTI_PROCESS) | 324 #endif // !defined(REMOTING_MULTI_PROCESS) |
| 321 } | 325 } |
| 322 | 326 |
| 327 // Shutdown the host if the daemon disconnected the channel. |
| 328 virtual void OnChannelError() OVERRIDE { |
| 329 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); |
| 330 |
| 331 context_->network_task_runner()->PostTask( |
| 332 FROM_HERE, |
| 333 base::Bind(&HostProcess::Shutdown, base::Unretained(this), |
| 334 kSuccessExitCode)); |
| 335 } |
| 336 |
| 323 void StartHostProcess() { | 337 void StartHostProcess() { |
| 324 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); | 338 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); |
| 325 | 339 |
| 326 if (!InitWithCommandLine(CommandLine::ForCurrentProcess())) { | 340 if (!InitWithCommandLine(CommandLine::ForCurrentProcess())) { |
| 327 OnConfigWatcherError(); | 341 OnConfigWatcherError(); |
| 328 return; | 342 return; |
| 329 } | 343 } |
| 330 | 344 |
| 331 // Create a desktop environment factory appropriate to the build type & | 345 // Create a desktop environment factory appropriate to the build type & |
| 332 // platform. | 346 // platform. |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 user32.GetFunctionPointer("SetProcessDPIAware")); | 885 user32.GetFunctionPointer("SetProcessDPIAware")); |
| 872 set_process_dpi_aware(); | 886 set_process_dpi_aware(); |
| 873 } | 887 } |
| 874 | 888 |
| 875 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 889 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
| 876 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 890 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
| 877 return main(0, NULL); | 891 return main(0, NULL); |
| 878 } | 892 } |
| 879 | 893 |
| 880 #endif // defined(OS_WIN) | 894 #endif // defined(OS_WIN) |
| OLD | NEW |