OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 HEADLESS_PUBLIC_UTIL_URL_FETCHER_H_ | 5 #ifndef HEADLESS_PUBLIC_UTIL_URL_FETCHER_H_ |
6 #define HEADLESS_PUBLIC_UTIL_URL_FETCHER_H_ | 6 #define HEADLESS_PUBLIC_UTIL_URL_FETCHER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 class HttpRequestHeaders; | 18 class HttpRequestHeaders; |
19 class HttpResponseHeaders; | 19 class HttpResponseHeaders; |
20 } // namespace net | 20 } // namespace net |
21 | 21 |
22 namespace headless { | 22 namespace headless { |
23 | 23 |
24 // An interface for fetching URLs. Note these are only intended to be used once. | 24 // An interface for fetching URLs. Note these are only intended to be used once. |
25 // TODO(alexclarke): Implement a URLFetcher that can backend onto a URLRequest | |
26 // and hook this up in headless_shell under a flag. | |
27 class URLFetcher { | 25 class URLFetcher { |
28 public: | 26 public: |
29 URLFetcher() {} | 27 URLFetcher() {} |
30 virtual ~URLFetcher() {} | 28 virtual ~URLFetcher() {} |
31 | 29 |
32 // Interface for reporting the fetch result. | 30 // Interface for reporting the fetch result. |
33 class ResultListener { | 31 class ResultListener { |
34 public: | 32 public: |
35 ResultListener() {} | 33 ResultListener() {} |
36 | 34 |
(...skipping 19 matching lines...) Expand all Loading... |
56 | 54 |
57 protected: | 55 protected: |
58 virtual ~ResultListener() {} | 56 virtual ~ResultListener() {} |
59 | 57 |
60 private: | 58 private: |
61 DISALLOW_COPY_AND_ASSIGN(ResultListener); | 59 DISALLOW_COPY_AND_ASSIGN(ResultListener); |
62 }; | 60 }; |
63 | 61 |
64 // Instructs the sub-class to fetch the resource. | 62 // Instructs the sub-class to fetch the resource. |
65 virtual void StartFetch(const GURL& rewritten_url, | 63 virtual void StartFetch(const GURL& rewritten_url, |
| 64 const std::string& method, |
66 const net::HttpRequestHeaders& request_headers, | 65 const net::HttpRequestHeaders& request_headers, |
67 ResultListener* result_listener) = 0; | 66 ResultListener* result_listener) = 0; |
68 | 67 |
69 private: | 68 private: |
70 DISALLOW_COPY_AND_ASSIGN(URLFetcher); | 69 DISALLOW_COPY_AND_ASSIGN(URLFetcher); |
71 }; | 70 }; |
72 | 71 |
73 } // namespace headless | 72 } // namespace headless |
74 | 73 |
75 #endif // HEADLESS_PUBLIC_UTIL_URL_FETCHER_H_ | 74 #endif // HEADLESS_PUBLIC_UTIL_URL_FETCHER_H_ |
OLD | NEW |