| 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 #ifndef CONTENT_BROWSER_ANDROID_SANDBOXED_PROCESS_LAUNCHER_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_SANDBOXED_PROCESS_LAUNCHER_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_SANDBOXED_PROCESS_LAUNCHER_H_ | 6 #define CONTENT_BROWSER_ANDROID_SANDBOXED_PROCESS_LAUNCHER_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/android/scoped_java_ref.h" | |
| 11 #include "base/callback.h" | 10 #include "base/callback.h" |
| 12 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/global_descriptors_posix.h" |
| 13 #include "base/platform_file.h" |
| 13 #include "base/process.h" | 14 #include "base/process.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 | 17 |
| 17 typedef base::Callback<void(base::ProcessHandle)> StartSandboxedProcessCallback; | 18 typedef base::Callback<void(base::ProcessHandle)> StartSandboxedProcessCallback; |
| 18 // Starts a process as a sandboxed process spawned by the Android | 19 // Starts a process as a sandboxed process spawned by the Android |
| 19 // ActivityManager. | 20 // ActivityManager. |
| 20 // The connection object returned may be used with a subsequent call to | |
| 21 // CancelStartSandboxedProcess(). | |
| 22 // The created process handle is returned to the |callback| on success, 0 is | 21 // The created process handle is returned to the |callback| on success, 0 is |
| 23 // retuned if the process could not be created. | 22 // retuned if the process could not be created. |
| 24 base::android::ScopedJavaLocalRef<jobject> StartSandboxedProcess( | 23 void StartSandboxedProcess( |
| 25 const CommandLine::StringVector& argv, | 24 const CommandLine::StringVector& argv, |
| 26 int ipc_fd, | 25 int ipc_fd, |
| 27 int crash_fd, | 26 const base::GlobalDescriptors::Mapping& files_to_register, |
| 28 const StartSandboxedProcessCallback& callback); | 27 const StartSandboxedProcessCallback& callback); |
| 29 | 28 |
| 30 // Cancel the starting of a sanboxed process. | |
| 31 // | |
| 32 // |connection| is the one returned by StartSandboxedProcess. | |
| 33 void CancelStartSandboxedProcess( | |
| 34 const base::android::JavaRef<jobject>& connection); | |
| 35 | |
| 36 // Stops a sandboxed process based on the handle returned form | 29 // Stops a sandboxed process based on the handle returned form |
| 37 // StartSandboxedProcess. | 30 // StartSandboxedProcess. |
| 38 void StopSandboxedProcess(base::ProcessHandle handle); | 31 void StopSandboxedProcess(base::ProcessHandle handle); |
| 39 | 32 |
| 40 // Registers JNI methods, this must be called before any other methods in this | 33 // Registers JNI methods, this must be called before any other methods in this |
| 41 // file. | 34 // file. |
| 42 bool RegisterSandboxedProcessLauncher(JNIEnv* env); | 35 bool RegisterSandboxedProcessLauncher(JNIEnv* env); |
| 43 | 36 |
| 44 } // namespace content | 37 } // namespace content |
| 45 | 38 |
| 46 #endif // CONTENT_BROWSER_ANDROID_SANDBOXED_PROCESS_LAUNCHER_H_ | 39 #endif // CONTENT_BROWSER_ANDROID_SANDBOXED_PROCESS_LAUNCHER_H_ |
| 40 |
| OLD | NEW |