Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 24 #include "url/gurl.h" | 24 #include "url/gurl.h" |
| 25 | 25 |
| 26 namespace base { | 26 namespace base { |
| 27 class FilePath; | 27 class FilePath; |
| 28 class SequencedWorkerPool; | 28 class SequencedWorkerPool; |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace mojo { | 31 namespace mojo { |
| 32 namespace shell { | 32 namespace shell { |
| 33 | 33 |
| 34 class ContentHandlerConnection; | |
| 34 class ShellImpl; | 35 class ShellImpl; |
| 35 | 36 |
| 36 class ApplicationManager { | 37 class ApplicationManager { |
| 37 public: | 38 public: |
| 38 class Delegate { | 39 class Delegate { |
| 39 public: | 40 public: |
| 40 // Gives the delegate a chance to apply any mappings for the specified url. | 41 // Gives the delegate a chance to apply any mappings for the specified url. |
| 41 // This should not resolve 'mojo' urls, that is done by ResolveMojoURL(). | 42 // This should not resolve 'mojo' urls, that is done by ResolveMojoURL(). |
| 42 virtual GURL ResolveMappings(const GURL& url) = 0; | 43 virtual GURL ResolveMappings(const GURL& url) = 0; |
| 43 | 44 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 | 138 |
| 138 // Destroys all Shell-ends of connections established with Applications. | 139 // Destroys all Shell-ends of connections established with Applications. |
| 139 // Applications connected by this ApplicationManager will observe pipe errors | 140 // Applications connected by this ApplicationManager will observe pipe errors |
| 140 // and have a chance to shutdown. | 141 // and have a chance to shutdown. |
| 141 void TerminateShellConnections(); | 142 void TerminateShellConnections(); |
| 142 | 143 |
| 143 // Removes a ShellImpl when it encounters an error. | 144 // Removes a ShellImpl when it encounters an error. |
| 144 void OnShellImplError(ShellImpl* shell_impl); | 145 void OnShellImplError(ShellImpl* shell_impl); |
| 145 | 146 |
| 146 private: | 147 private: |
| 147 class ContentHandlerConnection; | 148 friend class ContentHandlerConnection; |
|
jam
2015/07/09 17:27:23
now that it't not an inner class, the friend decla
Fady Samuel
2015/07/09 17:49:21
Done.
| |
| 148 | 149 |
| 149 using ApplicationPackagedAlias = std::map<GURL, std::pair<GURL, std::string>>; | 150 using ApplicationPackagedAlias = std::map<GURL, std::pair<GURL, std::string>>; |
| 150 using IdentityToShellImplMap = std::map<Identity, ShellImpl*>; | 151 using IdentityToShellImplMap = std::map<Identity, ShellImpl*>; |
| 151 using MimeTypeToURLMap = std::map<std::string, GURL>; | 152 using MimeTypeToURLMap = std::map<std::string, GURL>; |
| 152 using SchemeToLoaderMap = std::map<std::string, ApplicationLoader*>; | 153 using SchemeToLoaderMap = std::map<std::string, ApplicationLoader*>; |
| 153 using URLToContentHandlerMap = | 154 using URLToContentHandlerMap = |
| 154 std::map<std::pair<GURL, std::string>, ContentHandlerConnection*>; | 155 std::map<std::pair<GURL, std::string>, ContentHandlerConnection*>; |
| 155 using URLToLoaderMap = std::map<GURL, ApplicationLoader*>; | 156 using URLToLoaderMap = std::map<GURL, ApplicationLoader*>; |
| 156 using URLToNativeOptionsMap = std::map<GURL, NativeRunnerFactory::Options>; | 157 using URLToNativeOptionsMap = std::map<GURL, NativeRunnerFactory::Options>; |
| 157 | 158 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 void LoadWithContentHandler(const GURL& content_handler_url, | 217 void LoadWithContentHandler(const GURL& content_handler_url, |
| 217 const GURL& requestor_url, | 218 const GURL& requestor_url, |
| 218 const std::string& qualifier, | 219 const std::string& qualifier, |
| 219 InterfaceRequest<Application> application_request, | 220 InterfaceRequest<Application> application_request, |
| 220 URLResponsePtr url_response); | 221 URLResponsePtr url_response); |
| 221 | 222 |
| 222 // Returns the appropriate loader for |url|, or null if there is no loader | 223 // Returns the appropriate loader for |url|, or null if there is no loader |
| 223 // configured for the URL. | 224 // configured for the URL. |
| 224 ApplicationLoader* GetLoaderForURL(const GURL& url); | 225 ApplicationLoader* GetLoaderForURL(const GURL& url); |
| 225 | 226 |
| 226 // Removes a ContentHandler when it encounters an error. | 227 // Removes a ContentHandler when its connection is closed. |
| 227 void OnContentHandlerError(ContentHandlerConnection* content_handler); | 228 void OnContentHandlerConnectionClosed( |
| 229 ContentHandlerConnection* content_handler); | |
| 228 | 230 |
| 229 void CleanupRunner(NativeRunner* runner); | 231 void CleanupRunner(NativeRunner* runner); |
| 230 | 232 |
| 231 Delegate* const delegate_; | 233 Delegate* const delegate_; |
| 232 // Loader management. | 234 // Loader management. |
| 233 // Loaders are chosen in the order they are listed here. | 235 // Loaders are chosen in the order they are listed here. |
| 234 URLToLoaderMap url_to_loader_; | 236 URLToLoaderMap url_to_loader_; |
| 235 SchemeToLoaderMap scheme_to_loader_; | 237 SchemeToLoaderMap scheme_to_loader_; |
| 236 scoped_ptr<ApplicationLoader> default_loader_; | 238 scoped_ptr<ApplicationLoader> default_loader_; |
| 237 scoped_ptr<NativeRunnerFactory> native_runner_factory_; | 239 scoped_ptr<NativeRunnerFactory> native_runner_factory_; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 250 bool disable_cache_; | 252 bool disable_cache_; |
| 251 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; | 253 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; |
| 252 | 254 |
| 253 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); | 255 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); |
| 254 }; | 256 }; |
| 255 | 257 |
| 256 } // namespace shell | 258 } // namespace shell |
| 257 } // namespace mojo | 259 } // namespace mojo |
| 258 | 260 |
| 259 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ | 261 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ |
| OLD | NEW |