| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_BACKGROUND_BACKGROUND_SHELL_H_ | 5 #ifndef MOJO_SHELL_BACKGROUND_BACKGROUND_SHELL_H_ |
| 6 #define MOJO_SHELL_BACKGROUND_BACKGROUND_SHELL_H_ | 6 #define MOJO_SHELL_BACKGROUND_BACKGROUND_SHELL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 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 "mojo/public/cpp/bindings/interface_request.h" | 12 #include "mojo/public/cpp/bindings/interface_request.h" |
| 13 #include "mojo/services/package_manager/package_manager.h" | 13 #include "mojo/services/catalog/catalog.h" |
| 14 #include "mojo/shell/public/interfaces/shell_client.mojom.h" | 14 #include "mojo/shell/public/interfaces/shell_client.mojom.h" |
| 15 | 15 |
| 16 namespace package_manager { | 16 namespace catalog { |
| 17 class ApplicationCatalogStore; | 17 class Store; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace mojo { | 20 namespace mojo { |
| 21 namespace shell { | 21 namespace shell { |
| 22 | 22 |
| 23 class NativeRunnerDelegate; | 23 class NativeRunnerDelegate; |
| 24 | 24 |
| 25 // BackgroundShell starts up the mojo shell on a background thread, and | 25 // BackgroundShell starts up the mojo shell on a background thread, and |
| 26 // destroys the thread in the destructor. Once created use CreateApplication() | 26 // destroys the thread in the destructor. Once created use CreateApplication() |
| 27 // to obtain an InterfaceRequest for the Application. The InterfaceRequest can | 27 // to obtain an InterfaceRequest for the Application. The InterfaceRequest can |
| 28 // then be bound to an ApplicationImpl. | 28 // then be bound to an ApplicationImpl. |
| 29 class BackgroundShell { | 29 class BackgroundShell { |
| 30 public: | 30 public: |
| 31 struct InitParams { | 31 struct InitParams { |
| 32 InitParams(); | 32 InitParams(); |
| 33 ~InitParams(); | 33 ~InitParams(); |
| 34 | 34 |
| 35 NativeRunnerDelegate* native_runner_delegate = nullptr; | 35 NativeRunnerDelegate* native_runner_delegate = nullptr; |
| 36 scoped_ptr<package_manager::ApplicationCatalogStore> app_catalog; | 36 scoped_ptr<catalog::Store> catalog_store; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 BackgroundShell(); | 39 BackgroundShell(); |
| 40 ~BackgroundShell(); | 40 ~BackgroundShell(); |
| 41 | 41 |
| 42 // Starts the background shell. |command_line_switches| are additional | 42 // Starts the background shell. |command_line_switches| are additional |
| 43 // switches applied to any processes spawned by this call. | 43 // switches applied to any processes spawned by this call. |
| 44 void Init(scoped_ptr<InitParams> init_params); | 44 void Init(scoped_ptr<InitParams> init_params); |
| 45 | 45 |
| 46 // Obtains an InterfaceRequest for the specified name. | 46 // Obtains an InterfaceRequest for the specified name. |
| 47 mojom::ShellClientRequest CreateShellClientRequest( | 47 mojom::ShellClientRequest CreateShellClientRequest( |
| 48 const std::string& name); | 48 const std::string& name); |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 class MojoThread; | 51 class MojoThread; |
| 52 | 52 |
| 53 scoped_ptr<MojoThread> thread_; | 53 scoped_ptr<MojoThread> thread_; |
| 54 | 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(BackgroundShell); | 55 DISALLOW_COPY_AND_ASSIGN(BackgroundShell); |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 } // namespace shell | 58 } // namespace shell |
| 59 } // namespace mojo | 59 } // namespace mojo |
| 60 | 60 |
| 61 #endif // MOJO_SHELL_BACKGROUND_BACKGROUND_SHELL_H_ | 61 #endif // MOJO_SHELL_BACKGROUND_BACKGROUND_SHELL_H_ |
| OLD | NEW |