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