Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / mojo / shell / local_fetcher.h
blob53b598fab49b705b16760409111df1a0f3263799
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_
8 #include <string>
10 #include "base/files/file_path.h"
11 #include "mojo/shell/fetcher.h"
12 #include "url/gurl.h"
14 namespace mojo {
16 class NetworkService;
18 namespace shell {
20 // Implements Fetcher for file:// URLs.
21 class LocalFetcher : public Fetcher {
22 public:
23 LocalFetcher(NetworkService* network_service,
24 const GURL& url,
25 const GURL& url_without_query,
26 const FetchCallback& loader_callback);
28 void GetMimeTypeFromFileCallback(const mojo::String& mime_type);
30 private:
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;
38 void AsPath(
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;
48 GURL url_;
49 base::FilePath path_;
50 std::string mime_type_;
52 DISALLOW_COPY_AND_ASSIGN(LocalFetcher);
55 } // namespace shell
57 } // namespace mojo
59 #endif // MOJO_SHELL_LOCAL_FETCHER_H_