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

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

Issue 1130353005: Makes content handlers see requestor url (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge to trunk Created 5 years, 7 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/runner/native_runner_unittest.cc ('k') | mojo/shell/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/shell/application_loader.h" 18 #include "mojo/shell/application_loader.h"
19 #include "mojo/shell/fetcher.h"
19 #include "mojo/shell/identity.h" 20 #include "mojo/shell/identity.h"
20 #include "mojo/shell/native_runner.h" 21 #include "mojo/shell/native_runner.h"
21 #include "url/gurl.h" 22 #include "url/gurl.h"
22 23
23 namespace base { 24 namespace base {
24 class FilePath; 25 class FilePath;
25 class SequencedWorkerPool; 26 class SequencedWorkerPool;
26 } 27 }
27 28
28 namespace mojo { 29 namespace mojo {
29 namespace shell { 30 namespace shell {
30 31
31 class Fetcher;
32 class ShellImpl; 32 class ShellImpl;
33 33
34 class ApplicationManager { 34 class ApplicationManager {
35 public: 35 public:
36 class Delegate { 36 class Delegate {
37 public: 37 public:
38 // Gives the delegate a chance to apply any mappings for the specified url. 38 // Gives the delegate a chance to apply any mappings for the specified url.
39 // This should not resolve 'mojo' urls, that is done by ResolveMojoURL(). 39 // This should not resolve 'mojo' urls, that is done by ResolveMojoURL().
40 virtual GURL ResolveMappings(const GURL& url) = 0; 40 virtual GURL ResolveMappings(const GURL& url) = 0;
41 41
42 // Used to map a url with the scheme 'mojo' to the appropriate url. Return 42 // Used to map a url with the scheme 'mojo' to the appropriate url. Return
43 // |url| if the scheme is not 'mojo'. 43 // |url| if the scheme is not 'mojo'.
44 virtual GURL ResolveMojoURL(const GURL& url) = 0; 44 virtual GURL ResolveMojoURL(const GURL& url) = 0;
45 45
46 // Asks the delegate to create a Fetcher for the specified url. Return
47 // true on success, false if the default fetcher should be created.
48 virtual bool CreateFetcher(
49 const GURL& url,
50 const Fetcher::FetchCallback& loader_callback) = 0;
51
46 protected: 52 protected:
47 virtual ~Delegate() {} 53 virtual ~Delegate() {}
48 }; 54 };
49 55
50 // API for testing. 56 // API for testing.
51 class TestAPI { 57 class TestAPI {
52 public: 58 public:
53 explicit TestAPI(ApplicationManager* manager); 59 explicit TestAPI(ApplicationManager* manager);
54 ~TestAPI(); 60 ~TestAPI();
55 61
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 scoped_ptr<Fetcher> fetcher); 209 scoped_ptr<Fetcher> fetcher);
204 210
205 void RunNativeApplication(InterfaceRequest<Application> application_request, 211 void RunNativeApplication(InterfaceRequest<Application> application_request,
206 const NativeRunnerFactory::Options& options, 212 const NativeRunnerFactory::Options& options,
207 NativeApplicationCleanup cleanup, 213 NativeApplicationCleanup cleanup,
208 scoped_ptr<Fetcher> fetcher, 214 scoped_ptr<Fetcher> fetcher,
209 const base::FilePath& file_path, 215 const base::FilePath& file_path,
210 bool path_exists); 216 bool path_exists);
211 217
212 void LoadWithContentHandler(const GURL& content_handler_url, 218 void LoadWithContentHandler(const GURL& content_handler_url,
219 const GURL& requestor_url,
213 const std::string& qualifier, 220 const std::string& qualifier,
214 InterfaceRequest<Application> application_request, 221 InterfaceRequest<Application> application_request,
215 URLResponsePtr url_response); 222 URLResponsePtr url_response);
216 223
217 // Returns the appropriate loader for |url|, or null if there is no loader 224 // Returns the appropriate loader for |url|, or null if there is no loader
218 // configured for the URL. 225 // configured for the URL.
219 ApplicationLoader* GetLoaderForURL(const GURL& url); 226 ApplicationLoader* GetLoaderForURL(const GURL& url);
220 227
221 // Removes a ContentHandler when it encounters an error. 228 // Removes a ContentHandler when it encounters an error.
222 void OnContentHandlerError(ContentHandlerConnection* content_handler); 229 void OnContentHandlerError(ContentHandlerConnection* content_handler);
(...skipping 21 matching lines...) Expand all
244 bool disable_cache_; 251 bool disable_cache_;
245 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; 252 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_;
246 253
247 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); 254 DISALLOW_COPY_AND_ASSIGN(ApplicationManager);
248 }; 255 };
249 256
250 } // namespace shell 257 } // namespace shell
251 } // namespace mojo 258 } // namespace mojo
252 259
253 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ 260 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
OLDNEW
« no previous file with comments | « mojo/runner/native_runner_unittest.cc ('k') | mojo/shell/application_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698