OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 MOJO_SHELL_PACKAGE_MANAGER_H_ | 5 #ifndef MOJO_SHELL_PACKAGE_MANAGER_H_ |
6 #define MOJO_SHELL_PACKAGE_MANAGER_H_ | 6 #define MOJO_SHELL_PACKAGE_MANAGER_H_ |
7 | 7 |
| 8 #include "mojo/application/public/interfaces/application.mojom.h" |
8 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | 9 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" |
| 10 #include "mojo/shell/capability_filter.h" |
9 #include "mojo/shell/fetcher.h" | 11 #include "mojo/shell/fetcher.h" |
10 | 12 |
11 class GURL; | 13 class GURL; |
12 | 14 |
13 namespace mojo { | 15 namespace mojo { |
14 namespace shell { | 16 namespace shell { |
15 | 17 |
16 class ApplicationManager; | 18 class ApplicationManager; |
| 19 class Identity; |
17 | 20 |
18 // A class implementing this interface assists Shell::ConnectToApplication in | 21 // A class implementing this interface assists Shell::ConnectToApplication in |
19 // fetching the applications located therein. | 22 // fetching the applications located therein. |
20 class PackageManager { | 23 class PackageManager { |
21 public: | 24 public: |
22 PackageManager() {} | 25 PackageManager() {} |
23 virtual ~PackageManager() {} | 26 virtual ~PackageManager() {} |
24 | 27 |
25 // Called once, during initialization, to tell the package manager about the | 28 // Called once, during initialization, to tell the package manager about the |
26 // associated ApplicationManager. | 29 // associated ApplicationManager. |
27 virtual void SetApplicationManager(ApplicationManager* manager) = 0; | 30 virtual void SetApplicationManager(ApplicationManager* manager) = 0; |
28 | 31 |
29 // Asks the delegate to fetch the specified url. | 32 // Asks the delegate to fetch the specified url. |
30 // TODO(beng): figure out how not to expose Fetcher at all at this layer. | 33 // TODO(beng): figure out how not to expose Fetcher at all at this layer. |
31 virtual void FetchRequest( | 34 virtual void FetchRequest( |
32 URLRequestPtr request, | 35 URLRequestPtr request, |
33 const Fetcher::FetchCallback& loader_callback) = 0; | 36 const Fetcher::FetchCallback& loader_callback) = 0; |
34 | 37 |
35 // Determine if a content handler should handle the response received by | 38 // Determine if a content handler should handle the response received by |
36 // |fetcher|. | 39 // |fetcher|. |
37 // |url| is the url requested initially by a call to ConnectToApplication(). | 40 // |source| is the identity of the application that issued the request. |
38 // |task_runner| is a base::TaskRunner* that can be used to post callbacks. | 41 // |target_url| is the URL of that may be content that could be handled by a |
39 // |new_response| is the response that should be passed to | 42 // content handler. |
40 // ContentHandler::StartApplication(), unchanged if the return value is false. | 43 // |target_filter| is a CapabilityFilter that should be applied if a content |
41 // |content_handler_url| is the url of the content handler application to | 44 // handler is started to handle |target_url|. |
42 // run, unchanged if the return value is false. | 45 // |application_request| is a request for an Application implementation that |
43 // |qualifier| is the Identity qualifier that the content handler application | 46 // will be taken by ContentHandler::StartApplication if a content handler ends |
44 // instance should be associated with, unchanged if the return value is false. | 47 // up handling |target_url|. |
45 virtual bool HandleWithContentHandler(Fetcher* fetcher, | 48 virtual uint32_t HandleWithContentHandler( |
46 const GURL& url, | 49 Fetcher* fetcher, |
47 base::TaskRunner* task_runner, | 50 const Identity& source, |
48 URLResponsePtr* new_response, | 51 const GURL& target_url, |
49 GURL* content_handler_url, | 52 const CapabilityFilter& target_filter, |
50 std::string* qualifier) = 0; | 53 InterfaceRequest<Application>* application_request) = 0; |
51 }; | 54 }; |
52 | 55 |
53 } // namespace shell | 56 } // namespace shell |
54 } // namespace mojo | 57 } // namespace mojo |
55 | 58 |
56 #endif // MOJO_SHELL_PACKAGE_MANAGER_H_ | 59 #endif // MOJO_SHELL_PACKAGE_MANAGER_H_ |
OLD | NEW |