| 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 <stdint.h> | |
| 9 | |
| 10 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | |
| 11 #include "mojo/shell/capability_filter.h" | |
| 12 #include "mojo/shell/fetcher.h" | |
| 13 #include "mojo/shell/public/interfaces/shell_client.mojom.h" | |
| 14 | |
| 15 class GURL; | |
| 16 | |
| 17 namespace mojo { | |
| 18 namespace shell { | |
| 19 | |
| 20 class ApplicationManager; | |
| 21 class Identity; | |
| 22 | |
| 23 // A class implementing this interface assists Shell::ConnectToApplication in | |
| 24 // fetching the applications located therein. | |
| 25 class PackageManager { | |
| 26 public: | |
| 27 PackageManager() {} | |
| 28 virtual ~PackageManager() {} | |
| 29 | |
| 30 // Called once, during initialization, to tell the package manager about the | |
| 31 // associated ApplicationManager. | |
| 32 virtual void SetApplicationManager(ApplicationManager* manager) = 0; | |
| 33 | |
| 34 // Called when an app is loaded via an ApplicationLoader. | |
| 35 virtual void BuiltinAppLoaded(const GURL& url) = 0; | |
| 36 | |
| 37 // Asks the delegate to fetch the specified url. | |
| 38 // TODO(beng): figure out how not to expose Fetcher at all at this layer. | |
| 39 virtual void FetchRequest( | |
| 40 URLRequestPtr request, | |
| 41 const Fetcher::FetchCallback& loader_callback) = 0; | |
| 42 | |
| 43 // Determine if a content handler should handle the response received by | |
| 44 // |fetcher|. | |
| 45 // |source| is the identity of the application that issued the request. | |
| 46 // |target_url| is the URL of that may be content that could be handled by a | |
| 47 // content handler. | |
| 48 // |target_filter| is a CapabilityFilter that should be applied if a content | |
| 49 // handler is started to handle |target_url|. | |
| 50 // |request| is a request for an Application implementation that | |
| 51 // will be taken by ContentHandler::StartApplication if a content handler ends | |
| 52 // up handling |target_url|. | |
| 53 virtual uint32_t HandleWithContentHandler( | |
| 54 Fetcher* fetcher, | |
| 55 const Identity& source, | |
| 56 const GURL& target_url, | |
| 57 const CapabilityFilter& target_filter, | |
| 58 InterfaceRequest<shell::mojom::ShellClient>* request) = 0; | |
| 59 | |
| 60 // Returns true if a manifest for |url| exists within the PackageManager's | |
| 61 // application catalog. | |
| 62 virtual bool IsURLInCatalog(const std::string& url) const = 0; | |
| 63 | |
| 64 // Returns the name for the application at |url| from its manifest. | |
| 65 virtual std::string GetApplicationName(const std::string& url) const = 0; | |
| 66 | |
| 67 virtual GURL ResolveMojoURL(const GURL& mojo_url) = 0; | |
| 68 | |
| 69 virtual uint32_t StartContentHandler(const Identity& source, | |
| 70 const Identity& content_handler, | |
| 71 const GURL& url, | |
| 72 mojom::ShellClientRequest request) = 0; | |
| 73 }; | |
| 74 | |
| 75 } // namespace shell | |
| 76 } // namespace mojo | |
| 77 | |
| 78 #endif // MOJO_SHELL_PACKAGE_MANAGER_H_ | |
| OLD | NEW |