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 MOJO_SHELL_APPLICATION_MANAGER_H_ | 5 #ifndef MOJO_SHELL_APPLICATION_MANAGER_H_ |
6 #define MOJO_SHELL_APPLICATION_MANAGER_H_ | 6 #define MOJO_SHELL_APPLICATION_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // Provide a callback to be notified whenever an instance is destroyed. | 76 // Provide a callback to be notified whenever an instance is destroyed. |
77 // Typically the creator of the ApplicationManager will use this to determine | 77 // Typically the creator of the ApplicationManager will use this to determine |
78 // when some set of instances it created are destroyed, so it can shut down. | 78 // when some set of instances it created are destroyed, so it can shut down. |
79 void SetInstanceQuitCallback(base::Callback<void(const Identity&)> callback); | 79 void SetInstanceQuitCallback(base::Callback<void(const Identity&)> callback); |
80 | 80 |
81 // Completes a connection between a source and target application as defined | 81 // Completes a connection between a source and target application as defined |
82 // by |params|, exchanging InterfaceProviders between them. If no existing | 82 // by |params|, exchanging InterfaceProviders between them. If no existing |
83 // instance of the target application is running, one will be loaded. | 83 // instance of the target application is running, one will be loaded. |
84 void Connect(scoped_ptr<ConnectParams> params); | 84 void Connect(scoped_ptr<ConnectParams> params); |
85 | 85 |
| 86 // Creates a new ApplicationInstance identified as |url|. This is intended for |
| 87 // use by the ApplicationManager's embedder to register itself with the shell. |
| 88 // The URL is never resolved and there must not be an existing instance |
| 89 // associated with it. This must only be called once. |
| 90 mojom::ShellClientRequest InitInstanceForEmbedder(const GURL& url); |
| 91 |
86 // Sets the default Loader to be used if not overridden by SetLoaderForURL(). | 92 // Sets the default Loader to be used if not overridden by SetLoaderForURL(). |
87 void set_default_loader(scoped_ptr<ApplicationLoader> loader) { | 93 void set_default_loader(scoped_ptr<ApplicationLoader> loader) { |
88 default_loader_ = std::move(loader); | 94 default_loader_ = std::move(loader); |
89 } | 95 } |
90 | 96 |
91 // Sets a Loader to be used for a specific url. | 97 // Sets a Loader to be used for a specific url. |
92 void SetLoaderForURL(scoped_ptr<ApplicationLoader> loader, const GURL& url); | 98 void SetLoaderForURL(scoped_ptr<ApplicationLoader> loader, const GURL& url); |
93 | 99 |
94 // Destroys all Shell-ends of connections established with Applications. | 100 // Destroys all Shell-ends of connections established with Applications. |
95 // Applications connected by this ApplicationManager will observe pipe errors | 101 // Applications connected by this ApplicationManager will observe pipe errors |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // Loaders are chosen in the order they are listed here. | 185 // Loaders are chosen in the order they are listed here. |
180 URLToLoaderMap url_to_loader_; | 186 URLToLoaderMap url_to_loader_; |
181 scoped_ptr<ApplicationLoader> default_loader_; | 187 scoped_ptr<ApplicationLoader> default_loader_; |
182 | 188 |
183 IdentityToInstanceMap identity_to_instance_; | 189 IdentityToInstanceMap identity_to_instance_; |
184 | 190 |
185 IdentityToShellClientFactoryMap shell_client_factories_; | 191 IdentityToShellClientFactoryMap shell_client_factories_; |
186 // Counter used to assign ids to content handlers. | 192 // Counter used to assign ids to content handlers. |
187 uint32_t shell_client_factory_id_counter_; | 193 uint32_t shell_client_factory_id_counter_; |
188 | 194 |
| 195 // The ApplicationInstance created by the shell embedder, if any. |
| 196 ApplicationInstance* embedder_instance_ = nullptr; |
| 197 |
189 InterfacePtrSet<mojom::ApplicationManagerListener> listeners_; | 198 InterfacePtrSet<mojom::ApplicationManagerListener> listeners_; |
190 | 199 |
191 base::Callback<void(const Identity&)> instance_quit_callback_; | 200 base::Callback<void(const Identity&)> instance_quit_callback_; |
192 base::TaskRunner* file_task_runner_; | 201 base::TaskRunner* file_task_runner_; |
193 scoped_ptr<NativeRunnerFactory> native_runner_factory_; | 202 scoped_ptr<NativeRunnerFactory> native_runner_factory_; |
194 std::vector<scoped_ptr<NativeRunner>> native_runners_; | 203 std::vector<scoped_ptr<NativeRunner>> native_runners_; |
195 scoped_ptr<ShellConnection> shell_connection_; | 204 scoped_ptr<ShellConnection> shell_connection_; |
196 BindingSet<mojom::ApplicationManager> bindings_; | 205 BindingSet<mojom::ApplicationManager> bindings_; |
197 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; | 206 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; |
198 | 207 |
199 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); | 208 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); |
200 }; | 209 }; |
201 | 210 |
202 mojom::Connector::ConnectCallback EmptyConnectCallback(); | 211 mojom::Connector::ConnectCallback EmptyConnectCallback(); |
203 | 212 |
204 } // namespace shell | 213 } // namespace shell |
205 } // namespace mojo | 214 } // namespace mojo |
206 | 215 |
207 #endif // MOJO_SHELL_APPLICATION_MANAGER_H_ | 216 #endif // MOJO_SHELL_APPLICATION_MANAGER_H_ |
OLD | NEW |