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_SHELL_H_ | 5 #ifndef MOJO_SHELL_SHELL_H_ |
6 #define MOJO_SHELL_SHELL_H_ | 6 #define MOJO_SHELL_SHELL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 // Callback when remote Catalog resolves mojo:foo to mojo:bar. | 148 // Callback when remote Catalog resolves mojo:foo to mojo:bar. |
149 // |params| are the params passed to Connect(). | 149 // |params| are the params passed to Connect(). |
150 // |client| if provided is a ShellClientPtr which should be used to manage the | 150 // |client| if provided is a ShellClientPtr which should be used to manage the |
151 // new application instance. This may be null. | 151 // new application instance. This may be null. |
152 // |resolved_name| is the mojo: name identifying the physical package | 152 // |resolved_name| is the mojo: name identifying the physical package |
153 // application. | 153 // application. |
154 // |file_url| is the resolved file:// URL of the physical package. | 154 // |file_url| is the resolved file:// URL of the physical package. |
155 // |capabilities| is the CapabilitySpecPtr the requested application should be | 155 // |capabilities| is the CapabilitySpecPtr the requested application should be |
156 // run with, from its manifest. | 156 // run with, from its manifest. |
157 void OnGotResolvedName(scoped_ptr<ConnectParams> params, | 157 void OnGotResolvedName(mojom::ShellResolverPtr resolver, |
| 158 scoped_ptr<ConnectParams> params, |
158 mojom::ShellClientPtr client, | 159 mojom::ShellClientPtr client, |
159 const String& resolved_name, | 160 const String& resolved_name, |
160 const String& resolved_instance, | 161 const String& resolved_instance, |
161 mojom::CapabilitySpecPtr capabilities, | 162 mojom::CapabilitySpecPtr capabilities, |
162 const String& file_url); | 163 const String& file_url); |
163 | 164 |
164 // Tries to load |target| with an Loader. Returns true if one was registered | 165 // Tries to load |target| with an Loader. Returns true if one was registered |
165 // and it was loaded, in which case |request| is taken. | 166 // and it was loaded, in which case |request| is taken. |
166 bool LoadWithLoader(const Identity& target, | 167 bool LoadWithLoader(const Identity& target, |
167 mojom::ShellClientRequest* request); | 168 mojom::ShellClientRequest* request); |
168 | 169 |
169 // Returns the appropriate loader for |name|, or the default loader if there | 170 // Returns the appropriate loader for |name|, or the default loader if there |
170 // is no loader configured for the name. | 171 // is no loader configured for the name. |
171 Loader* GetLoaderForName(const std::string& name); | 172 Loader* GetLoaderForName(const std::string& name); |
172 | 173 |
173 void CleanupRunner(NativeRunner* runner); | 174 void CleanupRunner(NativeRunner* runner); |
174 | 175 |
175 mojom::ShellResolverPtr shell_resolver_; | |
176 | |
177 // Loader management. | 176 // Loader management. |
178 // Loaders are chosen in the order they are listed here. | 177 // Loaders are chosen in the order they are listed here. |
179 NameToLoaderMap name_to_loader_; | 178 NameToLoaderMap name_to_loader_; |
180 scoped_ptr<Loader> default_loader_; | 179 scoped_ptr<Loader> default_loader_; |
181 | 180 |
182 IdentityToInstanceMap identity_to_instance_; | 181 IdentityToInstanceMap identity_to_instance_; |
183 | 182 |
184 IdentityToShellClientFactoryMap shell_client_factories_; | 183 IdentityToShellClientFactoryMap shell_client_factories_; |
185 // Counter used to assign ids to content handlers. | 184 // Counter used to assign ids to content handlers. |
186 uint32_t shell_client_factory_id_counter_; | 185 uint32_t shell_client_factory_id_counter_; |
187 | 186 |
188 InterfacePtrSet<mojom::InstanceListener> instance_listeners_; | 187 InterfacePtrSet<mojom::InstanceListener> instance_listeners_; |
189 | 188 |
190 base::Callback<void(const Identity&)> instance_quit_callback_; | 189 base::Callback<void(const Identity&)> instance_quit_callback_; |
191 scoped_ptr<NativeRunnerFactory> native_runner_factory_; | 190 scoped_ptr<NativeRunnerFactory> native_runner_factory_; |
192 std::vector<scoped_ptr<NativeRunner>> native_runners_; | 191 std::vector<scoped_ptr<NativeRunner>> native_runners_; |
193 scoped_ptr<ShellConnection> shell_connection_; | 192 scoped_ptr<ShellConnection> shell_connection_; |
194 base::WeakPtrFactory<Shell> weak_ptr_factory_; | 193 base::WeakPtrFactory<Shell> weak_ptr_factory_; |
195 | 194 |
196 DISALLOW_COPY_AND_ASSIGN(Shell); | 195 DISALLOW_COPY_AND_ASSIGN(Shell); |
197 }; | 196 }; |
198 | 197 |
199 mojom::Connector::ConnectCallback EmptyConnectCallback(); | 198 mojom::Connector::ConnectCallback EmptyConnectCallback(); |
200 | 199 |
201 } // namespace shell | 200 } // namespace shell |
202 } // namespace mojo | 201 } // namespace mojo |
203 | 202 |
204 #endif // MOJO_SHELL_SHELL_H_ | 203 #endif // MOJO_SHELL_SHELL_H_ |
OLD | NEW |