| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 ptr->Bind(service_handle.Pass()); | 82 ptr->Bind(service_handle.Pass()); |
| 83 } | 83 } |
| 84 | 84 |
| 85 ScopedMessagePipeHandle ConnectToServiceByName( | 85 ScopedMessagePipeHandle ConnectToServiceByName( |
| 86 const GURL& application_url, | 86 const GURL& application_url, |
| 87 const std::string& interface_name); | 87 const std::string& interface_name); |
| 88 | 88 |
| 89 void RegisterContentHandler(const std::string& mime_type, | 89 void RegisterContentHandler(const std::string& mime_type, |
| 90 const GURL& content_handler_url); | 90 const GURL& content_handler_url); |
| 91 | 91 |
| 92 // Registers a package redirect. When attempting to load |alias|, it will |
| 93 // instead redirect to |content_handler_package|, which is a content handler |
| 94 // which will be passed the |alias| as the URLResponse::url. |
| 95 void RegisterApplicationPackageRedirect(const GURL& alias, |
| 96 const GURL& content_handler_package); |
| 97 |
| 92 // Sets the default Loader to be used if not overridden by SetLoaderForURL() | 98 // Sets the default Loader to be used if not overridden by SetLoaderForURL() |
| 93 // or SetLoaderForScheme(). | 99 // or SetLoaderForScheme(). |
| 94 void set_default_loader(scoped_ptr<ApplicationLoader> loader) { | 100 void set_default_loader(scoped_ptr<ApplicationLoader> loader) { |
| 95 default_loader_ = loader.Pass(); | 101 default_loader_ = loader.Pass(); |
| 96 } | 102 } |
| 97 void set_native_runner_factory( | 103 void set_native_runner_factory( |
| 98 scoped_ptr<NativeRunnerFactory> runner_factory) { | 104 scoped_ptr<NativeRunnerFactory> runner_factory) { |
| 99 native_runner_factory_ = runner_factory.Pass(); | 105 native_runner_factory_ = runner_factory.Pass(); |
| 100 } | 106 } |
| 101 void set_blocking_pool(base::SequencedWorkerPool* blocking_pool) { | 107 void set_blocking_pool(base::SequencedWorkerPool* blocking_pool) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 121 // Applications connected by this ApplicationManager will observe pipe errors | 127 // Applications connected by this ApplicationManager will observe pipe errors |
| 122 // and have a chance to shutdown. | 128 // and have a chance to shutdown. |
| 123 void TerminateShellConnections(); | 129 void TerminateShellConnections(); |
| 124 | 130 |
| 125 // Removes a ShellImpl when it encounters an error. | 131 // Removes a ShellImpl when it encounters an error. |
| 126 void OnShellImplError(ShellImpl* shell_impl); | 132 void OnShellImplError(ShellImpl* shell_impl); |
| 127 | 133 |
| 128 private: | 134 private: |
| 129 class ContentHandlerConnection; | 135 class ContentHandlerConnection; |
| 130 | 136 |
| 131 typedef std::map<std::string, ApplicationLoader*> SchemeToLoaderMap; | 137 using ApplicationPackagedRedirect = std::map<GURL, GURL>; |
| 132 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap; | 138 using IdentityToShellImplMap = std::map<Identity, ShellImpl*>; |
| 133 typedef std::map<Identity, ShellImpl*> IdentityToShellImplMap; | 139 using MimeTypeToURLMap = std::map<std::string, GURL>; |
| 134 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap; | 140 using SchemeToLoaderMap = std::map<std::string, ApplicationLoader*>; |
| 135 typedef std::map<std::string, GURL> MimeTypeToURLMap; | 141 using URLToContentHandlerMap = std::map<GURL, ContentHandlerConnection*>; |
| 136 typedef std::map<GURL, NativeRunnerFactory::Options> URLToNativeOptionsMap; | 142 using URLToLoaderMap = std::map<GURL, ApplicationLoader*>; |
| 143 using URLToNativeOptionsMap = std::map<GURL, NativeRunnerFactory::Options>; |
| 137 | 144 |
| 138 void ConnectToApplicationWithParameters( | 145 void ConnectToApplicationWithParameters( |
| 139 const GURL& application_url, | 146 const GURL& application_url, |
| 140 const GURL& requestor_url, | 147 const GURL& requestor_url, |
| 141 InterfaceRequest<ServiceProvider> services, | 148 InterfaceRequest<ServiceProvider> services, |
| 142 ServiceProviderPtr exposed_services, | 149 ServiceProviderPtr exposed_services, |
| 143 const base::Closure& on_application_end, | 150 const base::Closure& on_application_end, |
| 144 const std::vector<std::string>& pre_redirect_parameters); | 151 const std::vector<std::string>& pre_redirect_parameters); |
| 145 | 152 |
| 146 bool ConnectToRunningApplication(const GURL& resolved_url, | 153 bool ConnectToRunningApplication(const GURL& resolved_url, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 void CleanupRunner(NativeRunner* runner); | 213 void CleanupRunner(NativeRunner* runner); |
| 207 | 214 |
| 208 Delegate* const delegate_; | 215 Delegate* const delegate_; |
| 209 // Loader management. | 216 // Loader management. |
| 210 // Loaders are chosen in the order they are listed here. | 217 // Loaders are chosen in the order they are listed here. |
| 211 URLToLoaderMap url_to_loader_; | 218 URLToLoaderMap url_to_loader_; |
| 212 SchemeToLoaderMap scheme_to_loader_; | 219 SchemeToLoaderMap scheme_to_loader_; |
| 213 scoped_ptr<ApplicationLoader> default_loader_; | 220 scoped_ptr<ApplicationLoader> default_loader_; |
| 214 scoped_ptr<NativeRunnerFactory> native_runner_factory_; | 221 scoped_ptr<NativeRunnerFactory> native_runner_factory_; |
| 215 | 222 |
| 223 ApplicationPackagedRedirect application_package_redirect_; |
| 216 IdentityToShellImplMap identity_to_shell_impl_; | 224 IdentityToShellImplMap identity_to_shell_impl_; |
| 217 URLToContentHandlerMap url_to_content_handler_; | 225 URLToContentHandlerMap url_to_content_handler_; |
| 218 // Note: The keys are URLs after mapping and resolving. | 226 // Note: The keys are URLs after mapping and resolving. |
| 219 URLToNativeOptionsMap url_to_native_options_; | 227 URLToNativeOptionsMap url_to_native_options_; |
| 220 | 228 |
| 221 base::SequencedWorkerPool* blocking_pool_; | 229 base::SequencedWorkerPool* blocking_pool_; |
| 222 NetworkServicePtr network_service_; | 230 NetworkServicePtr network_service_; |
| 223 MimeTypeToURLMap mime_type_to_url_; | 231 MimeTypeToURLMap mime_type_to_url_; |
| 224 ScopedVector<NativeRunner> native_runners_; | 232 ScopedVector<NativeRunner> native_runners_; |
| 225 bool disable_cache_; | 233 bool disable_cache_; |
| 226 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; | 234 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; |
| 227 | 235 |
| 228 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); | 236 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); |
| 229 }; | 237 }; |
| 230 | 238 |
| 231 } // namespace shell | 239 } // namespace shell |
| 232 } // namespace mojo | 240 } // namespace mojo |
| 233 | 241 |
| 234 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ | 242 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ |
| OLD | NEW |