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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 // |task_runner| provides access to a thread to perform file copy operations | 64 // |task_runner| provides access to a thread to perform file copy operations |
65 // on. This may be null only in testing environments where applications are | 65 // on. This may be null only in testing environments where applications are |
66 // loaded via ApplicationLoader implementations. | 66 // loaded via ApplicationLoader implementations. |
67 // When |register_mojo_url_schemes| is true, mojo: and exe: URL schems are | 67 // When |register_mojo_url_schemes| is true, mojo: and exe: URL schems are |
68 // registered as "standard" which faciliates resolving. | 68 // registered as "standard" which faciliates resolving. |
69 ApplicationManager(scoped_ptr<NativeRunnerFactory> native_runner_factory, | 69 ApplicationManager(scoped_ptr<NativeRunnerFactory> native_runner_factory, |
70 base::TaskRunner* task_runner, | 70 base::TaskRunner* task_runner, |
71 bool register_mojo_url_schemes); | 71 bool register_mojo_url_schemes); |
72 ~ApplicationManager() override; | 72 ~ApplicationManager() override; |
73 | 73 |
74 void SetInstanceQuitCallback(base::Callback<void(const Identity&)> callback); | |
sky
2016/02/19 05:20:51
Document what this means.
| |
75 | |
74 // Completes a connection between a source and target application as defined | 76 // Completes a connection between a source and target application as defined |
75 // by |params|, exchanging InterfaceProviders between them. If no existing | 77 // by |params|, exchanging InterfaceProviders between them. If no existing |
76 // instance of the target application is running, one will be loaded. | 78 // instance of the target application is running, one will be loaded. |
77 void Connect(scoped_ptr<ConnectParams> params); | 79 void Connect(scoped_ptr<ConnectParams> params); |
78 | 80 |
79 // Sets the default Loader to be used if not overridden by SetLoaderForURL(). | 81 // Sets the default Loader to be used if not overridden by SetLoaderForURL(). |
80 void set_default_loader(scoped_ptr<ApplicationLoader> loader) { | 82 void set_default_loader(scoped_ptr<ApplicationLoader> loader) { |
81 default_loader_ = std::move(loader); | 83 default_loader_ = std::move(loader); |
82 } | 84 } |
83 | 85 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 | 120 |
119 void InitPackageManager(bool register_mojo_url_schemes); | 121 void InitPackageManager(bool register_mojo_url_schemes); |
120 | 122 |
121 // Attempt to complete the connection requested by |params| by connecting to | 123 // Attempt to complete the connection requested by |params| by connecting to |
122 // an existing instance. If there is an existing instance, |params| is taken, | 124 // an existing instance. If there is an existing instance, |params| is taken, |
123 // and this function returns true. | 125 // and this function returns true. |
124 bool ConnectToInstance(scoped_ptr<ConnectParams>* params); | 126 bool ConnectToInstance(scoped_ptr<ConnectParams>* params); |
125 | 127 |
126 ApplicationInstance* CreateInstance( | 128 ApplicationInstance* CreateInstance( |
127 const Identity& target_id, | 129 const Identity& target_id, |
128 const base::Closure& on_application_end, | |
129 const String& application_name, | 130 const String& application_name, |
130 mojom::ShellClientRequest* request); | 131 mojom::ShellClientRequest* request); |
131 | 132 |
132 void CreateShellClient(const Identity& source, | 133 void CreateShellClient(const Identity& source, |
133 const Identity& shell_client_factory, | 134 const Identity& shell_client_factory, |
134 const GURL& url, | 135 const GURL& url, |
135 mojom::ShellClientRequest request); | 136 mojom::ShellClientRequest request); |
136 // Returns a running ShellClientFactory for |shell_client_factory_identity|, | 137 // Returns a running ShellClientFactory for |shell_client_factory_identity|, |
137 // if there is not one running one is started for |source_identity|. | 138 // if there is not one running one is started for |source_identity|. |
138 mojom::ShellClientFactory* GetShellClientFactory( | 139 mojom::ShellClientFactory* GetShellClientFactory( |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 scoped_ptr<ApplicationLoader> default_loader_; | 178 scoped_ptr<ApplicationLoader> default_loader_; |
178 | 179 |
179 IdentityToInstanceMap identity_to_instance_; | 180 IdentityToInstanceMap identity_to_instance_; |
180 | 181 |
181 IdentityToShellClientFactoryMap shell_client_factories_; | 182 IdentityToShellClientFactoryMap shell_client_factories_; |
182 // Counter used to assign ids to content handlers. | 183 // Counter used to assign ids to content handlers. |
183 uint32_t shell_client_factory_id_counter_; | 184 uint32_t shell_client_factory_id_counter_; |
184 | 185 |
185 WeakInterfacePtrSet<mojom::ApplicationManagerListener> listeners_; | 186 WeakInterfacePtrSet<mojom::ApplicationManagerListener> listeners_; |
186 | 187 |
188 base::Callback<void(const Identity&)> instance_quit_callback_; | |
187 base::TaskRunner* task_runner_; | 189 base::TaskRunner* task_runner_; |
188 scoped_ptr<NativeRunnerFactory> native_runner_factory_; | 190 scoped_ptr<NativeRunnerFactory> native_runner_factory_; |
189 std::vector<scoped_ptr<NativeRunner>> native_runners_; | 191 std::vector<scoped_ptr<NativeRunner>> native_runners_; |
190 WeakBindingSet<mojom::ApplicationManager> bindings_; | 192 WeakBindingSet<mojom::ApplicationManager> bindings_; |
191 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; | 193 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; |
192 | 194 |
193 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); | 195 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); |
194 }; | 196 }; |
195 | 197 |
196 mojom::Shell::ConnectCallback EmptyConnectCallback(); | 198 mojom::Shell::ConnectCallback EmptyConnectCallback(); |
197 | 199 |
198 } // namespace shell | 200 } // namespace shell |
199 } // namespace mojo | 201 } // namespace mojo |
200 | 202 |
201 #endif // MOJO_SHELL_APPLICATION_MANAGER_H_ | 203 #endif // MOJO_SHELL_APPLICATION_MANAGER_H_ |
OLD | NEW |