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 MOJO_FETCHER_DATA_FETCHER_H_ | 5 #ifndef MOJO_SHELL_FETCHER_DATA_FETCHER_H_ |
6 #define MOJO_FETCHER_DATA_FETCHER_H_ | 6 #define MOJO_SHELL_FETCHER_DATA_FETCHER_H_ |
7 | 7 |
8 #include "mojo/shell/fetcher.h" | 8 #include "mojo/shell/fetcher.h" |
9 | 9 |
10 #include <stdint.h> | 10 #include <stdint.h> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | 13 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 namespace mojo { | 16 namespace mojo { |
17 namespace fetcher { | 17 namespace shell { |
18 | 18 |
19 // Implements Fetcher for data: URLs. | 19 // Implements Fetcher for data: URLs. |
20 class DataFetcher : public shell::Fetcher { | 20 class DataFetcher : public Fetcher { |
21 public: | 21 public: |
22 static void Start(const GURL& url, const FetchCallback& loader_callback); | 22 static void Start(const GURL& url, const FetchCallback& loader_callback); |
23 | 23 |
24 private: | 24 private: |
25 DataFetcher(const GURL& url, const FetchCallback& loader_callback); | 25 DataFetcher(const GURL& url, const FetchCallback& loader_callback); |
26 ~DataFetcher() override; | 26 ~DataFetcher() override; |
27 | 27 |
28 void BuildAndDispatchResponse(); | 28 void BuildAndDispatchResponse(); |
29 | 29 |
30 // shell::Fetcher implementation. | 30 // Fetcher implementation. |
31 const GURL& GetURL() const override; | 31 const GURL& GetURL() const override; |
32 GURL GetRedirectURL() const override; | 32 GURL GetRedirectURL() const override; |
33 GURL GetRedirectReferer() const override; | 33 GURL GetRedirectReferer() const override; |
34 URLResponsePtr AsURLResponse(base::TaskRunner* task_runner, | 34 URLResponsePtr AsURLResponse(base::TaskRunner* task_runner, |
35 uint32_t skip) override; | 35 uint32_t skip) override; |
36 void AsPath( | 36 void AsPath( |
37 base::TaskRunner* task_runner, | 37 base::TaskRunner* task_runner, |
38 base::Callback<void(const base::FilePath&, bool)> callback) override; | 38 base::Callback<void(const base::FilePath&, bool)> callback) override; |
39 std::string MimeType() override; | 39 std::string MimeType() override; |
40 bool HasMojoMagic() override; | 40 bool HasMojoMagic() override; |
41 bool PeekFirstLine(std::string* line) override; | 41 bool PeekFirstLine(std::string* line) override; |
42 | 42 |
43 const GURL url_; | 43 const GURL url_; |
44 URLResponsePtr response_; | 44 URLResponsePtr response_; |
45 | 45 |
46 DISALLOW_COPY_AND_ASSIGN(DataFetcher); | 46 DISALLOW_COPY_AND_ASSIGN(DataFetcher); |
47 }; | 47 }; |
48 | 48 |
49 } // namespace fetcher | 49 } // namespace shell |
50 } // namespace mojo | 50 } // namespace mojo |
51 | 51 |
52 #endif // MOJO_FETCHER_DATA_FETCHER_H_ | 52 #endif // MOJO_SHELL_FETCHER_DATA_FETCHER_H_ |
OLD | NEW |