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 SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ | 5 #ifndef SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ |
6 #define SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ | 6 #define SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
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 "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "mojo/public/cpp/bindings/interface_request.h" | 14 #include "mojo/public/cpp/bindings/interface_request.h" |
15 #include "mojo/public/interfaces/application/application.mojom.h" | 15 #include "mojo/public/interfaces/application/application.mojom.h" |
16 #include "mojo/public/interfaces/application/service_provider.mojom.h" | 16 #include "mojo/public/interfaces/application/service_provider.mojom.h" |
17 #include "mojo/services/network/public/interfaces/network_service.mojom.h" | 17 #include "mojo/services/network/public/interfaces/network_service.mojom.h" |
18 #include "shell/application_manager/application_loader.h" | 18 #include "shell/application_manager/application_loader.h" |
| 19 #include "shell/application_manager/identity.h" |
19 #include "shell/application_manager/native_runner.h" | 20 #include "shell/application_manager/native_runner.h" |
20 #include "url/gurl.h" | 21 #include "url/gurl.h" |
21 | 22 |
22 namespace base { | 23 namespace base { |
23 class FilePath; | 24 class FilePath; |
24 class SequencedWorkerPool; | 25 class SequencedWorkerPool; |
25 } | 26 } |
26 | 27 |
27 namespace mojo { | 28 namespace mojo { |
28 namespace shell { | 29 namespace shell { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 void TerminateShellConnections(); | 127 void TerminateShellConnections(); |
127 | 128 |
128 // Removes a ShellImpl when it encounters an error. | 129 // Removes a ShellImpl when it encounters an error. |
129 void OnShellImplError(ShellImpl* shell_impl); | 130 void OnShellImplError(ShellImpl* shell_impl); |
130 | 131 |
131 private: | 132 private: |
132 class ContentHandlerConnection; | 133 class ContentHandlerConnection; |
133 | 134 |
134 typedef std::map<std::string, ApplicationLoader*> SchemeToLoaderMap; | 135 typedef std::map<std::string, ApplicationLoader*> SchemeToLoaderMap; |
135 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap; | 136 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap; |
136 typedef std::map<GURL, ShellImpl*> URLToShellImplMap; | 137 typedef std::map<Identity, ShellImpl*> IdentityToShellImplMap; |
137 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap; | 138 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap; |
138 typedef std::map<GURL, std::vector<std::string>> URLToArgsMap; | 139 typedef std::map<GURL, std::vector<std::string>> URLToArgsMap; |
139 typedef std::map<std::string, GURL> MimeTypeToURLMap; | 140 typedef std::map<std::string, GURL> MimeTypeToURLMap; |
140 typedef std::map<GURL, NativeRunnerFactory::Options> URLToNativeOptionsMap; | 141 typedef std::map<GURL, NativeRunnerFactory::Options> URLToNativeOptionsMap; |
141 | 142 |
142 bool ConnectToRunningApplication(const GURL& resolved_url, | 143 bool ConnectToRunningApplication(const GURL& resolved_url, |
143 const GURL& requestor_url, | 144 const GURL& requestor_url, |
144 InterfaceRequest<ServiceProvider>* services, | 145 InterfaceRequest<ServiceProvider>* services, |
145 ServiceProviderPtr* exposed_services); | 146 ServiceProviderPtr* exposed_services); |
146 | 147 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 void CleanupRunner(NativeRunner* runner); | 203 void CleanupRunner(NativeRunner* runner); |
203 | 204 |
204 Delegate* const delegate_; | 205 Delegate* const delegate_; |
205 // Loader management. | 206 // Loader management. |
206 // Loaders are chosen in the order they are listed here. | 207 // Loaders are chosen in the order they are listed here. |
207 URLToLoaderMap url_to_loader_; | 208 URLToLoaderMap url_to_loader_; |
208 SchemeToLoaderMap scheme_to_loader_; | 209 SchemeToLoaderMap scheme_to_loader_; |
209 scoped_ptr<ApplicationLoader> default_loader_; | 210 scoped_ptr<ApplicationLoader> default_loader_; |
210 scoped_ptr<NativeRunnerFactory> native_runner_factory_; | 211 scoped_ptr<NativeRunnerFactory> native_runner_factory_; |
211 | 212 |
212 URLToShellImplMap url_to_shell_impl_; | 213 IdentityToShellImplMap identity_to_shell_impl_; |
213 URLToContentHandlerMap url_to_content_handler_; | 214 URLToContentHandlerMap url_to_content_handler_; |
214 URLToArgsMap url_to_args_; | 215 URLToArgsMap url_to_args_; |
215 // Note: The keys are URLs after mapping and resolving. | 216 // Note: The keys are URLs after mapping and resolving. |
216 URLToNativeOptionsMap url_to_native_options_; | 217 URLToNativeOptionsMap url_to_native_options_; |
217 | 218 |
218 base::SequencedWorkerPool* blocking_pool_; | 219 base::SequencedWorkerPool* blocking_pool_; |
219 NetworkServicePtr network_service_; | 220 NetworkServicePtr network_service_; |
220 MimeTypeToURLMap mime_type_to_url_; | 221 MimeTypeToURLMap mime_type_to_url_; |
221 ScopedVector<NativeRunner> native_runners_; | 222 ScopedVector<NativeRunner> native_runners_; |
222 bool disable_cache_; | 223 bool disable_cache_; |
223 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; | 224 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; |
224 | 225 |
225 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); | 226 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); |
226 }; | 227 }; |
227 | 228 |
228 } // namespace shell | 229 } // namespace shell |
229 } // namespace mojo | 230 } // namespace mojo |
230 | 231 |
231 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ | 232 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ |
OLD | NEW |