OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef MOJO_FETCHER_LOCAL_FETCHER_H_ | |
6 #define MOJO_FETCHER_LOCAL_FETCHER_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/files/file_path.h" | |
11 #include "mojo/shell/fetcher.h" | |
12 #include "url/gurl.h" | |
13 | |
14 namespace mojo { | |
15 | |
16 class NetworkService; | |
17 | |
18 namespace fetcher { | |
19 | |
20 // Implements Fetcher for file:// URLs. | |
21 class LocalFetcher : public shell::Fetcher { | |
22 public: | |
23 LocalFetcher(NetworkService* network_service, | |
24 const GURL& url, | |
25 const GURL& url_without_query, | |
26 const FetchCallback& loader_callback); | |
27 | |
28 void GetMimeTypeFromFileCallback(const mojo::String& mime_type); | |
29 | |
30 private: | |
31 const GURL& GetURL() const override; | |
32 GURL GetRedirectURL() const override; | |
33 GURL GetRedirectReferer() const override; | |
34 | |
35 URLResponsePtr AsURLResponse(base::TaskRunner* task_runner, | |
36 uint32_t skip) override; | |
37 | |
38 void AsPath( | |
39 base::TaskRunner* task_runner, | |
40 base::Callback<void(const base::FilePath&, bool)> callback) override; | |
41 | |
42 std::string MimeType() override; | |
43 | |
44 bool HasMojoMagic() override; | |
45 | |
46 bool PeekFirstLine(std::string* line) override; | |
47 | |
48 GURL url_; | |
49 base::FilePath path_; | |
50 std::string mime_type_; | |
51 | |
52 DISALLOW_COPY_AND_ASSIGN(LocalFetcher); | |
53 }; | |
54 | |
55 } // namespace fetcher | |
56 } // namespace mojo | |
57 | |
58 #endif // MOJO_FETCHER_LOCAL_FETCHER_H_ | |
OLD | NEW |