Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / mojo / runner / out_of_process_native_runner.h
blob5cd1b5e7bd7afb290973ffaa3ec162cac0cdc418
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/shell/native_runner.h"
14 namespace mojo {
15 namespace runner {
17 class ChildProcessHost;
18 class Context;
20 // An implementation of |NativeRunner| that loads/runs the given app (from the
21 // file system) in a separate process (of its own).
22 class OutOfProcessNativeRunner : public shell::NativeRunner {
23 public:
24 explicit OutOfProcessNativeRunner(Context* context);
25 ~OutOfProcessNativeRunner() override;
27 // |NativeRunner| method:
28 void Start(const base::FilePath& app_path,
29 bool start_sandboxed,
30 InterfaceRequest<Application> application_request,
31 const base::Closure& app_completed_callback) override;
33 private:
34 // |ChildController::StartApp()| callback:
35 void AppCompleted(int32_t result);
37 Context* const context_;
39 base::FilePath app_path_;
40 base::Closure app_completed_callback_;
42 scoped_ptr<ChildProcessHost> child_process_host_;
44 DISALLOW_COPY_AND_ASSIGN(OutOfProcessNativeRunner);
47 class OutOfProcessNativeRunnerFactory : public shell::NativeRunnerFactory {
48 public:
49 explicit OutOfProcessNativeRunnerFactory(Context* context)
50 : context_(context) {}
51 ~OutOfProcessNativeRunnerFactory() override {}
53 scoped_ptr<shell::NativeRunner> Create() override;
55 private:
56 Context* const context_;
58 DISALLOW_COPY_AND_ASSIGN(OutOfProcessNativeRunnerFactory);
61 } // namespace runner
62 } // namespace mojo
64 #endif // MOJO_RUNNER_OUT_OF_PROCESS_NATIVE_RUNNER_H_