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_LOCAL_FETCHER_H_
6 #define MOJO_SHELL_LOCAL_FETCHER_H_
10 #include "base/files/file_path.h"
11 #include "mojo/shell/fetcher.h"
20 // Implements Fetcher for file:// URLs.
21 class LocalFetcher
: public Fetcher
{
23 LocalFetcher(NetworkService
* network_service
,
25 const GURL
& url_without_query
,
26 const FetchCallback
& loader_callback
);
28 void GetMimeTypeFromFileCallback(const mojo::String
& mime_type
);
31 const GURL
& GetURL() const override
;
32 GURL
GetRedirectURL() const override
;
33 GURL
GetRedirectReferer() const override
;
35 URLResponsePtr
AsURLResponse(base::TaskRunner
* task_runner
,
36 uint32_t skip
) override
;
39 base::TaskRunner
* task_runner
,
40 base::Callback
<void(const base::FilePath
&, bool)> callback
) override
;
42 std::string
MimeType() override
;
44 bool HasMojoMagic() override
;
46 bool PeekFirstLine(std::string
* line
) override
;
50 std::string mime_type_
;
52 DISALLOW_COPY_AND_ASSIGN(LocalFetcher
);
59 #endif // MOJO_SHELL_LOCAL_FETCHER_H_