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

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

Issue 1378303005: Do some plumbing. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: review Created 5 years, 2 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 | « shell/application_manager/BUILD.gn ('k') | 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"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "mojo/public/cpp/bindings/interface_request.h" 14 #include "mojo/public/cpp/bindings/interface_request.h"
15 #include "mojo/public/interfaces/application/application.mojom.h" 15 #include "mojo/public/interfaces/application/application.mojom.h"
16 #include "mojo/public/interfaces/application/service_provider.mojom.h" 16 #include "mojo/public/interfaces/application/service_provider.mojom.h"
17 #include "mojo/services/network/public/interfaces/network_service.mojom.h" 17 #include "mojo/services/network/public/interfaces/network_service.mojom.h"
18 #include "mojo/services/url_response_disk_cache/public/interfaces/url_response_d isk_cache.mojom.h" 18 #include "mojo/services/url_response_disk_cache/public/interfaces/url_response_d isk_cache.mojom.h"
19 #include "shell/application_manager/application_loader.h" 19 #include "shell/application_manager/application_loader.h"
20 #include "shell/application_manager/identity.h" 20 #include "shell/application_manager/identity.h"
21 #include "shell/application_manager/native_application_options.h"
21 #include "shell/application_manager/native_runner.h" 22 #include "shell/application_manager/native_runner.h"
22 #include "shell/native_application_support.h" 23 #include "shell/native_application_support.h"
23 #include "url/gurl.h" 24 #include "url/gurl.h"
24 25
25 namespace base { 26 namespace base {
26 class FilePath; 27 class FilePath;
27 class SequencedWorkerPool; 28 class SequencedWorkerPool;
28 } 29 }
29 30
30 namespace shell { 31 namespace shell {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 void set_blocking_pool(base::SequencedWorkerPool* blocking_pool) { 111 void set_blocking_pool(base::SequencedWorkerPool* blocking_pool) {
111 blocking_pool_ = blocking_pool; 112 blocking_pool_ = blocking_pool;
112 } 113 }
113 // Sets a Loader to be used for a specific url. 114 // Sets a Loader to be used for a specific url.
114 void SetLoaderForURL(scoped_ptr<ApplicationLoader> loader, const GURL& url); 115 void SetLoaderForURL(scoped_ptr<ApplicationLoader> loader, const GURL& url);
115 // Sets a Loader to be used for a specific url scheme. 116 // Sets a Loader to be used for a specific url scheme.
116 void SetLoaderForScheme(scoped_ptr<ApplicationLoader> loader, 117 void SetLoaderForScheme(scoped_ptr<ApplicationLoader> loader,
117 const std::string& scheme); 118 const std::string& scheme);
118 // These strings will be passed to the Initialize() method when an Application 119 // These strings will be passed to the Initialize() method when an Application
119 // is instantiated. 120 // is instantiated.
120 // TODO(vtl): Maybe we should store/compare resolved URLs, like 121 // TODO(vtl): Maybe we should store/compare resolved URLs?
121 // SetNativeOptionsForURL() below?
122 void SetArgsForURL(const std::vector<std::string>& args, const GURL& url); 122 void SetArgsForURL(const std::vector<std::string>& args, const GURL& url);
123 // These options will be used in running any native application at |url| 123 // These options will be used in running any native application at |url|
124 // (which shouldn't contain a query string). (|url| will be mapped and 124 // (which shouldn't contain a query string). (|url| will be mapped and
125 // resolved, and any application whose base resolved URL matches it will have 125 // resolved, and any application whose base resolved URL matches it will have
126 // |options| applied.) 126 // |options| applied.)
127 // Note: Calling this for a URL will add (default) options for that URL if
128 // necessary.
127 // TODO(vtl): This may not do what's desired if the resolved URL results in an 129 // TODO(vtl): This may not do what's desired if the resolved URL results in an
128 // HTTP redirect. Really, we want options to be identified with a particular 130 // HTTP redirect. Really, we want options to be identified with a particular
129 // implementation, maybe via a signed manifest or something like that. 131 // implementation, maybe via a signed manifest or something like that.
130 void SetNativeOptionsForURL(const NativeRunnerFactory::Options& options, 132 NativeApplicationOptions* GetNativeApplicationOptionsForURL(const GURL& url);
131 const GURL& url);
132 133
133 // Destroys all Shell-ends of connections established with Applications. 134 // Destroys all Shell-ends of connections established with Applications.
134 // Applications connected by this ApplicationManager will observe pipe errors 135 // Applications connected by this ApplicationManager will observe pipe errors
135 // and have a chance to shutdown. 136 // and have a chance to shutdown.
136 void TerminateShellConnections(); 137 void TerminateShellConnections();
137 138
138 // Removes a ShellImpl when it encounters an error. 139 // Removes a ShellImpl when it encounters an error.
139 void OnShellImplError(ShellImpl* shell_impl); 140 void OnShellImplError(ShellImpl* shell_impl);
140 141
141 private: 142 private:
142 class ContentHandlerConnection; 143 class ContentHandlerConnection;
143 144
144 typedef std::map<GURL, scoped_ptr<ApplicationLoader>> URLToLoaderMap; 145 using URLToLoaderMap = std::map<GURL, scoped_ptr<ApplicationLoader>>;
145 typedef std::map<std::string, scoped_ptr<ApplicationLoader>> 146 using SchemeToLoaderMap =
146 SchemeToLoaderMap; 147 std::map<std::string, scoped_ptr<ApplicationLoader>>;
147 typedef std::map<Identity, scoped_ptr<ShellImpl>> IdentityToShellImplMap; 148 using IdentityToShellImplMap = std::map<Identity, scoped_ptr<ShellImpl>>;
148 typedef std::map<GURL, scoped_ptr<ContentHandlerConnection>> 149 using URLToContentHandlerMap =
149 URLToContentHandlerMap; 150 std::map<GURL, scoped_ptr<ContentHandlerConnection>>;
150 typedef std::map<GURL, std::vector<std::string>> URLToArgsMap; 151 using URLToArgsMap = std::map<GURL, std::vector<std::string>>;
151 typedef std::map<std::string, GURL> MimeTypeToURLMap; 152 using MimeTypeToURLMap = std::map<std::string, GURL>;
152 typedef std::map<GURL, NativeRunnerFactory::Options> URLToNativeOptionsMap; 153 using URLToNativeOptionsMap = std::map<GURL, NativeApplicationOptions>;
153 154
154 void ConnectToApplicationWithParameters( 155 void ConnectToApplicationWithParameters(
155 const GURL& application_url, 156 const GURL& application_url,
156 const GURL& requestor_url, 157 const GURL& requestor_url,
157 mojo::InterfaceRequest<mojo::ServiceProvider> services, 158 mojo::InterfaceRequest<mojo::ServiceProvider> services,
158 mojo::ServiceProviderPtr exposed_services, 159 mojo::ServiceProviderPtr exposed_services,
159 const base::Closure& on_application_end, 160 const base::Closure& on_application_end,
160 const std::vector<std::string>& pre_redirect_parameters); 161 const std::vector<std::string>& pre_redirect_parameters);
161 162
162 bool ConnectToRunningApplication( 163 bool ConnectToRunningApplication(
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 void HandleFetchCallback( 195 void HandleFetchCallback(
195 const GURL& requestor_url, 196 const GURL& requestor_url,
196 mojo::InterfaceRequest<mojo::ServiceProvider> services, 197 mojo::InterfaceRequest<mojo::ServiceProvider> services,
197 mojo::ServiceProviderPtr exposed_services, 198 mojo::ServiceProviderPtr exposed_services,
198 const base::Closure& on_application_end, 199 const base::Closure& on_application_end,
199 const std::vector<std::string>& parameters, 200 const std::vector<std::string>& parameters,
200 scoped_ptr<Fetcher> fetcher); 201 scoped_ptr<Fetcher> fetcher);
201 202
202 void RunNativeApplication( 203 void RunNativeApplication(
203 mojo::InterfaceRequest<mojo::Application> application_request, 204 mojo::InterfaceRequest<mojo::Application> application_request,
204 const NativeRunnerFactory::Options& options, 205 const NativeApplicationOptions& options,
205 scoped_ptr<Fetcher> fetcher, 206 scoped_ptr<Fetcher> fetcher,
206 const base::FilePath& file_path, 207 const base::FilePath& file_path,
207 bool path_exists); 208 bool path_exists);
208 209
209 void LoadWithContentHandler( 210 void LoadWithContentHandler(
210 const GURL& content_handler_url, 211 const GURL& content_handler_url,
211 mojo::InterfaceRequest<mojo::Application> application_request, 212 mojo::InterfaceRequest<mojo::Application> application_request,
212 mojo::URLResponsePtr url_response); 213 mojo::URLResponsePtr url_response);
213 214
214 // Returns the appropriate loader for |url|, or null if there is no loader 215 // Returns the appropriate loader for |url|, or null if there is no loader
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 ScopedVector<NativeRunner> native_runners_; 247 ScopedVector<NativeRunner> native_runners_;
247 bool initialized_authentication_interceptor_; 248 bool initialized_authentication_interceptor_;
248 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; 249 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_;
249 250
250 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); 251 DISALLOW_COPY_AND_ASSIGN(ApplicationManager);
251 }; 252 };
252 253
253 } // namespace shell 254 } // namespace shell
254 255
255 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ 256 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
OLDNEW
« no previous file with comments | « shell/application_manager/BUILD.gn ('k') | shell/application_manager/application_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698