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

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

Issue 1057603003: Simplify mojo_shell since it's now only used for Mandoline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update scripts Created 5 years, 8 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
« no previous file with comments | « mojo/shell/android/main.cc ('k') | mojo/shell/application_manager/application_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 ptr->Bind(service_handle.Pass()); 76 ptr->Bind(service_handle.Pass());
77 } 77 }
78 78
79 ScopedMessagePipeHandle ConnectToServiceByName( 79 ScopedMessagePipeHandle ConnectToServiceByName(
80 const GURL& application_url, 80 const GURL& application_url,
81 const std::string& interface_name); 81 const std::string& interface_name);
82 82
83 void RegisterContentHandler(const std::string& mime_type, 83 void RegisterContentHandler(const std::string& mime_type,
84 const GURL& content_handler_url); 84 const GURL& content_handler_url);
85 85
86 void RegisterExternalApplication(const GURL& application_url,
87 const std::vector<std::string>& args,
88 ApplicationPtr application);
89
90 // Sets the default Loader to be used if not overridden by SetLoaderForURL() 86 // Sets the default Loader to be used if not overridden by SetLoaderForURL()
91 // or SetLoaderForScheme(). 87 // or SetLoaderForScheme().
92 void set_default_loader(scoped_ptr<ApplicationLoader> loader) { 88 void set_default_loader(scoped_ptr<ApplicationLoader> loader) {
93 default_loader_ = loader.Pass(); 89 default_loader_ = loader.Pass();
94 } 90 }
95 void set_native_runner_factory( 91 void set_native_runner_factory(
96 scoped_ptr<NativeRunnerFactory> runner_factory) { 92 scoped_ptr<NativeRunnerFactory> runner_factory) {
97 native_runner_factory_ = runner_factory.Pass(); 93 native_runner_factory_ = runner_factory.Pass();
98 } 94 }
99 void set_blocking_pool(base::SequencedWorkerPool* blocking_pool) { 95 void set_blocking_pool(base::SequencedWorkerPool* blocking_pool) {
100 blocking_pool_ = blocking_pool; 96 blocking_pool_ = blocking_pool;
101 } 97 }
102 void set_disable_cache(bool disable_cache) { disable_cache_ = disable_cache; } 98 void set_disable_cache(bool disable_cache) { disable_cache_ = disable_cache; }
103 // Sets a Loader to be used for a specific url. 99 // Sets a Loader to be used for a specific url.
104 void SetLoaderForURL(scoped_ptr<ApplicationLoader> loader, const GURL& url); 100 void SetLoaderForURL(scoped_ptr<ApplicationLoader> loader, const GURL& url);
105 // Sets a Loader to be used for a specific url scheme. 101 // Sets a Loader to be used for a specific url scheme.
106 void SetLoaderForScheme(scoped_ptr<ApplicationLoader> loader, 102 void SetLoaderForScheme(scoped_ptr<ApplicationLoader> loader,
107 const std::string& scheme); 103 const std::string& scheme);
108 // These strings will be passed to the Initialize() method when an Application
109 // is instantiated.
110 // TODO(vtl): Maybe we should store/compare resolved URLs, like
111 // SetNativeOptionsForURL() below?
112 void SetArgsForURL(const std::vector<std::string>& args, const GURL& url);
113 // These options will be used in running any native application at |url| 104 // These options will be used in running any native application at |url|
114 // (which shouldn't contain a query string). (|url| will be mapped and 105 // (which shouldn't contain a query string). (|url| will be mapped and
115 // resolved, and any application whose base resolved URL matches it will have 106 // resolved, and any application whose base resolved URL matches it will have
116 // |options| applied.) 107 // |options| applied.)
117 // TODO(vtl): This may not do what's desired if the resolved URL results in an 108 // TODO(vtl): This may not do what's desired if the resolved URL results in an
118 // HTTP redirect. Really, we want options to be identified with a particular 109 // HTTP redirect. Really, we want options to be identified with a particular
119 // implementation, maybe via a signed manifest or something like that. 110 // implementation, maybe via a signed manifest or something like that.
120 void SetNativeOptionsForURL(const NativeRunnerFactory::Options& options, 111 void SetNativeOptionsForURL(const NativeRunnerFactory::Options& options,
121 const GURL& url); 112 const GURL& url);
122 113
123 // Destroys all Shell-ends of connections established with Applications. 114 // Destroys all Shell-ends of connections established with Applications.
124 // Applications connected by this ApplicationManager will observe pipe errors 115 // Applications connected by this ApplicationManager will observe pipe errors
125 // and have a chance to shutdown. 116 // and have a chance to shutdown.
126 void TerminateShellConnections(); 117 void TerminateShellConnections();
127 118
128 // Removes a ShellImpl when it encounters an error. 119 // Removes a ShellImpl when it encounters an error.
129 void OnShellImplError(ShellImpl* shell_impl); 120 void OnShellImplError(ShellImpl* shell_impl);
130 121
131 private: 122 private:
132 class ContentHandlerConnection; 123 class ContentHandlerConnection;
133 124
134 typedef std::map<std::string, ApplicationLoader*> SchemeToLoaderMap; 125 typedef std::map<std::string, ApplicationLoader*> SchemeToLoaderMap;
135 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap; 126 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap;
136 typedef std::map<Identity, ShellImpl*> IdentityToShellImplMap; 127 typedef std::map<Identity, ShellImpl*> IdentityToShellImplMap;
137 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap; 128 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap;
138 typedef std::map<GURL, std::vector<std::string>> URLToArgsMap;
139 typedef std::map<std::string, GURL> MimeTypeToURLMap; 129 typedef std::map<std::string, GURL> MimeTypeToURLMap;
140 typedef std::map<GURL, NativeRunnerFactory::Options> URLToNativeOptionsMap; 130 typedef std::map<GURL, NativeRunnerFactory::Options> URLToNativeOptionsMap;
141 131
142 void ConnectToApplicationWithParameters( 132 void ConnectToApplicationWithParameters(
143 const GURL& application_url, 133 const GURL& application_url,
144 const GURL& requestor_url, 134 const GURL& requestor_url,
145 InterfaceRequest<ServiceProvider> services, 135 InterfaceRequest<ServiceProvider> services,
146 ServiceProviderPtr exposed_services, 136 ServiceProviderPtr exposed_services,
147 const base::Closure& on_application_end, 137 const base::Closure& on_application_end,
148 const std::vector<std::string>& pre_redirect_parameters); 138 const std::vector<std::string>& pre_redirect_parameters);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 InterfaceRequest<Application> application_request, 187 InterfaceRequest<Application> application_request,
198 URLResponsePtr url_response); 188 URLResponsePtr url_response);
199 189
200 // Returns the appropriate loader for |url|, or null if there is no loader 190 // Returns the appropriate loader for |url|, or null if there is no loader
201 // configured for the URL. 191 // configured for the URL.
202 ApplicationLoader* GetLoaderForURL(const GURL& url); 192 ApplicationLoader* GetLoaderForURL(const GURL& url);
203 193
204 // Removes a ContentHandler when it encounters an error. 194 // Removes a ContentHandler when it encounters an error.
205 void OnContentHandlerError(ContentHandlerConnection* content_handler); 195 void OnContentHandlerError(ContentHandlerConnection* content_handler);
206 196
207 // Returns the arguments for the given url.
208 std::vector<std::string> GetArgsForURL(const GURL& url);
209
210 void CleanupRunner(NativeRunner* runner); 197 void CleanupRunner(NativeRunner* runner);
211 198
212 Delegate* const delegate_; 199 Delegate* const delegate_;
213 // Loader management. 200 // Loader management.
214 // Loaders are chosen in the order they are listed here. 201 // Loaders are chosen in the order they are listed here.
215 URLToLoaderMap url_to_loader_; 202 URLToLoaderMap url_to_loader_;
216 SchemeToLoaderMap scheme_to_loader_; 203 SchemeToLoaderMap scheme_to_loader_;
217 scoped_ptr<ApplicationLoader> default_loader_; 204 scoped_ptr<ApplicationLoader> default_loader_;
218 scoped_ptr<NativeRunnerFactory> native_runner_factory_; 205 scoped_ptr<NativeRunnerFactory> native_runner_factory_;
219 206
220 IdentityToShellImplMap identity_to_shell_impl_; 207 IdentityToShellImplMap identity_to_shell_impl_;
221 URLToContentHandlerMap url_to_content_handler_; 208 URLToContentHandlerMap url_to_content_handler_;
222 URLToArgsMap url_to_args_;
223 // Note: The keys are URLs after mapping and resolving. 209 // Note: The keys are URLs after mapping and resolving.
224 URLToNativeOptionsMap url_to_native_options_; 210 URLToNativeOptionsMap url_to_native_options_;
225 211
226 base::SequencedWorkerPool* blocking_pool_; 212 base::SequencedWorkerPool* blocking_pool_;
227 NetworkServicePtr network_service_; 213 NetworkServicePtr network_service_;
228 MimeTypeToURLMap mime_type_to_url_; 214 MimeTypeToURLMap mime_type_to_url_;
229 ScopedVector<NativeRunner> native_runners_; 215 ScopedVector<NativeRunner> native_runners_;
230 bool disable_cache_; 216 bool disable_cache_;
231 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; 217 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_;
232 218
233 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); 219 DISALLOW_COPY_AND_ASSIGN(ApplicationManager);
234 }; 220 };
235 221
236 } // namespace shell 222 } // namespace shell
237 } // namespace mojo 223 } // namespace mojo
238 224
239 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ 225 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
OLDNEW
« no previous file with comments | « mojo/shell/android/main.cc ('k') | mojo/shell/application_manager/application_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698