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" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // Removes a ShellImpl when it encounters an error. | 139 // Removes a ShellImpl when it encounters an error. |
140 void OnShellImplError(ShellImpl* shell_impl); | 140 void OnShellImplError(ShellImpl* shell_impl); |
141 | 141 |
142 private: | 142 private: |
143 class ContentHandlerConnection; | 143 class ContentHandlerConnection; |
144 | 144 |
145 using URLToLoaderMap = std::map<GURL, scoped_ptr<ApplicationLoader>>; | 145 using URLToLoaderMap = std::map<GURL, scoped_ptr<ApplicationLoader>>; |
146 using SchemeToLoaderMap = | 146 using SchemeToLoaderMap = |
147 std::map<std::string, scoped_ptr<ApplicationLoader>>; | 147 std::map<std::string, scoped_ptr<ApplicationLoader>>; |
148 using IdentityToShellImplMap = std::map<Identity, scoped_ptr<ShellImpl>>; | 148 using IdentityToShellImplMap = std::map<Identity, scoped_ptr<ShellImpl>>; |
149 using URLToContentHandlerMap = | 149 using IdentityToContentHandlerMap = |
150 std::map<GURL, scoped_ptr<ContentHandlerConnection>>; | 150 std::map<Identity, scoped_ptr<ContentHandlerConnection>>; |
151 using URLToArgsMap = std::map<GURL, std::vector<std::string>>; | 151 using URLToArgsMap = std::map<GURL, std::vector<std::string>>; |
152 using MimeTypeToURLMap = std::map<std::string, GURL>; | 152 using MimeTypeToURLMap = std::map<std::string, GURL>; |
153 using URLToNativeOptionsMap = std::map<GURL, NativeApplicationOptions>; | 153 using URLToNativeOptionsMap = std::map<GURL, NativeApplicationOptions>; |
154 | 154 |
155 void ConnectToApplicationWithParameters( | 155 void ConnectToApplicationWithParameters( |
156 const GURL& application_url, | 156 const GURL& application_url, |
157 const GURL& requestor_url, | 157 const GURL& requestor_url, |
158 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 158 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
159 mojo::ServiceProviderPtr exposed_services, | 159 mojo::ServiceProviderPtr exposed_services, |
160 const base::Closure& on_application_end, | 160 const base::Closure& on_application_end, |
161 const std::vector<std::string>& pre_redirect_parameters); | 161 const std::vector<std::string>& pre_redirect_parameters); |
162 | 162 |
163 bool ConnectToRunningApplication( | 163 bool ConnectToRunningApplication( |
164 const GURL& resolved_url, | 164 const GURL& resolved_url, |
165 const GURL& requestor_url, | 165 const GURL& requestor_url, |
166 mojo::InterfaceRequest<mojo::ServiceProvider>* services, | 166 mojo::InterfaceRequest<mojo::ServiceProvider>* services, |
167 mojo::ServiceProviderPtr* exposed_services); | 167 mojo::ServiceProviderPtr* exposed_services); |
168 | 168 |
169 bool ConnectToApplicationWithLoader( | 169 bool ConnectToApplicationWithLoader( |
170 const GURL& resolved_url, | 170 const GURL& resolved_url, |
171 const GURL& requestor_url, | 171 const GURL& requestor_url, |
172 mojo::InterfaceRequest<mojo::ServiceProvider>* services, | 172 mojo::InterfaceRequest<mojo::ServiceProvider>* services, |
173 mojo::ServiceProviderPtr* exposed_services, | 173 mojo::ServiceProviderPtr* exposed_services, |
174 const base::Closure& on_application_end, | 174 const base::Closure& on_application_end, |
175 const std::vector<std::string>& parameters, | 175 const std::vector<std::string>& parameters, |
176 ApplicationLoader* loader); | 176 ApplicationLoader* loader); |
177 | 177 |
| 178 // Creates an Identity for the service identified by |resolved_url|. |
| 179 // If |new_process_per_connection| is true for the URL's options, then the |
| 180 // identity is unique. Otherwise, repeated invocations with the same |
| 181 // |resolved_url| will result in an equivalent Identity. |
| 182 Identity MakeApplicationIdentity(const GURL& resolved_url); |
| 183 |
178 mojo::InterfaceRequest<mojo::Application> RegisterShell( | 184 mojo::InterfaceRequest<mojo::Application> RegisterShell( |
179 // The URL after resolution and redirects, including the querystring. | 185 // The URL after resolution and redirects, including the querystring. |
180 const GURL& resolved_url, | 186 const GURL& resolved_url, |
181 const GURL& requestor_url, | 187 const GURL& requestor_url, |
182 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 188 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
183 mojo::ServiceProviderPtr exposed_services, | 189 mojo::ServiceProviderPtr exposed_services, |
184 const base::Closure& on_application_end, | 190 const base::Closure& on_application_end, |
185 const std::vector<std::string>& parameters); | 191 const std::vector<std::string>& parameters); |
186 | 192 |
187 ShellImpl* GetShellImpl(const GURL& url); | 193 ShellImpl* GetShellImpl(const GURL& url); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 const Options options_; | 233 const Options options_; |
228 Delegate* const delegate_; | 234 Delegate* const delegate_; |
229 // Loader management. | 235 // Loader management. |
230 // Loaders are chosen in the order they are listed here. | 236 // Loaders are chosen in the order they are listed here. |
231 URLToLoaderMap url_to_loader_; | 237 URLToLoaderMap url_to_loader_; |
232 SchemeToLoaderMap scheme_to_loader_; | 238 SchemeToLoaderMap scheme_to_loader_; |
233 scoped_ptr<ApplicationLoader> default_loader_; | 239 scoped_ptr<ApplicationLoader> default_loader_; |
234 scoped_ptr<NativeRunnerFactory> native_runner_factory_; | 240 scoped_ptr<NativeRunnerFactory> native_runner_factory_; |
235 | 241 |
236 IdentityToShellImplMap identity_to_shell_impl_; | 242 IdentityToShellImplMap identity_to_shell_impl_; |
237 URLToContentHandlerMap url_to_content_handler_; | 243 IdentityToContentHandlerMap identity_to_content_handler_; |
238 URLToArgsMap url_to_args_; | 244 URLToArgsMap url_to_args_; |
239 // Note: The keys are URLs after mapping and resolving. | 245 // Note: The keys are URLs after mapping and resolving. |
240 URLToNativeOptionsMap url_to_native_options_; | 246 URLToNativeOptionsMap url_to_native_options_; |
241 | 247 |
242 base::SequencedWorkerPool* blocking_pool_; | 248 base::SequencedWorkerPool* blocking_pool_; |
243 mojo::URLResponseDiskCachePtr url_response_disk_cache_; | 249 mojo::URLResponseDiskCachePtr url_response_disk_cache_; |
244 mojo::NetworkServicePtr network_service_; | 250 mojo::NetworkServicePtr network_service_; |
245 mojo::NetworkServicePtr authenticating_network_service_; | 251 mojo::NetworkServicePtr authenticating_network_service_; |
246 MimeTypeToURLMap mime_type_to_url_; | 252 MimeTypeToURLMap mime_type_to_url_; |
247 ScopedVector<NativeRunner> native_runners_; | 253 ScopedVector<NativeRunner> native_runners_; |
248 bool initialized_authentication_interceptor_; | 254 bool initialized_authentication_interceptor_; |
249 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; | 255 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; |
250 | 256 |
251 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); | 257 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); |
252 }; | 258 }; |
253 | 259 |
254 } // namespace shell | 260 } // namespace shell |
255 | 261 |
256 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ | 262 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ |
OLD | NEW |