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 SHELL_APPLICATION_MANAGER_LOCAL_FETCHER_H_
6 #define SHELL_APPLICATION_MANAGER_LOCAL_FETCHER_H_
8 #include "base/files/file_path.h"
9 #include "mojo/services/network/public/interfaces/url_loader.mojom.h"
10 #include "mojo/shell/application_manager/fetcher.h"
16 // Implements Fetcher for file:// URLs.
17 class LocalFetcher
: public Fetcher
{
19 LocalFetcher(const GURL
& url
,
20 const GURL
& url_without_query
,
21 const FetchCallback
& loader_callback
);
24 static base::FilePath
UrlToFile(const GURL
& url
);
26 const GURL
& GetURL() const override
;
27 GURL
GetRedirectURL() const override
;
29 URLResponsePtr
AsURLResponse(base::TaskRunner
* task_runner
,
30 uint32_t skip
) override
;
33 base::TaskRunner
* task_runner
,
34 base::Callback
<void(const base::FilePath
&, bool)> callback
) override
;
36 std::string
MimeType() override
;
38 bool HasMojoMagic() override
;
40 bool PeekFirstLine(std::string
* line
) override
;
45 DISALLOW_COPY_AND_ASSIGN(LocalFetcher
);
51 #endif // SHELL_APPLICATION_MANAGER_LOCAL_FETCHER_H_