Roll src/tools/swarming_client/ to 77f720b047fe45f42223e1117b18a8a0a2e38052.
[chromium-blink-merge.git] / mojo / fetcher / base_application_fetcher.h
blob5e39f29bf7f560126eec2a94a6a1fde2911001fe
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 #include "base/files/file_path.h"
6 #include "mojo/fetcher/url_resolver.h"
7 #include "mojo/services/network/public/interfaces/network_service.mojom.h"
8 #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h"
9 #include "mojo/shell/application_fetcher.h"
11 namespace mojo {
12 namespace fetcher {
14 // This is the default implementation of shell::ApplicationFetcher. It loads
15 // http/s urls off the network as well as providing special handling for mojo:
16 // and about: urls.
17 class BaseApplicationFetcher : public shell::ApplicationFetcher {
18 public:
19 // mojo: urls are only supported if |shell_file_root| is non-empty.
20 BaseApplicationFetcher(const base::FilePath& shell_file_root);
21 ~BaseApplicationFetcher() override;
23 private:
24 // Overridden from shell::ApplicationFetcher:
25 void SetApplicationManager(shell::ApplicationManager* manager) override;
26 GURL ResolveURL(const GURL& url) override;
27 void FetchRequest(
28 URLRequestPtr request,
29 const shell::Fetcher::FetchCallback& loader_callback) override;
31 shell::ApplicationManager* application_manager_;
32 scoped_ptr<URLResolver> url_resolver_;
33 const bool disable_cache_;
34 NetworkServicePtr network_service_;
35 URLLoaderFactoryPtr url_loader_factory_;
37 DISALLOW_COPY_AND_ASSIGN(BaseApplicationFetcher);
40 } // namespace fetcher
41 } // namespace mojo