Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: mojo/shell/application_manager.h

Issue 1228743002: Mandoline: Move ContentHandlerConnection into separate file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed jam's comments Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 const GURL& url); 137 const GURL& url);
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
147 // Removes a ContentHandler when its connection is closed.
148 void OnContentHandlerConnectionClosed(
149 ContentHandlerConnection* content_handler);
150
146 private: 151 private:
147 class ContentHandlerConnection;
148
149 using ApplicationPackagedAlias = std::map<GURL, std::pair<GURL, std::string>>; 152 using ApplicationPackagedAlias = std::map<GURL, std::pair<GURL, std::string>>;
150 using IdentityToShellImplMap = std::map<Identity, ShellImpl*>; 153 using IdentityToShellImplMap = std::map<Identity, ShellImpl*>;
151 using MimeTypeToURLMap = std::map<std::string, GURL>; 154 using MimeTypeToURLMap = std::map<std::string, GURL>;
152 using SchemeToLoaderMap = std::map<std::string, ApplicationLoader*>; 155 using SchemeToLoaderMap = std::map<std::string, ApplicationLoader*>;
153 using URLToContentHandlerMap = 156 using URLToContentHandlerMap =
154 std::map<std::pair<GURL, std::string>, ContentHandlerConnection*>; 157 std::map<std::pair<GURL, std::string>, ContentHandlerConnection*>;
155 using URLToLoaderMap = std::map<GURL, ApplicationLoader*>; 158 using URLToLoaderMap = std::map<GURL, ApplicationLoader*>;
156 using URLToNativeOptionsMap = std::map<GURL, NativeRunnerFactory::Options>; 159 using URLToNativeOptionsMap = std::map<GURL, NativeRunnerFactory::Options>;
157 160
158 void ConnectToApplicationInternal( 161 void ConnectToApplicationInternal(
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 void LoadWithContentHandler(const GURL& content_handler_url, 219 void LoadWithContentHandler(const GURL& content_handler_url,
217 const GURL& requestor_url, 220 const GURL& requestor_url,
218 const std::string& qualifier, 221 const std::string& qualifier,
219 InterfaceRequest<Application> application_request, 222 InterfaceRequest<Application> application_request,
220 URLResponsePtr url_response); 223 URLResponsePtr url_response);
221 224
222 // Returns the appropriate loader for |url|, or null if there is no loader 225 // Returns the appropriate loader for |url|, or null if there is no loader
223 // configured for the URL. 226 // configured for the URL.
224 ApplicationLoader* GetLoaderForURL(const GURL& url); 227 ApplicationLoader* GetLoaderForURL(const GURL& url);
225 228
226 // Removes a ContentHandler when it encounters an error.
227 void OnContentHandlerError(ContentHandlerConnection* content_handler);
228
229 void CleanupRunner(NativeRunner* runner); 229 void CleanupRunner(NativeRunner* runner);
230 230
231 Delegate* const delegate_; 231 Delegate* const delegate_;
232 // Loader management. 232 // Loader management.
233 // Loaders are chosen in the order they are listed here. 233 // Loaders are chosen in the order they are listed here.
234 URLToLoaderMap url_to_loader_; 234 URLToLoaderMap url_to_loader_;
235 SchemeToLoaderMap scheme_to_loader_; 235 SchemeToLoaderMap scheme_to_loader_;
236 scoped_ptr<ApplicationLoader> default_loader_; 236 scoped_ptr<ApplicationLoader> default_loader_;
237 scoped_ptr<NativeRunnerFactory> native_runner_factory_; 237 scoped_ptr<NativeRunnerFactory> native_runner_factory_;
238 238
(...skipping 11 matching lines...) Expand all
250 bool disable_cache_; 250 bool disable_cache_;
251 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; 251 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_;
252 252
253 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); 253 DISALLOW_COPY_AND_ASSIGN(ApplicationManager);
254 }; 254 };
255 255
256 } // namespace shell 256 } // namespace shell
257 } // namespace mojo 257 } // namespace mojo
258 258
259 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ 259 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698