OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef SHELL_OUT_OF_PROCESS_NATIVE_RUNNER_H_ | |
6 #define SHELL_OUT_OF_PROCESS_NATIVE_RUNNER_H_ | |
7 | |
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/application_manager/native_runner.h" | |
14 | |
15 namespace mojo { | |
16 namespace shell { | |
17 | |
18 class ChildProcessHost; | |
19 class Context; | |
20 | |
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 NativeRunner { | |
24 public: | |
25 explicit OutOfProcessNativeRunner(Context* context); | |
26 ~OutOfProcessNativeRunner() override; | |
27 | |
28 // |NativeRunner| method: | |
29 void Start(const base::FilePath& app_path, | |
30 NativeApplicationCleanup cleanup, | |
31 InterfaceRequest<Application> application_request, | |
32 const base::Closure& app_completed_callback) override; | |
33 | |
34 private: | |
35 // |ChildController::StartApp()| callback: | |
36 void AppCompleted(int32_t result); | |
37 | |
38 Context* const context_; | |
39 | |
40 base::FilePath app_path_; | |
41 base::Closure app_completed_callback_; | |
42 | |
43 scoped_ptr<ChildProcessHost> child_process_host_; | |
44 | |
45 DISALLOW_COPY_AND_ASSIGN(OutOfProcessNativeRunner); | |
46 }; | |
47 | |
48 class OutOfProcessNativeRunnerFactory : public NativeRunnerFactory { | |
49 public: | |
50 explicit OutOfProcessNativeRunnerFactory(Context* context) | |
51 : context_(context) {} | |
52 ~OutOfProcessNativeRunnerFactory() override {} | |
53 | |
54 scoped_ptr<NativeRunner> Create(const Options& options) override; | |
55 | |
56 private: | |
57 Context* const context_; | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(OutOfProcessNativeRunnerFactory); | |
60 }; | |
61 | |
62 } // namespace shell | |
63 } // namespace mojo | |
64 | |
65 #endif // SHELL_OUT_OF_PROCESS_NATIVE_RUNNER_H_ | |
OLD | NEW |