OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SHELL_APPLICATION_MANAGER_LOCAL_FETCHER_H_ | 5 #ifndef SHELL_APPLICATION_MANAGER_LOCAL_FETCHER_H_ |
6 #define SHELL_APPLICATION_MANAGER_LOCAL_FETCHER_H_ | 6 #define SHELL_APPLICATION_MANAGER_LOCAL_FETCHER_H_ |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | 9 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" |
10 #include "shell/application_manager/fetcher.h" | 10 #include "shell/application_manager/fetcher.h" |
11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
12 | 12 |
13 namespace mojo { | 13 namespace mojo { |
14 | 14 |
15 // Implements Fetcher for file:// URLs. | 15 // Implements Fetcher for file:// URLs. |
16 class LocalFetcher : public Fetcher { | 16 class LocalFetcher : public Fetcher { |
17 public: | 17 public: |
18 LocalFetcher(const GURL& url, const FetchCallback& loader_callback); | 18 LocalFetcher(const GURL& url, const FetchCallback& loader_callback); |
19 | 19 |
20 private: | 20 private: |
21 static base::FilePath UrlToFile(const GURL& url); | 21 static base::FilePath UrlToFile(const GURL& url); |
22 | 22 |
| 23 const GURL& GetURL() const override; |
| 24 GURL GetRedirectURL() const override; |
| 25 |
23 URLResponsePtr AsURLResponse(base::TaskRunner* task_runner, | 26 URLResponsePtr AsURLResponse(base::TaskRunner* task_runner, |
24 uint32_t skip) override; | 27 uint32_t skip) override; |
25 | 28 |
26 void AsPath( | 29 void AsPath( |
27 base::TaskRunner* task_runner, | 30 base::TaskRunner* task_runner, |
28 base::Callback<void(const base::FilePath&, bool)> callback) override; | 31 base::Callback<void(const base::FilePath&, bool)> callback) override; |
29 | 32 |
30 std::string MimeType() override; | 33 std::string MimeType() override; |
31 | 34 |
32 bool HasMojoMagic() override; | 35 bool HasMojoMagic() override; |
33 | 36 |
34 bool PeekFirstLine(std::string* line) override; | 37 bool PeekFirstLine(std::string* line) override; |
35 | 38 |
36 GURL url_; | 39 GURL url_; |
37 base::FilePath path_; | 40 base::FilePath path_; |
38 | 41 |
39 DISALLOW_COPY_AND_ASSIGN(LocalFetcher); | 42 DISALLOW_COPY_AND_ASSIGN(LocalFetcher); |
40 }; | 43 }; |
41 | 44 |
42 #endif // SHELL_APPLICATION_MANAGER_LOCAL_FETCHER_H_ | 45 #endif // SHELL_APPLICATION_MANAGER_LOCAL_FETCHER_H_ |
43 | 46 |
44 } // namespace mojo | 47 } // namespace mojo |
OLD | NEW |