mandoline: Enable the sandbox on clipboard and tracing.
[chromium-blink-merge.git] / mojo / runner / out_of_process_native_runner.h
blobdccee56136edfade48abd4996cc6d725e51eb87f
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MOJO_RUNNER_OUT_OF_PROCESS_NATIVE_RUNNER_H_
6 #define MOJO_RUNNER_OUT_OF_PROCESS_NATIVE_RUNNER_H_
8 #include "base/callback.h"
9 #include "base/files/file_path.h"
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "mojo/public/cpp/bindings/error_handler.h"
13 #include "mojo/shell/native_runner.h"
15 namespace mojo {
16 namespace runner {
18 class ChildProcessHost;
19 class Context;
21 // An implementation of |NativeRunner| that loads/runs the given app (from the
22 // file system) in a separate process (of its own).
23 class OutOfProcessNativeRunner : public shell::NativeRunner {
24 public:
25 explicit OutOfProcessNativeRunner(Context* context);
26 ~OutOfProcessNativeRunner() override;
28 // |NativeRunner| method:
29 void Start(const base::FilePath& app_path,
30 bool start_sandboxed,
31 shell::NativeApplicationCleanup cleanup,
32 InterfaceRequest<Application> application_request,
33 const base::Closure& app_completed_callback) override;
35 private:
36 // |ChildController::StartApp()| callback:
37 void AppCompleted(int32_t result);
39 Context* const context_;
41 base::FilePath app_path_;
42 base::Closure app_completed_callback_;
44 scoped_ptr<ChildProcessHost> child_process_host_;
46 DISALLOW_COPY_AND_ASSIGN(OutOfProcessNativeRunner);
49 class OutOfProcessNativeRunnerFactory : public shell::NativeRunnerFactory {
50 public:
51 explicit OutOfProcessNativeRunnerFactory(Context* context)
52 : context_(context) {}
53 ~OutOfProcessNativeRunnerFactory() override {}
55 scoped_ptr<shell::NativeRunner> Create(const Options& options) override;
57 private:
58 Context* const context_;
60 DISALLOW_COPY_AND_ASSIGN(OutOfProcessNativeRunnerFactory);
63 } // namespace runner
64 } // namespace mojo
66 #endif // MOJO_RUNNER_OUT_OF_PROCESS_NATIVE_RUNNER_H_