| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 MOJO_SHELL_NATIVE_RUNNER_H_ | 5 #ifndef MOJO_SHELL_NATIVE_RUNNER_H_ |
| 6 #define MOJO_SHELL_NATIVE_RUNNER_H_ | 6 #define MOJO_SHELL_NATIVE_RUNNER_H_ |
| 7 | 7 |
| 8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
| 11 #include "mojo/public/cpp/bindings/interface_request.h" | 11 #include "mojo/public/cpp/bindings/interface_request.h" |
| 12 #include "mojo/shell/public/interfaces/shell_client.mojom.h" | 12 #include "mojo/shell/public/interfaces/shell_client.mojom.h" |
| 13 #include "mojo/shell/public/interfaces/shell_client_factory.mojom.h" |
| 13 | 14 |
| 14 namespace base { | 15 namespace base { |
| 15 class FilePath; | 16 class FilePath; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace mojo { | 19 namespace mojo { |
| 19 namespace shell { | 20 namespace shell { |
| 20 | 21 |
| 21 class Identity; | 22 class Identity; |
| 22 | 23 |
| 23 // ApplicationManager requires implementations of NativeRunner and | 24 // ApplicationManager requires implementations of NativeRunner and |
| 24 // NativeRunnerFactory to run native applications. | 25 // NativeRunnerFactory to run native applications. |
| 25 class NativeRunner { | 26 class NativeRunner { |
| 26 public: | 27 public: |
| 27 virtual ~NativeRunner() {} | 28 virtual ~NativeRunner() {} |
| 28 | 29 |
| 29 // Loads the app in the file at |app_path| and runs it on some other | 30 // Loads the app in the file at |app_path| and runs it on some other |
| 30 // thread/process. | 31 // thread/process. |
| 31 virtual void Start( | 32 virtual void Start( |
| 32 const base::FilePath& app_path, | 33 const base::FilePath& app_path, |
| 33 const Identity& target, | 34 const Identity& target, |
| 34 bool start_sandboxed, | 35 bool start_sandboxed, |
| 35 InterfaceRequest<mojom::ShellClient> request, | 36 InterfaceRequest<mojom::ShellClient> request, |
| 36 const base::Callback<void(base::ProcessId)>& pid_available_callback, | 37 const base::Callback<void(base::ProcessId)>& pid_available_callback, |
| 37 const base::Closure& app_completed_callback) = 0; | 38 const base::Closure& app_completed_callback) = 0; |
| 38 | 39 |
| 39 // Like Start(), but used to initialize the host for a child process started | 40 // Like Start(), but used to initialize the host for a child process started |
| 40 // by someone else. Provides |request| via |channel|. | 41 // by someone else. Provides |request| via |factory|. |
| 41 virtual void InitHost(ScopedHandle channel, | 42 virtual void InitHost(mojom::ShellClientFactoryPtr factory, |
| 42 InterfaceRequest<mojom::ShellClient> request) = 0; | 43 const String& name, |
| 44 mojom::ShellClientRequest request) = 0; |
| 43 }; | 45 }; |
| 44 | 46 |
| 45 class NativeRunnerFactory { | 47 class NativeRunnerFactory { |
| 46 public: | 48 public: |
| 47 virtual ~NativeRunnerFactory() {} | 49 virtual ~NativeRunnerFactory() {} |
| 48 virtual scoped_ptr<NativeRunner> Create(const base::FilePath& app_path) = 0; | 50 virtual scoped_ptr<NativeRunner> Create(const base::FilePath& app_path) = 0; |
| 49 }; | 51 }; |
| 50 | 52 |
| 51 } // namespace shell | 53 } // namespace shell |
| 52 } // namespace mojo | 54 } // namespace mojo |
| 53 | 55 |
| 54 #endif // MOJO_SHELL_NATIVE_RUNNER_H_ | 56 #endif // MOJO_SHELL_NATIVE_RUNNER_H_ |
| OLD | NEW |