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.
5 #ifndef MOJO_SHELL_PACKAGE_MANAGER_H_
6 #define MOJO_SHELL_PACKAGE_MANAGER_H_
8 #include "mojo/services/network/public/interfaces/url_loader.mojom.h"
9 #include "mojo/shell/fetcher.h"
16 class ApplicationManager
;
18 // A class implementing this interface assists Shell::ConnectToApplication in
19 // fetching the applications located therein.
20 class PackageManager
{
23 virtual ~PackageManager() {}
25 // Called once, during initialization, to tell the package manager about the
26 // associated ApplicationManager.
27 virtual void SetApplicationManager(ApplicationManager
* manager
) = 0;
29 // Asks the delegate to fetch the specified url.
30 // TODO(beng): figure out how not to expose Fetcher at all at this layer.
31 virtual void FetchRequest(
32 URLRequestPtr request
,
33 const Fetcher::FetchCallback
& loader_callback
) = 0;
35 // Determine if a content handler should handle the response received by
37 // |url| is the url requested initially by a call to ConnectToApplication().
38 // |task_runner| is a base::TaskRunner* that can be used to post callbacks.
39 // |new_response| is the response that should be passed to
40 // ContentHandler::StartApplication(), unchanged if the return value is false.
41 // |content_handler_url| is the url of the content handler application to
42 // run, unchanged if the return value is false.
43 // |qualifier| is the Identity qualifier that the content handler application
44 // instance should be associated with, unchanged if the return value is false.
45 virtual bool HandleWithContentHandler(Fetcher
* fetcher
,
47 base::TaskRunner
* task_runner
,
48 URLResponsePtr
* new_response
,
49 GURL
* content_handler_url
,
50 std::string
* qualifier
) = 0;
56 #endif // MOJO_SHELL_PACKAGE_MANAGER_H_