OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SHELL_APPLICATION_MANAGER_NATIVE_RUNNER_H_ |
| 6 #define SHELL_APPLICATION_MANAGER_NATIVE_RUNNER_H_ |
| 7 |
| 8 #include "base/callback_forward.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "mojo/public/cpp/bindings/interface_request.h" |
| 11 #include "mojo/public/interfaces/application/application.mojom.h" |
| 12 #include "mojo/shell/native_application_support.h" |
| 13 |
| 14 namespace base { |
| 15 class FilePath; |
| 16 } |
| 17 |
| 18 namespace mojo { |
| 19 namespace shell { |
| 20 |
| 21 // ApplicationManager requires implementations of NativeRunner and |
| 22 // NativeRunnerFactory to run native applications. |
| 23 class NativeRunner { |
| 24 public: |
| 25 virtual ~NativeRunner() {} |
| 26 |
| 27 // Loads the app in the file at |app_path| and runs it on some other |
| 28 // thread/process. If |cleanup| is |DELETE|, this takes ownership of the file. |
| 29 // |app_completed_callback| is posted (to the thread on which |Start()| was |
| 30 // called) after |MojoMain()| completes. |
| 31 // TODO(vtl): |app_path| and |cleanup| should probably be moved to the |
| 32 // factory's Create(). Rationale: The factory may need information from the |
| 33 // file to decide what kind of NativeRunner to make. |
| 34 virtual void Start(const base::FilePath& app_path, |
| 35 NativeApplicationCleanup cleanup, |
| 36 InterfaceRequest<Application> application_request, |
| 37 const base::Closure& app_completed_callback) = 0; |
| 38 }; |
| 39 |
| 40 class NativeRunnerFactory { |
| 41 public: |
| 42 // Options for running the native app. (This will contain, e.g., information |
| 43 // about the sandbox profile, etc.) |
| 44 struct Options { |
| 45 // Constructs with default options. |
| 46 Options() : force_in_process(false) {} |
| 47 |
| 48 bool force_in_process; |
| 49 }; |
| 50 |
| 51 virtual ~NativeRunnerFactory() {} |
| 52 virtual scoped_ptr<NativeRunner> Create(const Options& options) = 0; |
| 53 }; |
| 54 |
| 55 } // namespace shell |
| 56 } // namespace mojo |
| 57 |
| 58 #endif // SHELL_APPLICATION_MANAGER_NATIVE_RUNNER_H_ |
OLD | NEW |