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> |
(...skipping 17 matching lines...) Expand all Loading... |
28 public: | 28 public: |
29 URLFetcher() {} | 29 URLFetcher() {} |
30 virtual ~URLFetcher() {} | 30 virtual ~URLFetcher() {} |
31 | 31 |
32 // Interface for reporting the fetch result. | 32 // Interface for reporting the fetch result. |
33 class ResultListener { | 33 class ResultListener { |
34 public: | 34 public: |
35 ResultListener() {} | 35 ResultListener() {} |
36 | 36 |
37 // Informs the listener that the fetch failed. | 37 // Informs the listener that the fetch failed. |
38 virtual void OnStartError(net::Error error) = 0; | 38 virtual void OnFetchStartError(net::Error error) = 0; |
39 | 39 |
40 // Informs the listener that the fetch succeeded and returns the HTTP | 40 // Informs the listener that the fetch succeeded and returns the HTTP |
41 // headers and the body. NOTE |body| must be owned by the caller and remain | 41 // headers and the body. NOTE |body| must be owned by the caller and remain |
42 // valid until the fetcher is destroyed, | 42 // valid until the fetcher is destroyed, |
43 virtual void OnFetchComplete( | 43 virtual void OnFetchComplete( |
44 const GURL& final_url, | 44 const GURL& final_url, |
45 int http_response_code, | 45 int http_response_code, |
46 scoped_refptr<net::HttpResponseHeaders> response_headers, | 46 scoped_refptr<net::HttpResponseHeaders> response_headers, |
47 const char* body, | 47 const char* body, |
48 size_t body_size) = 0; | 48 size_t body_size) = 0; |
(...skipping 17 matching lines...) Expand all Loading... |
66 const net::HttpRequestHeaders& request_headers, | 66 const net::HttpRequestHeaders& request_headers, |
67 ResultListener* result_listener) = 0; | 67 ResultListener* result_listener) = 0; |
68 | 68 |
69 private: | 69 private: |
70 DISALLOW_COPY_AND_ASSIGN(URLFetcher); | 70 DISALLOW_COPY_AND_ASSIGN(URLFetcher); |
71 }; | 71 }; |
72 | 72 |
73 } // namespace headless | 73 } // namespace headless |
74 | 74 |
75 #endif // HEADLESS_PUBLIC_UTIL_URL_FETCHER_H_ | 75 #endif // HEADLESS_PUBLIC_UTIL_URL_FETCHER_H_ |
OLD | NEW |