| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 contains functions for launching subprocesses. | 5 // This file contains functions for launching subprocesses. |
| 6 | 6 |
| 7 #ifndef BASE_PROCESS_LAUNCH_H_ | 7 #ifndef BASE_PROCESS_LAUNCH_H_ |
| 8 #define BASE_PROCESS_LAUNCH_H_ | 8 #define BASE_PROCESS_LAUNCH_H_ |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/base_export.h" | 14 #include "base/base_export.h" |
| 15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 16 #include "base/environment.h" | 16 #include "base/environment.h" |
| 17 #include "base/process/process.h" | 17 #include "base/process/process.h" |
| 18 #include "base/process/process_handle.h" | 18 #include "base/process/process_handle.h" |
| 19 #include "base/strings/string_piece.h" | 19 #include "base/strings/string_piece.h" |
| 20 | 20 |
| 21 #if defined(OS_POSIX) | 21 #if defined(OS_POSIX) |
| 22 #include "base/posix/file_descriptor_shuffle.h" | 22 #include "base/posix/file_descriptor_shuffle.h" |
| 23 #elif defined(OS_WIN) | 23 #elif defined(OS_WIN) |
| 24 #include <windows.h> | 24 #include <windows.h> |
| 25 #include "base/win/scoped_handle.h" |
| 25 #endif | 26 #endif |
| 26 | 27 |
| 27 namespace base { | 28 namespace base { |
| 28 | 29 |
| 29 class CommandLine; | 30 class CommandLine; |
| 30 | 31 |
| 31 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
| 32 typedef std::vector<HANDLE> HandlesToInheritVector; | 33 typedef std::vector<HANDLE> HandlesToInheritVector; |
| 33 #endif | 34 #endif |
| 34 // TODO(viettrungluu): Only define this on POSIX? | 35 // TODO(viettrungluu): Only define this on POSIX? |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // Windows-specific LaunchProcess that takes the command line as a | 167 // Windows-specific LaunchProcess that takes the command line as a |
| 167 // string. Useful for situations where you need to control the | 168 // string. Useful for situations where you need to control the |
| 168 // command line arguments directly, but prefer the CommandLine version | 169 // command line arguments directly, but prefer the CommandLine version |
| 169 // if launching Chrome itself. | 170 // if launching Chrome itself. |
| 170 // | 171 // |
| 171 // The first command line argument should be the path to the process, | 172 // The first command line argument should be the path to the process, |
| 172 // and don't forget to quote it. | 173 // and don't forget to quote it. |
| 173 // | 174 // |
| 174 // Example (including literal quotes) | 175 // Example (including literal quotes) |
| 175 // cmdline = "c:\windows\explorer.exe" -foo "c:\bar\" | 176 // cmdline = "c:\windows\explorer.exe" -foo "c:\bar\" |
| 176 BASE_EXPORT Process LaunchProcess(const string16& cmdline, | 177 BASE_EXPORT bool LaunchProcess(const string16& cmdline, |
| 177 const LaunchOptions& options); | 178 const LaunchOptions& options, |
| 179 win::ScopedHandle* process_handle); |
| 178 | 180 |
| 179 // Launches a process with elevated privileges. This does not behave exactly | 181 // Launches a process with elevated privileges. This does not behave exactly |
| 180 // like LaunchProcess as it uses ShellExecuteEx instead of CreateProcess to | 182 // like LaunchProcess as it uses ShellExecuteEx instead of CreateProcess to |
| 181 // create the process. This means the process will have elevated privileges | 183 // create the process. This means the process will have elevated privileges |
| 182 // and thus some common operations like OpenProcess will fail. Currently the | 184 // and thus some common operations like OpenProcess will fail. Currently the |
| 183 // only supported LaunchOptions are |start_hidden| and |wait|. | 185 // only supported LaunchOptions are |start_hidden| and |wait|. |
| 184 BASE_EXPORT Process LaunchElevatedProcess(const CommandLine& cmdline, | 186 BASE_EXPORT Process LaunchElevatedProcess(const CommandLine& cmdline, |
| 185 const LaunchOptions& options); | 187 const LaunchOptions& options); |
| 186 | 188 |
| 187 #elif defined(OS_POSIX) | 189 #elif defined(OS_POSIX) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 void ReplaceBootstrapPort(const std::string& replacement_bootstrap_name); | 265 void ReplaceBootstrapPort(const std::string& replacement_bootstrap_name); |
| 264 #endif // defined(OS_MACOSX) | 266 #endif // defined(OS_MACOSX) |
| 265 | 267 |
| 266 // Creates a LaunchOptions object suitable for launching processes in a test | 268 // Creates a LaunchOptions object suitable for launching processes in a test |
| 267 // binary. This should not be called in production/released code. | 269 // binary. This should not be called in production/released code. |
| 268 BASE_EXPORT LaunchOptions LaunchOptionsForTest(); | 270 BASE_EXPORT LaunchOptions LaunchOptionsForTest(); |
| 269 | 271 |
| 270 } // namespace base | 272 } // namespace base |
| 271 | 273 |
| 272 #endif // BASE_PROCESS_LAUNCH_H_ | 274 #endif // BASE_PROCESS_LAUNCH_H_ |
| OLD | NEW |