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

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

Issue 1067173003: Remove mojo:: part of mojo::shell:: nested namespace in //shell. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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
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 "shell/application_manager/application_loader.h" 18 #include "shell/application_manager/application_loader.h"
19 #include "shell/application_manager/identity.h" 19 #include "shell/application_manager/identity.h"
20 #include "shell/application_manager/native_runner.h" 20 #include "shell/application_manager/native_runner.h"
21 #include "shell/native_application_support.h" 21 #include "shell/native_application_support.h"
22 #include "url/gurl.h" 22 #include "url/gurl.h"
23 23
24 namespace base { 24 namespace base {
25 class FilePath; 25 class FilePath;
26 class SequencedWorkerPool; 26 class SequencedWorkerPool;
27 } 27 }
28 28
29 namespace mojo {
30 namespace shell { 29 namespace shell {
31 30
32 class Fetcher; 31 class Fetcher;
33 class ShellImpl; 32 class ShellImpl;
34 33
35 class ApplicationManager { 34 class ApplicationManager {
36 public: 35 public:
37 class Delegate { 36 class Delegate {
38 public: 37 public:
39 virtual ~Delegate(); 38 virtual ~Delegate();
(...skipping 15 matching lines...) Expand all
55 private: 54 private:
56 ApplicationManager* manager_; 55 ApplicationManager* manager_;
57 56
58 DISALLOW_COPY_AND_ASSIGN(TestAPI); 57 DISALLOW_COPY_AND_ASSIGN(TestAPI);
59 }; 58 };
60 59
61 explicit ApplicationManager(Delegate* delegate); 60 explicit ApplicationManager(Delegate* delegate);
62 ~ApplicationManager(); 61 ~ApplicationManager();
63 62
64 // Loads a service if necessary and establishes a new client connection. 63 // Loads a service if necessary and establishes a new client connection.
65 void ConnectToApplication(const GURL& application_url, 64 void ConnectToApplication(
66 const GURL& requestor_url, 65 const GURL& application_url,
67 InterfaceRequest<ServiceProvider> services, 66 const GURL& requestor_url,
68 ServiceProviderPtr exposed_services, 67 mojo::InterfaceRequest<mojo::ServiceProvider> services,
69 const base::Closure& on_application_end); 68 mojo::ServiceProviderPtr exposed_services,
69 const base::Closure& on_application_end);
70 70
71 template <typename Interface> 71 template <typename Interface>
72 inline void ConnectToService(const GURL& application_url, 72 inline void ConnectToService(const GURL& application_url,
73 InterfacePtr<Interface>* ptr) { 73 mojo::InterfacePtr<Interface>* ptr) {
74 ScopedMessagePipeHandle service_handle = 74 mojo::ScopedMessagePipeHandle service_handle =
75 ConnectToServiceByName(application_url, Interface::Name_); 75 ConnectToServiceByName(application_url, Interface::Name_);
76 ptr->Bind(service_handle.Pass()); 76 ptr->Bind(service_handle.Pass());
77 } 77 }
78 78
79 ScopedMessagePipeHandle ConnectToServiceByName( 79 mojo::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 // 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()
87 // or SetLoaderForScheme(). 87 // or SetLoaderForScheme().
88 void set_default_loader(scoped_ptr<ApplicationLoader> loader) { 88 void set_default_loader(scoped_ptr<ApplicationLoader> loader) {
89 default_loader_ = loader.Pass(); 89 default_loader_ = loader.Pass();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap; 131 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap;
132 typedef std::map<Identity, ShellImpl*> IdentityToShellImplMap; 132 typedef std::map<Identity, ShellImpl*> IdentityToShellImplMap;
133 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap; 133 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap;
134 typedef std::map<GURL, std::vector<std::string>> URLToArgsMap; 134 typedef std::map<GURL, std::vector<std::string>> URLToArgsMap;
135 typedef std::map<std::string, GURL> MimeTypeToURLMap; 135 typedef std::map<std::string, GURL> MimeTypeToURLMap;
136 typedef std::map<GURL, NativeRunnerFactory::Options> URLToNativeOptionsMap; 136 typedef std::map<GURL, NativeRunnerFactory::Options> URLToNativeOptionsMap;
137 137
138 void ConnectToApplicationWithParameters( 138 void ConnectToApplicationWithParameters(
139 const GURL& application_url, 139 const GURL& application_url,
140 const GURL& requestor_url, 140 const GURL& requestor_url,
141 InterfaceRequest<ServiceProvider> services, 141 mojo::InterfaceRequest<mojo::ServiceProvider> services,
142 ServiceProviderPtr exposed_services, 142 mojo::ServiceProviderPtr exposed_services,
143 const base::Closure& on_application_end, 143 const base::Closure& on_application_end,
144 const std::vector<std::string>& pre_redirect_parameters); 144 const std::vector<std::string>& pre_redirect_parameters);
145 145
146 bool ConnectToRunningApplication(const GURL& resolved_url, 146 bool ConnectToRunningApplication(
147 const GURL& requestor_url, 147 const GURL& resolved_url,
148 InterfaceRequest<ServiceProvider>* services, 148 const GURL& requestor_url,
149 ServiceProviderPtr* exposed_services); 149 mojo::InterfaceRequest<mojo::ServiceProvider>* services,
150 mojo::ServiceProviderPtr* exposed_services);
150 151
151 bool ConnectToApplicationWithLoader( 152 bool ConnectToApplicationWithLoader(
152 const GURL& resolved_url, 153 const GURL& resolved_url,
153 const GURL& requestor_url, 154 const GURL& requestor_url,
154 InterfaceRequest<ServiceProvider>* services, 155 mojo::InterfaceRequest<mojo::ServiceProvider>* services,
155 ServiceProviderPtr* exposed_services, 156 mojo::ServiceProviderPtr* exposed_services,
156 const base::Closure& on_application_end, 157 const base::Closure& on_application_end,
157 const std::vector<std::string>& parameters, 158 const std::vector<std::string>& parameters,
158 ApplicationLoader* loader); 159 ApplicationLoader* loader);
159 160
160 InterfaceRequest<Application> RegisterShell( 161 mojo::InterfaceRequest<mojo::Application> RegisterShell(
161 // The URL after resolution and redirects, including the querystring. 162 // The URL after resolution and redirects, including the querystring.
162 const GURL& resolved_url, 163 const GURL& resolved_url,
163 const GURL& requestor_url, 164 const GURL& requestor_url,
164 InterfaceRequest<ServiceProvider> services, 165 mojo::InterfaceRequest<mojo::ServiceProvider> services,
165 ServiceProviderPtr exposed_services, 166 mojo::ServiceProviderPtr exposed_services,
166 const base::Closure& on_application_end, 167 const base::Closure& on_application_end,
167 const std::vector<std::string>& parameters); 168 const std::vector<std::string>& parameters);
168 169
169 ShellImpl* GetShellImpl(const GURL& url); 170 ShellImpl* GetShellImpl(const GURL& url);
170 171
171 void ConnectToClient(ShellImpl* shell_impl, 172 void ConnectToClient(ShellImpl* shell_impl,
172 const GURL& resolved_url, 173 const GURL& resolved_url,
173 const GURL& requestor_url, 174 const GURL& requestor_url,
174 InterfaceRequest<ServiceProvider> services, 175 mojo::InterfaceRequest<mojo::ServiceProvider> services,
175 ServiceProviderPtr exposed_services); 176 mojo::ServiceProviderPtr exposed_services);
176 177
177 void HandleFetchCallback(const GURL& requestor_url, 178 void HandleFetchCallback(
178 InterfaceRequest<ServiceProvider> services, 179 const GURL& requestor_url,
179 ServiceProviderPtr exposed_services, 180 mojo::InterfaceRequest<mojo::ServiceProvider> services,
180 const base::Closure& on_application_end, 181 mojo::ServiceProviderPtr exposed_services,
181 const std::vector<std::string>& parameters, 182 const base::Closure& on_application_end,
182 NativeApplicationCleanup cleanup, 183 const std::vector<std::string>& parameters,
183 scoped_ptr<Fetcher> fetcher); 184 NativeApplicationCleanup cleanup,
185 scoped_ptr<Fetcher> fetcher);
184 186
185 void RunNativeApplication(InterfaceRequest<Application> application_request, 187 void RunNativeApplication(
186 const NativeRunnerFactory::Options& options, 188 mojo::InterfaceRequest<mojo::Application> application_request,
187 NativeApplicationCleanup cleanup, 189 const NativeRunnerFactory::Options& options,
188 scoped_ptr<Fetcher> fetcher, 190 NativeApplicationCleanup cleanup,
189 const base::FilePath& file_path, 191 scoped_ptr<Fetcher> fetcher,
190 bool path_exists); 192 const base::FilePath& file_path,
193 bool path_exists);
191 194
192 void LoadWithContentHandler(const GURL& content_handler_url, 195 void LoadWithContentHandler(
193 InterfaceRequest<Application> application_request, 196 const GURL& content_handler_url,
194 URLResponsePtr url_response); 197 mojo::InterfaceRequest<mojo::Application> application_request,
198 mojo::URLResponsePtr url_response);
195 199
196 // 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
197 // configured for the URL. 201 // configured for the URL.
198 ApplicationLoader* GetLoaderForURL(const GURL& url); 202 ApplicationLoader* GetLoaderForURL(const GURL& url);
199 203
200 // Removes a ContentHandler when it encounters an error. 204 // Removes a mojo::ContentHandler when it encounters an error.
201 void OnContentHandlerError(ContentHandlerConnection* content_handler); 205 void OnContentHandlerError(ContentHandlerConnection* content_handler);
202 206
203 // Returns the arguments for the given url. 207 // Returns the arguments for the given url.
204 std::vector<std::string> GetArgsForURL(const GURL& url); 208 std::vector<std::string> GetArgsForURL(const GURL& url);
205 209
206 void CleanupRunner(NativeRunner* runner); 210 void CleanupRunner(NativeRunner* runner);
207 211
208 Delegate* const delegate_; 212 Delegate* const delegate_;
209 // Loader management. 213 // Loader management.
210 // Loaders are chosen in the order they are listed here. 214 // Loaders are chosen in the order they are listed here.
211 URLToLoaderMap url_to_loader_; 215 URLToLoaderMap url_to_loader_;
212 SchemeToLoaderMap scheme_to_loader_; 216 SchemeToLoaderMap scheme_to_loader_;
213 scoped_ptr<ApplicationLoader> default_loader_; 217 scoped_ptr<ApplicationLoader> default_loader_;
214 scoped_ptr<NativeRunnerFactory> native_runner_factory_; 218 scoped_ptr<NativeRunnerFactory> native_runner_factory_;
215 219
216 IdentityToShellImplMap identity_to_shell_impl_; 220 IdentityToShellImplMap identity_to_shell_impl_;
217 URLToContentHandlerMap url_to_content_handler_; 221 URLToContentHandlerMap url_to_content_handler_;
218 URLToArgsMap url_to_args_; 222 URLToArgsMap url_to_args_;
219 // Note: The keys are URLs after mapping and resolving. 223 // Note: The keys are URLs after mapping and resolving.
220 URLToNativeOptionsMap url_to_native_options_; 224 URLToNativeOptionsMap url_to_native_options_;
221 225
222 base::SequencedWorkerPool* blocking_pool_; 226 base::SequencedWorkerPool* blocking_pool_;
223 NetworkServicePtr network_service_; 227 mojo::NetworkServicePtr network_service_;
224 MimeTypeToURLMap mime_type_to_url_; 228 MimeTypeToURLMap mime_type_to_url_;
225 ScopedVector<NativeRunner> native_runners_; 229 ScopedVector<NativeRunner> native_runners_;
226 bool disable_cache_; 230 bool disable_cache_;
227 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; 231 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_;
228 232
229 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); 233 DISALLOW_COPY_AND_ASSIGN(ApplicationManager);
230 }; 234 };
231 235
232 } // namespace shell 236 } // namespace shell
233 } // namespace mojo
234 237
235 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ 238 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698