| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 the common entry point shared by all Chromoting Host | 5 // This file implements the common entry point shared by all Chromoting Host |
| 6 // processes. | 6 // processes. |
| 7 | 7 |
| 8 #include "remoting/host/host_main.h" | 8 #include "remoting/host/host_main.h" |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #endif // defined(OS_MACOSX) | 29 #endif // defined(OS_MACOSX) |
| 30 | 30 |
| 31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
| 32 #include <commctrl.h> | 32 #include <commctrl.h> |
| 33 #include <shellapi.h> | 33 #include <shellapi.h> |
| 34 #endif // defined(OS_WIN) | 34 #endif // defined(OS_WIN) |
| 35 | 35 |
| 36 namespace remoting { | 36 namespace remoting { |
| 37 | 37 |
| 38 // Known entry points. | 38 // Known entry points. |
| 39 int HostProcessMain(); |
| 40 #if defined(OS_WIN) |
| 39 int DaemonProcessMain(); | 41 int DaemonProcessMain(); |
| 40 int DesktopProcessMain(); | 42 int DesktopProcessMain(); |
| 41 int ElevatedControllerMain(); | 43 int ElevatedControllerMain(); |
| 42 int HostProcessMain(); | |
| 43 int RdpDesktopSessionMain(); | 44 int RdpDesktopSessionMain(); |
| 45 #endif // defined(OS_WIN) |
| 44 | 46 |
| 45 const char kElevateSwitchName[] = "elevate"; | 47 const char kElevateSwitchName[] = "elevate"; |
| 46 const char kProcessTypeSwitchName[] = "type"; | 48 const char kProcessTypeSwitchName[] = "type"; |
| 47 | 49 |
| 48 const char kProcessTypeController[] = "controller"; | 50 const char kProcessTypeController[] = "controller"; |
| 49 const char kProcessTypeDaemon[] = "daemon"; | 51 const char kProcessTypeDaemon[] = "daemon"; |
| 50 const char kProcessTypeDesktop[] = "desktop"; | 52 const char kProcessTypeDesktop[] = "desktop"; |
| 51 const char kProcessTypeHost[] = "host"; | 53 const char kProcessTypeHost[] = "host"; |
| 52 const char kProcessTypeNativeMessagingHost[] = "native_messaging_host"; | 54 const char kProcessTypeNativeMessagingHost[] = "native_messaging_host"; |
| 53 const char kProcessTypeRdpDesktopSession[] = "rdp_desktop_session"; | 55 const char kProcessTypeRdpDesktopSession[] = "rdp_desktop_session"; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 121 |
| 120 if (!ShellExecuteEx(&info)) { | 122 if (!ShellExecuteEx(&info)) { |
| 121 DWORD exit_code = GetLastError(); | 123 DWORD exit_code = GetLastError(); |
| 122 LOG_GETLASTERROR(ERROR) << "Unable to launch '" << binary.value() << "'"; | 124 LOG_GETLASTERROR(ERROR) << "Unable to launch '" << binary.value() << "'"; |
| 123 return exit_code; | 125 return exit_code; |
| 124 } | 126 } |
| 125 | 127 |
| 126 return kSuccessExitCode; | 128 return kSuccessExitCode; |
| 127 } | 129 } |
| 128 | 130 |
| 129 #else // !defined(OS_WIN) | |
| 130 | |
| 131 // Fake entry points that exist only on Windows. | |
| 132 int DaemonProcessMain() { | |
| 133 NOTREACHED(); | |
| 134 return kInitializationFailed; | |
| 135 } | |
| 136 | |
| 137 int DesktopProcessMain() { | |
| 138 NOTREACHED(); | |
| 139 return kInitializationFailed; | |
| 140 } | |
| 141 | |
| 142 int ElevatedControllerMain() { | |
| 143 NOTREACHED(); | |
| 144 return kInitializationFailed; | |
| 145 } | |
| 146 | |
| 147 int RdpDesktopSessionMain() { | |
| 148 NOTREACHED(); | |
| 149 return kInitializationFailed; | |
| 150 } | |
| 151 | |
| 152 #endif // !defined(OS_WIN) | 131 #endif // !defined(OS_WIN) |
| 153 | 132 |
| 154 // Select the entry point corresponding to the process type. | 133 // Select the entry point corresponding to the process type. |
| 155 MainRoutineFn SelectMainRoutine(const std::string& process_type) { | 134 MainRoutineFn SelectMainRoutine(const std::string& process_type) { |
| 156 MainRoutineFn main_routine = NULL; | 135 MainRoutineFn main_routine = NULL; |
| 157 | 136 |
| 158 if (process_type == kProcessTypeHost) { | 137 if (process_type == kProcessTypeHost) { |
| 159 main_routine = &HostProcessMain; | 138 main_routine = &HostProcessMain; |
| 160 #if defined(OS_WIN) | 139 #if defined(OS_WIN) |
| 161 } else if (process_type == kProcessTypeDaemon) { | 140 } else if (process_type == kProcessTypeDaemon) { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 if (exit_code == kUsageExitCode) { | 242 if (exit_code == kUsageExitCode) { |
| 264 Usage(command_line->GetProgram()); | 243 Usage(command_line->GetProgram()); |
| 265 } | 244 } |
| 266 | 245 |
| 267 remoting::UnloadResources(); | 246 remoting::UnloadResources(); |
| 268 | 247 |
| 269 return exit_code; | 248 return exit_code; |
| 270 } | 249 } |
| 271 | 250 |
| 272 } // namespace remoting | 251 } // namespace remoting |
| OLD | NEW |