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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 void TerminateShellConnections(); | 126 void TerminateShellConnections(); |
126 | 127 |
127 // Removes a ShellImpl when it encounters an error. | 128 // Removes a ShellImpl when it encounters an error. |
128 void OnShellImplError(ShellImpl* shell_impl); | 129 void OnShellImplError(ShellImpl* shell_impl); |
129 | 130 |
130 private: | 131 private: |
131 class ContentHandlerConnection; | 132 class ContentHandlerConnection; |
132 | 133 |
133 typedef std::map<std::string, ApplicationLoader*> SchemeToLoaderMap; | 134 typedef std::map<std::string, ApplicationLoader*> SchemeToLoaderMap; |
134 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap; | 135 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap; |
135 typedef std::map<GURL, ShellImpl*> URLToShellImplMap; | 136 typedef std::map<Identity, ShellImpl*> IdentityToShellImplMap; |
136 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap; | 137 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap; |
137 typedef std::map<GURL, std::vector<std::string>> URLToArgsMap; | 138 typedef std::map<GURL, std::vector<std::string>> URLToArgsMap; |
138 typedef std::map<std::string, GURL> MimeTypeToURLMap; | 139 typedef std::map<std::string, GURL> MimeTypeToURLMap; |
139 typedef std::map<GURL, NativeRunnerFactory::Options> URLToNativeOptionsMap; | 140 typedef std::map<GURL, NativeRunnerFactory::Options> URLToNativeOptionsMap; |
140 | 141 |
141 bool ConnectToRunningApplication(const GURL& resolved_url, | 142 bool ConnectToRunningApplication(const GURL& resolved_url, |
142 const GURL& requestor_url, | 143 const GURL& requestor_url, |
143 InterfaceRequest<ServiceProvider>* services, | 144 InterfaceRequest<ServiceProvider>* services, |
144 ServiceProviderPtr* exposed_services); | 145 ServiceProviderPtr* exposed_services); |
145 | 146 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 void CleanupRunner(NativeRunner* runner); | 202 void CleanupRunner(NativeRunner* runner); |
202 | 203 |
203 Delegate* const delegate_; | 204 Delegate* const delegate_; |
204 // Loader management. | 205 // Loader management. |
205 // Loaders are chosen in the order they are listed here. | 206 // Loaders are chosen in the order they are listed here. |
206 URLToLoaderMap url_to_loader_; | 207 URLToLoaderMap url_to_loader_; |
207 SchemeToLoaderMap scheme_to_loader_; | 208 SchemeToLoaderMap scheme_to_loader_; |
208 scoped_ptr<ApplicationLoader> default_loader_; | 209 scoped_ptr<ApplicationLoader> default_loader_; |
209 scoped_ptr<NativeRunnerFactory> native_runner_factory_; | 210 scoped_ptr<NativeRunnerFactory> native_runner_factory_; |
210 | 211 |
211 URLToShellImplMap url_to_shell_impl_; | 212 IdentityToShellImplMap identity_to_shell_impl_; |
212 URLToContentHandlerMap url_to_content_handler_; | 213 URLToContentHandlerMap url_to_content_handler_; |
213 URLToArgsMap url_to_args_; | 214 URLToArgsMap url_to_args_; |
214 // Note: The keys are URLs after mapping and resolving. | 215 // Note: The keys are URLs after mapping and resolving. |
215 URLToNativeOptionsMap url_to_native_options_; | 216 URLToNativeOptionsMap url_to_native_options_; |
216 | 217 |
217 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; | 218 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; |
218 | 219 |
219 base::SequencedWorkerPool* blocking_pool_; | 220 base::SequencedWorkerPool* blocking_pool_; |
220 NetworkServicePtr network_service_; | 221 NetworkServicePtr network_service_; |
221 MimeTypeToURLMap mime_type_to_url_; | 222 MimeTypeToURLMap mime_type_to_url_; |
222 ScopedVector<NativeRunner> native_runners_; | 223 ScopedVector<NativeRunner> native_runners_; |
223 bool disable_cache_; | 224 bool disable_cache_; |
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 |