OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/namespace contains utility functions for enumerating, ending and | 5 // This file/namespace contains utility functions for enumerating, ending and |
6 // computing statistics of processes. | 6 // computing statistics of processes. |
7 | 7 |
8 #ifndef BASE_PROCESS_UTIL_H_ | 8 #ifndef BASE_PROCESS_UTIL_H_ |
9 #define BASE_PROCESS_UTIL_H_ | 9 #define BASE_PROCESS_UTIL_H_ |
10 | 10 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // | 133 // |
134 // Example (including literal quotes) | 134 // Example (including literal quotes) |
135 // cmdline = "c:\windows\explorer.exe" -foo "c:\bar\" | 135 // cmdline = "c:\windows\explorer.exe" -foo "c:\bar\" |
136 // | 136 // |
137 // If process_handle is non-NULL, the process handle of the launched app will be | 137 // If process_handle is non-NULL, the process handle of the launched app will be |
138 // stored there on a successful launch. | 138 // stored there on a successful launch. |
139 // NOTE: In this case, the caller is responsible for closing the handle so | 139 // NOTE: In this case, the caller is responsible for closing the handle so |
140 // that it doesn't leak! | 140 // that it doesn't leak! |
141 bool LaunchApp(const std::wstring& cmdline, | 141 bool LaunchApp(const std::wstring& cmdline, |
142 bool wait, bool start_hidden, ProcessHandle* process_handle); | 142 bool wait, bool start_hidden, ProcessHandle* process_handle); |
| 143 |
| 144 // Runs the given application name with the given command line as if the user |
| 145 // represented by |token| had launched it. The caveats about |cmdline| and |
| 146 // |process_handle| explained for LaunchApp above apply as well. |
| 147 // |
| 148 // Whether the application is visible on the interactive desktop depends on |
| 149 // the token belonging to an interactive logon session. |
| 150 // |
| 151 // To avoid hard to diagnose problems, this function internally loads the |
| 152 // environment variables associated with the user and if this operation fails |
| 153 // the entire call fails as well. |
| 154 bool LaunchAppAsUser(UserTokenHandle token, const std::wstring& cmdline, |
| 155 bool start_hidden, ProcessHandle* process_handle); |
| 156 |
143 #elif defined(OS_POSIX) | 157 #elif defined(OS_POSIX) |
144 // Runs the application specified in argv[0] with the command line argv. | 158 // Runs the application specified in argv[0] with the command line argv. |
145 // Before launching all FDs open in the parent process will be marked as | 159 // Before launching all FDs open in the parent process will be marked as |
146 // close-on-exec. |fds_to_remap| defines a mapping of src fd->dest fd to | 160 // close-on-exec. |fds_to_remap| defines a mapping of src fd->dest fd to |
147 // propagate FDs into the child process. | 161 // propagate FDs into the child process. |
148 // | 162 // |
149 // As above, if wait is true, execute synchronously. The pid will be stored | 163 // As above, if wait is true, execute synchronously. The pid will be stored |
150 // in process_handle if that pointer is non-null. | 164 // in process_handle if that pointer is non-null. |
151 // | 165 // |
152 // Note that the first argument in argv must point to the executable filename. | 166 // Note that the first argument in argv must point to the executable filename. |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 // instance running inside the parent. The parent's Breakpad instance should | 526 // instance running inside the parent. The parent's Breakpad instance should |
513 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler | 527 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler |
514 // in the child after forking will restore the standard exception handler. | 528 // in the child after forking will restore the standard exception handler. |
515 // See http://crbug.com/20371/ for more details. | 529 // See http://crbug.com/20371/ for more details. |
516 void RestoreDefaultExceptionHandler(); | 530 void RestoreDefaultExceptionHandler(); |
517 #endif | 531 #endif |
518 | 532 |
519 } // namespace base | 533 } // namespace base |
520 | 534 |
521 #endif // BASE_PROCESS_UTIL_H_ | 535 #endif // BASE_PROCESS_UTIL_H_ |
OLD | NEW |