Chromium Code Reviews| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 // Provide a callback to be notified whenever an instance is destroyed. | 73 // Provide a callback to be notified whenever an instance is destroyed. |
| 74 // Typically the creator of the ApplicationManager will use this to determine | 74 // Typically the creator of the ApplicationManager will use this to determine |
| 75 // when some set of instances it created are destroyed, so it can shut down. | 75 // when some set of instances it created are destroyed, so it can shut down. |
| 76 void SetInstanceQuitCallback(base::Callback<void(const Identity&)> callback); | 76 void SetInstanceQuitCallback(base::Callback<void(const Identity&)> callback); |
| 77 | 77 |
| 78 // Completes a connection between a source and target application as defined | 78 // Completes a connection between a source and target application as defined |
| 79 // by |params|, exchanging InterfaceProviders between them. If no existing | 79 // by |params|, exchanging InterfaceProviders between them. If no existing |
| 80 // instance of the target application is running, one will be loaded. | 80 // instance of the target application is running, one will be loaded. |
| 81 void Connect(scoped_ptr<ConnectParams> params); | 81 void Connect(scoped_ptr<ConnectParams> params); |
| 82 | 82 |
| 83 // Creates a new ApplicationInstance identified as |url|. This is intended for | |
| 84 // use by the ApplicationManager's embedder to register itself with the shell. | |
| 85 // |url| is never resolves, there mmust not have an existing instance for the | |
|
Ben Goodger (Google)
2016/02/25 04:53:37
please re-read this sentence and fix all the typos
Ken Rockot(use gerrit already)
2016/02/25 05:08:24
yikes - fixed
| |
| 86 // given URL. This must only be called once. | |
| 87 mojom::ShellClientRequest InitInstanceForEmbedder(const GURL& url); | |
| 88 | |
| 83 // Sets the default Loader to be used if not overridden by SetLoaderForURL(). | 89 // Sets the default Loader to be used if not overridden by SetLoaderForURL(). |
| 84 void set_default_loader(scoped_ptr<ApplicationLoader> loader) { | 90 void set_default_loader(scoped_ptr<ApplicationLoader> loader) { |
| 85 default_loader_ = std::move(loader); | 91 default_loader_ = std::move(loader); |
| 86 } | 92 } |
| 87 | 93 |
| 88 // Sets a Loader to be used for a specific url. | 94 // Sets a Loader to be used for a specific url. |
| 89 void SetLoaderForURL(scoped_ptr<ApplicationLoader> loader, const GURL& url); | 95 void SetLoaderForURL(scoped_ptr<ApplicationLoader> loader, const GURL& url); |
| 90 | 96 |
| 91 // Destroys all Shell-ends of connections established with Applications. | 97 // Destroys all Shell-ends of connections established with Applications. |
| 92 // Applications connected by this ApplicationManager will observe pipe errors | 98 // Applications connected by this ApplicationManager will observe pipe errors |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 // Loaders are chosen in the order they are listed here. | 180 // Loaders are chosen in the order they are listed here. |
| 175 URLToLoaderMap url_to_loader_; | 181 URLToLoaderMap url_to_loader_; |
| 176 scoped_ptr<ApplicationLoader> default_loader_; | 182 scoped_ptr<ApplicationLoader> default_loader_; |
| 177 | 183 |
| 178 IdentityToInstanceMap identity_to_instance_; | 184 IdentityToInstanceMap identity_to_instance_; |
| 179 | 185 |
| 180 IdentityToShellClientFactoryMap shell_client_factories_; | 186 IdentityToShellClientFactoryMap shell_client_factories_; |
| 181 // Counter used to assign ids to content handlers. | 187 // Counter used to assign ids to content handlers. |
| 182 uint32_t shell_client_factory_id_counter_; | 188 uint32_t shell_client_factory_id_counter_; |
| 183 | 189 |
| 190 // The ApplicationInstance created by the shell embedder, if any. | |
| 191 ApplicationInstance* embedder_instance_ = nullptr; | |
| 192 | |
| 184 WeakInterfacePtrSet<mojom::ApplicationManagerListener> listeners_; | 193 WeakInterfacePtrSet<mojom::ApplicationManagerListener> listeners_; |
| 185 | 194 |
| 186 base::Callback<void(const Identity&)> instance_quit_callback_; | 195 base::Callback<void(const Identity&)> instance_quit_callback_; |
| 187 base::TaskRunner* file_task_runner_; | 196 base::TaskRunner* file_task_runner_; |
| 188 scoped_ptr<NativeRunnerFactory> native_runner_factory_; | 197 scoped_ptr<NativeRunnerFactory> native_runner_factory_; |
| 189 std::vector<scoped_ptr<NativeRunner>> native_runners_; | 198 std::vector<scoped_ptr<NativeRunner>> native_runners_; |
| 190 scoped_ptr<ShellConnection> shell_connection_; | 199 scoped_ptr<ShellConnection> shell_connection_; |
| 191 WeakBindingSet<mojom::ApplicationManager> bindings_; | 200 WeakBindingSet<mojom::ApplicationManager> bindings_; |
| 192 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; | 201 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; |
| 193 | 202 |
| 194 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); | 203 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); |
| 195 }; | 204 }; |
| 196 | 205 |
| 197 mojom::Shell::ConnectCallback EmptyConnectCallback(); | 206 mojom::Shell::ConnectCallback EmptyConnectCallback(); |
| 198 | 207 |
| 199 } // namespace shell | 208 } // namespace shell |
| 200 } // namespace mojo | 209 } // namespace mojo |
| 201 | 210 |
| 202 #endif // MOJO_SHELL_APPLICATION_MANAGER_H_ | 211 #endif // MOJO_SHELL_APPLICATION_MANAGER_H_ |
| OLD | NEW |