| 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> |
| 11 | 11 |
| 12 #include "base/at_exit.h" | 12 #include "base/at_exit.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 17 #include "base/strings/stringize_macros.h" | 17 #include "base/strings/stringize_macros.h" |
| 18 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 20 #include "remoting/base/breakpad.h" | 20 #include "remoting/base/breakpad.h" |
| 21 #include "remoting/base/resources.h" | 21 #include "remoting/base/resources.h" |
| 22 #include "remoting/host/host_exit_codes.h" | 22 #include "remoting/host/host_exit_codes.h" |
| 23 #include "remoting/host/logging.h" | 23 #include "remoting/host/logging.h" |
| 24 #include "remoting/host/setup/native_messaging_host.h" | 24 #include "remoting/host/setup/me2me_native_messaging_host.h" |
| 25 #include "remoting/host/usage_stats_consent.h" | 25 #include "remoting/host/usage_stats_consent.h" |
| 26 | 26 |
| 27 #if defined(OS_MACOSX) | 27 #if defined(OS_MACOSX) |
| 28 #include "base/mac/scoped_nsautorelease_pool.h" | 28 #include "base/mac/scoped_nsautorelease_pool.h" |
| 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) |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 NOTREACHED(); | 148 NOTREACHED(); |
| 149 return kInitializationFailed; | 149 return kInitializationFailed; |
| 150 } | 150 } |
| 151 | 151 |
| 152 #endif // !defined(OS_WIN) | 152 #endif // !defined(OS_WIN) |
| 153 | 153 |
| 154 // Select the entry point corresponding to the process type. | 154 // Select the entry point corresponding to the process type. |
| 155 MainRoutineFn SelectMainRoutine(const std::string& process_type) { | 155 MainRoutineFn SelectMainRoutine(const std::string& process_type) { |
| 156 MainRoutineFn main_routine = NULL; | 156 MainRoutineFn main_routine = NULL; |
| 157 | 157 |
| 158 if (process_type == kProcessTypeDaemon) { | 158 if (process_type == kProcessTypeHost) { |
| 159 main_routine = &HostProcessMain; |
| 160 #if defined(OS_WIN) |
| 161 } else if (process_type == kProcessTypeDaemon) { |
| 159 main_routine = &DaemonProcessMain; | 162 main_routine = &DaemonProcessMain; |
| 160 } else if (process_type == kProcessTypeDesktop) { | 163 } else if (process_type == kProcessTypeDesktop) { |
| 161 main_routine = &DesktopProcessMain; | 164 main_routine = &DesktopProcessMain; |
| 162 } else if (process_type == kProcessTypeController) { | 165 } else if (process_type == kProcessTypeController) { |
| 163 main_routine = &ElevatedControllerMain; | 166 main_routine = &ElevatedControllerMain; |
| 164 } else if (process_type == kProcessTypeRdpDesktopSession) { | 167 } else if (process_type == kProcessTypeRdpDesktopSession) { |
| 165 main_routine = &RdpDesktopSessionMain; | 168 main_routine = &RdpDesktopSessionMain; |
| 166 } else if (process_type == kProcessTypeHost) { | |
| 167 main_routine = &HostProcessMain; | |
| 168 } else if (process_type == kProcessTypeNativeMessagingHost) { | 169 } else if (process_type == kProcessTypeNativeMessagingHost) { |
| 169 main_routine = &NativeMessagingHostMain; | 170 main_routine = &NativeMessagingHostMain; |
| 171 #endif // defined(OS_WIN) |
| 170 } | 172 } |
| 171 | 173 |
| 172 return main_routine; | 174 return main_routine; |
| 173 } | 175 } |
| 174 | 176 |
| 175 } // namespace | 177 } // namespace |
| 176 | 178 |
| 177 int HostMain(int argc, char** argv) { | 179 int HostMain(int argc, char** argv) { |
| 178 #if defined(OS_MACOSX) | 180 #if defined(OS_MACOSX) |
| 179 // Needed so we don't leak objects when threads are created. | 181 // Needed so we don't leak objects when threads are created. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 if (exit_code == kUsageExitCode) { | 263 if (exit_code == kUsageExitCode) { |
| 262 Usage(command_line->GetProgram()); | 264 Usage(command_line->GetProgram()); |
| 263 } | 265 } |
| 264 | 266 |
| 265 remoting::UnloadResources(); | 267 remoting::UnloadResources(); |
| 266 | 268 |
| 267 return exit_code; | 269 return exit_code; |
| 268 } | 270 } |
| 269 | 271 |
| 270 } // namespace remoting | 272 } // namespace remoting |
| OLD | NEW |