| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // Connect to the daemon process. | 163 // Connect to the daemon process. |
| 164 daemon_channel_.reset(new IPC::ChannelProxy( | 164 daemon_channel_.reset(new IPC::ChannelProxy( |
| 165 channel_handle, | 165 channel_handle, |
| 166 IPC::Channel::MODE_CLIENT, | 166 IPC::Channel::MODE_CLIENT, |
| 167 this, | 167 this, |
| 168 context_->network_task_runner())); | 168 context_->network_task_runner())); |
| 169 | 169 |
| 170 return true; | 170 return true; |
| 171 } | 171 } |
| 172 | 172 |
| 173 // Crashes the process in response to a daemon's request. The daemon passes |
| 174 // the location of the code that detected the fatal error resulted in this |
| 175 // request. |
| 176 void OnCrash(const std::string& function_name, |
| 177 const std::string& file_name, |
| 178 const int& line_number) { |
| 179 CHECK(false); |
| 180 } |
| 181 |
| 173 #else // !defined(REMOTING_MULTI_PROCESS) | 182 #else // !defined(REMOTING_MULTI_PROCESS) |
| 174 | 183 |
| 175 bool InitWithCommandLine(const CommandLine* cmd_line) { | 184 bool InitWithCommandLine(const CommandLine* cmd_line) { |
| 176 // Connect to the daemon process. | 185 // Connect to the daemon process. |
| 177 std::string channel_name = | 186 std::string channel_name = |
| 178 cmd_line->GetSwitchValueASCII(kDaemonPipeSwitchName); | 187 cmd_line->GetSwitchValueASCII(kDaemonPipeSwitchName); |
| 179 if (!channel_name.empty()) { | 188 if (!channel_name.empty()) { |
| 180 daemon_channel_.reset(new IPC::ChannelProxy( | 189 daemon_channel_.reset(new IPC::ChannelProxy( |
| 181 channel_name, IPC::Channel::MODE_CLIENT, this, | 190 channel_name, IPC::Channel::MODE_CLIENT, this, |
| 182 context_->network_task_runner())); | 191 context_->network_task_runner())); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 host_->SetAuthenticatorFactory(factory.Pass()); | 298 host_->SetAuthenticatorFactory(factory.Pass()); |
| 290 } | 299 } |
| 291 | 300 |
| 292 // IPC::Listener implementation. | 301 // IPC::Listener implementation. |
| 293 virtual bool OnMessageReceived(const IPC::Message& message) { | 302 virtual bool OnMessageReceived(const IPC::Message& message) { |
| 294 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); | 303 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); |
| 295 | 304 |
| 296 #if defined(REMOTING_MULTI_PROCESS) | 305 #if defined(REMOTING_MULTI_PROCESS) |
| 297 bool handled = true; | 306 bool handled = true; |
| 298 IPC_BEGIN_MESSAGE_MAP(HostProcess, message) | 307 IPC_BEGIN_MESSAGE_MAP(HostProcess, message) |
| 308 IPC_MESSAGE_HANDLER(ChromotingDaemonNetworkMsg_Crash, |
| 309 OnCrash) |
| 299 IPC_MESSAGE_HANDLER(ChromotingDaemonNetworkMsg_Configuration, | 310 IPC_MESSAGE_HANDLER(ChromotingDaemonNetworkMsg_Configuration, |
| 300 OnConfigUpdated) | 311 OnConfigUpdated) |
| 301 IPC_MESSAGE_FORWARD(ChromotingDaemonNetworkMsg_TerminalDisconnected, | 312 IPC_MESSAGE_FORWARD(ChromotingDaemonNetworkMsg_TerminalDisconnected, |
| 302 desktop_session_connector_, | 313 desktop_session_connector_, |
| 303 DesktopSessionConnector::OnTerminalDisconnected) | 314 DesktopSessionConnector::OnTerminalDisconnected) |
| 304 IPC_MESSAGE_UNHANDLED(handled = false) | 315 IPC_MESSAGE_UNHANDLED(handled = false) |
| 305 IPC_END_MESSAGE_MAP() | 316 IPC_END_MESSAGE_MAP() |
| 306 return handled; | 317 return handled; |
| 307 #else // !defined(REMOTING_MULTI_PROCESS) | 318 #else // !defined(REMOTING_MULTI_PROCESS) |
| 308 return false; | 319 return false; |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 user32.GetFunctionPointer("SetProcessDPIAware")); | 871 user32.GetFunctionPointer("SetProcessDPIAware")); |
| 861 set_process_dpi_aware(); | 872 set_process_dpi_aware(); |
| 862 } | 873 } |
| 863 | 874 |
| 864 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 875 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
| 865 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 876 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
| 866 return main(0, NULL); | 877 return main(0, NULL); |
| 867 } | 878 } |
| 868 | 879 |
| 869 #endif // defined(OS_WIN) | 880 #endif // defined(OS_WIN) |
| OLD | NEW |