OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MOJO_SHELL_PACKAGE_MANAGER_H_ | |
6 #define MOJO_SHELL_PACKAGE_MANAGER_H_ | |
7 | |
8 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | |
9 #include "mojo/shell/fetcher.h" | |
10 | |
11 class GURL; | |
12 | |
13 namespace mojo { | |
14 namespace shell { | |
15 | |
16 class ApplicationManager; | |
17 | |
18 // A class implementing this interface assists Shell::ConnectToApplication in | |
19 // resolving URLs and fetching the applications located therein. | |
20 class PackageManager { | |
21 public: | |
22 PackageManager() {} | |
23 virtual ~PackageManager() {} | |
24 | |
25 // Called once, during initialization, to tell the package manager about the | |
26 // associated ApplicationManager. | |
27 virtual void SetApplicationManager(ApplicationManager* manager) = 0; | |
28 | |
29 // Resolves |url| to its canonical form. e.g. for mojo: urls, returns a file: | |
30 // url with a path ending in .mojo. | |
31 virtual GURL ResolveURL(const GURL& url) = 0; | |
32 | |
33 // Asks the delegate to fetch the specified url. |url| must be unresolved, | |
34 // i.e. ResolveURL() above must not have been called on it. | |
35 // TODO(beng): figure out how not to expose Fetcher at all at this layer. | |
36 virtual void FetchRequest( | |
37 URLRequestPtr request, | |
38 const Fetcher::FetchCallback& loader_callback) = 0; | |
39 | |
40 // Determine if a content handler should handle the response received by | |
41 // |fetcher|. | |
42 // |unresolved_url| is the url requested initially by a call to | |
43 // Shell::ConnectToApplication() before any resolution is applied. | |
44 // |task_runner| is a base::TaskRunner* that can be used to post callbacks. | |
45 // |new_response| is the response that should be passed to | |
46 // ContentHandler::StartApplication(), unchanged if the return value is false. | |
47 // |content_handler_url| is the url of the content handler application to | |
48 // run, unchanged if the return value is false. | |
49 // |qualifier| is the Identity qualifier that the content handler application | |
50 // instance should be associated with, unchanged if the return value is false. | |
51 virtual bool HandleWithContentHandler(Fetcher* fetcher, | |
52 const GURL& unresolved_url, | |
53 base::TaskRunner* task_runner, | |
54 URLResponsePtr* new_response, | |
55 GURL* content_handler_url, | |
56 std::string* qualifier) = 0; | |
57 }; | |
58 | |
59 } // namespace shell | |
60 } // namespace mojo | |
61 | |
62 #endif // MOJO_SHELL_PACKAGE_MANAGER_H_ | |
OLD | NEW |