| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 NET_URL_REQUEST_URL_FETCHER_H_ | 5 #ifndef NET_URL_REQUEST_URL_FETCHER_H_ |
| 6 #define NET_URL_REQUEST_URL_FETCHER_H_ | 6 #define NET_URL_REQUEST_URL_FETCHER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace net { | 29 namespace net { |
| 30 class HostPortPair; | 30 class HostPortPair; |
| 31 class HttpRequestHeaders; | 31 class HttpRequestHeaders; |
| 32 class HttpResponseHeaders; | 32 class HttpResponseHeaders; |
| 33 class URLFetcherDelegate; | 33 class URLFetcherDelegate; |
| 34 class URLFetcherResponseWriter; | 34 class URLFetcherResponseWriter; |
| 35 class URLRequestContextGetter; | 35 class URLRequestContextGetter; |
| 36 class URLRequestStatus; | 36 class URLRequestStatus; |
| 37 typedef std::vector<std::string> ResponseCookies; | |
| 38 | 37 |
| 39 // To use this class, create an instance with the desired URL and a pointer to | 38 // To use this class, create an instance with the desired URL and a pointer to |
| 40 // the object to be notified when the URL has been loaded: | 39 // the object to be notified when the URL has been loaded: |
| 41 // std::unique_ptr<URLFetcher> fetcher = | 40 // std::unique_ptr<URLFetcher> fetcher = |
| 42 // URLFetcher::Create(GURL("http://www.google.com"), | 41 // URLFetcher::Create(GURL("http://www.google.com"), |
| 43 // URLFetcher::GET, | 42 // URLFetcher::GET, |
| 44 // this); | 43 // this); |
| 45 // | 44 // |
| 46 // You must also set a request context getter: | 45 // You must also set a request context getter: |
| 47 // | 46 // |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 // Return the URL that this fetcher is processing. | 308 // Return the URL that this fetcher is processing. |
| 310 virtual const GURL& GetURL() const = 0; | 309 virtual const GURL& GetURL() const = 0; |
| 311 | 310 |
| 312 // The status of the URL fetch. | 311 // The status of the URL fetch. |
| 313 virtual const URLRequestStatus& GetStatus() const = 0; | 312 virtual const URLRequestStatus& GetStatus() const = 0; |
| 314 | 313 |
| 315 // The http response code received. Will return RESPONSE_CODE_INVALID | 314 // The http response code received. Will return RESPONSE_CODE_INVALID |
| 316 // if an error prevented any response from being received. | 315 // if an error prevented any response from being received. |
| 317 virtual int GetResponseCode() const = 0; | 316 virtual int GetResponseCode() const = 0; |
| 318 | 317 |
| 319 // Cookies received. | |
| 320 virtual const ResponseCookies& GetCookies() const = 0; | |
| 321 | |
| 322 // Reports that the received content was malformed. | 318 // Reports that the received content was malformed. |
| 323 virtual void ReceivedContentWasMalformed() = 0; | 319 virtual void ReceivedContentWasMalformed() = 0; |
| 324 | 320 |
| 325 // Get the response as a string. Return false if the fetcher was not | 321 // Get the response as a string. Return false if the fetcher was not |
| 326 // set to store the response as a string. | 322 // set to store the response as a string. |
| 327 virtual bool GetResponseAsString(std::string* out_response_string) const = 0; | 323 virtual bool GetResponseAsString(std::string* out_response_string) const = 0; |
| 328 | 324 |
| 329 // Get the path to the file containing the response body. Returns false | 325 // Get the path to the file containing the response body. Returns false |
| 330 // if the response body was not saved to a file. If take_ownership is | 326 // if the response body was not saved to a file. If take_ownership is |
| 331 // true, caller takes responsibility for the file, and it will not | 327 // true, caller takes responsibility for the file, and it will not |
| 332 // be removed once the URLFetcher is destroyed. User should not take | 328 // be removed once the URLFetcher is destroyed. User should not take |
| 333 // ownership more than once, or call this method after taking ownership. | 329 // ownership more than once, or call this method after taking ownership. |
| 334 virtual bool GetResponseAsFilePath( | 330 virtual bool GetResponseAsFilePath( |
| 335 bool take_ownership, | 331 bool take_ownership, |
| 336 base::FilePath* out_response_path) const = 0; | 332 base::FilePath* out_response_path) const = 0; |
| 337 }; | 333 }; |
| 338 | 334 |
| 339 } // namespace net | 335 } // namespace net |
| 340 | 336 |
| 341 #endif // NET_URL_REQUEST_URL_FETCHER_H_ | 337 #endif // NET_URL_REQUEST_URL_FETCHER_H_ |
| OLD | NEW |