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

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

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