| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 SHELL_OUT_OF_PROCESS_NATIVE_RUNNER_H_ | 5 #ifndef SHELL_OUT_OF_PROCESS_NATIVE_RUNNER_H_ |
| 6 #define SHELL_OUT_OF_PROCESS_NATIVE_RUNNER_H_ | 6 #define SHELL_OUT_OF_PROCESS_NATIVE_RUNNER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "shell/application_manager/native_application_options.h" |
| 12 #include "shell/application_manager/native_runner.h" | 13 #include "shell/application_manager/native_runner.h" |
| 13 | 14 |
| 14 namespace shell { | 15 namespace shell { |
| 15 | 16 |
| 16 class Context; | 17 class Context; |
| 17 class ChildProcessHost; | 18 class ChildProcessHost; |
| 18 | 19 |
| 19 // An implementation of |NativeRunner| that loads/runs the given app (from the | 20 // An implementation of |NativeRunner| that loads/runs the given app (from the |
| 20 // file system) in a separate process (of its own). | 21 // file system) in a separate process (of its own). |
| 21 class OutOfProcessNativeRunner : public NativeRunner { | 22 class OutOfProcessNativeRunner : public NativeRunner { |
| 22 public: | 23 public: |
| 23 explicit OutOfProcessNativeRunner(Context* context); | 24 OutOfProcessNativeRunner(Context* context, |
| 25 const NativeApplicationOptions& options); |
| 24 ~OutOfProcessNativeRunner() override; | 26 ~OutOfProcessNativeRunner() override; |
| 25 | 27 |
| 26 // |NativeRunner| method: | 28 // |NativeRunner| method: |
| 27 void Start(const base::FilePath& app_path, | 29 void Start(const base::FilePath& app_path, |
| 28 mojo::InterfaceRequest<mojo::Application> application_request, | 30 mojo::InterfaceRequest<mojo::Application> application_request, |
| 29 const base::Closure& app_completed_callback) override; | 31 const base::Closure& app_completed_callback) override; |
| 30 | 32 |
| 31 private: | 33 private: |
| 32 // |ChildProcessHost::StartApp()| callback: | 34 // |ChildProcessHost::StartApp()| callback: |
| 33 void AppCompleted(int32_t result); | 35 void AppCompleted(int32_t result); |
| 34 | 36 |
| 35 Context* const context_; | 37 Context* const context_; |
| 38 NativeApplicationOptions const options_; |
| 36 | 39 |
| 37 base::FilePath app_path_; | 40 base::FilePath app_path_; |
| 38 base::Closure app_completed_callback_; | 41 base::Closure app_completed_callback_; |
| 39 | 42 |
| 40 scoped_ptr<ChildProcessHost> child_process_host_; | 43 scoped_ptr<ChildProcessHost> child_process_host_; |
| 41 | 44 |
| 42 DISALLOW_COPY_AND_ASSIGN(OutOfProcessNativeRunner); | 45 DISALLOW_COPY_AND_ASSIGN(OutOfProcessNativeRunner); |
| 43 }; | 46 }; |
| 44 | 47 |
| 45 class OutOfProcessNativeRunnerFactory : public NativeRunnerFactory { | 48 class OutOfProcessNativeRunnerFactory : public NativeRunnerFactory { |
| 46 public: | 49 public: |
| 47 explicit OutOfProcessNativeRunnerFactory(Context* context) | 50 explicit OutOfProcessNativeRunnerFactory(Context* context) |
| 48 : context_(context) {} | 51 : context_(context) {} |
| 49 ~OutOfProcessNativeRunnerFactory() override {} | 52 ~OutOfProcessNativeRunnerFactory() override {} |
| 50 | 53 |
| 51 scoped_ptr<NativeRunner> Create(const Options& options) override; | 54 scoped_ptr<NativeRunner> Create( |
| 55 const NativeApplicationOptions& options) override; |
| 52 | 56 |
| 53 private: | 57 private: |
| 54 Context* const context_; | 58 Context* const context_; |
| 55 | 59 |
| 56 DISALLOW_COPY_AND_ASSIGN(OutOfProcessNativeRunnerFactory); | 60 DISALLOW_COPY_AND_ASSIGN(OutOfProcessNativeRunnerFactory); |
| 57 }; | 61 }; |
| 58 | 62 |
| 59 } // namespace shell | 63 } // namespace shell |
| 60 | 64 |
| 61 #endif // SHELL_OUT_OF_PROCESS_NATIVE_RUNNER_H_ | 65 #endif // SHELL_OUT_OF_PROCESS_NATIVE_RUNNER_H_ |
| OLD | NEW |