| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // You may create the URLFetcher instance on any thread; OnURLFetchComplete() | 64 // You may create the URLFetcher instance on any thread; OnURLFetchComplete() |
| 65 // will be called back on the same thread you use to create the instance. | 65 // will be called back on the same thread you use to create the instance. |
| 66 // | 66 // |
| 67 // | 67 // |
| 68 // NOTE: By default URLFetcher requests are NOT intercepted, except when | 68 // NOTE: By default URLFetcher requests are NOT intercepted, except when |
| 69 // interception is explicitly enabled in tests. | 69 // interception is explicitly enabled in tests. |
| 70 class NET_EXPORT URLFetcher { | 70 class NET_EXPORT URLFetcher { |
| 71 public: | 71 public: |
| 72 // Imposible http response code. Used to signal that no http response code | 72 // Imposible http response code. Used to signal that no http response code |
| 73 // was received. | 73 // was received. |
| 74 enum ResponseCode { | 74 enum ResponseCode { RESPONSE_CODE_INVALID = -1 }; |
| 75 RESPONSE_CODE_INVALID = -1 | |
| 76 }; | |
| 77 | 75 |
| 78 enum RequestType { | 76 enum RequestType { |
| 79 GET, | 77 GET, |
| 80 POST, | 78 POST, |
| 81 HEAD, | 79 HEAD, |
| 82 DELETE_REQUEST, // DELETE is already taken on Windows. | 80 DELETE_REQUEST, // DELETE is already taken on Windows. |
| 83 // <winnt.h> defines a DELETE macro. | 81 // <winnt.h> defines a DELETE macro. |
| 84 PUT, | 82 PUT, |
| 85 PATCH, | 83 PATCH, |
| 86 }; | 84 }; |
| 87 | 85 |
| 88 // Used by SetURLRequestUserData. The callback should make a fresh | 86 // Used by SetURLRequestUserData. The callback should make a fresh |
| 89 // base::SupportsUserData::Data object every time it's called. | 87 // base::SupportsUserData::Data object every time it's called. |
| 90 typedef base::Callback<base::SupportsUserData::Data*()> CreateDataCallback; | 88 typedef base::Callback<base::SupportsUserData::Data*()> CreateDataCallback; |
| 91 | 89 |
| 92 virtual ~URLFetcher(); | 90 virtual ~URLFetcher(); |
| 93 | 91 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // This appends the header to the current extra request headers. | 185 // This appends the header to the current extra request headers. |
| 188 virtual void AddExtraRequestHeader(const std::string& header_line) = 0; | 186 virtual void AddExtraRequestHeader(const std::string& header_line) = 0; |
| 189 | 187 |
| 190 // Set the URLRequestContext on the request. Must be called before the | 188 // Set the URLRequestContext on the request. Must be called before the |
| 191 // request is started. | 189 // request is started. |
| 192 virtual void SetRequestContext( | 190 virtual void SetRequestContext( |
| 193 URLRequestContextGetter* request_context_getter) = 0; | 191 URLRequestContextGetter* request_context_getter) = 0; |
| 194 | 192 |
| 195 // Set the URL that should be consulted for the third-party cookie | 193 // Set the URL that should be consulted for the third-party cookie |
| 196 // blocking policy. | 194 // blocking policy. |
| 197 virtual void SetFirstPartyForCookies( | 195 virtual void SetFirstPartyForCookies(const GURL& first_party_for_cookies) = 0; |
| 198 const GURL& first_party_for_cookies) = 0; | |
| 199 | 196 |
| 200 // Set the key and data callback that is used when setting the user | 197 // Set the key and data callback that is used when setting the user |
| 201 // data on any URLRequest objects this object creates. | 198 // data on any URLRequest objects this object creates. |
| 202 virtual void SetURLRequestUserData( | 199 virtual void SetURLRequestUserData( |
| 203 const void* key, | 200 const void* key, |
| 204 const CreateDataCallback& create_data_callback) = 0; | 201 const CreateDataCallback& create_data_callback) = 0; |
| 205 | 202 |
| 206 // If |stop_on_redirect| is true, 3xx responses will cause the fetch to halt | 203 // If |stop_on_redirect| is true, 3xx responses will cause the fetch to halt |
| 207 // immediately rather than continue through the redirect. OnURLFetchComplete | 204 // immediately rather than continue through the redirect. OnURLFetchComplete |
| 208 // will be called, with the URLFetcher's URL set to the redirect destination, | 205 // will be called, with the URLFetcher's URL set to the redirect destination, |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 // be removed once the URLFetcher is destroyed. User should not take | 294 // be removed once the URLFetcher is destroyed. User should not take |
| 298 // ownership more than once, or call this method after taking ownership. | 295 // ownership more than once, or call this method after taking ownership. |
| 299 virtual bool GetResponseAsFilePath( | 296 virtual bool GetResponseAsFilePath( |
| 300 bool take_ownership, | 297 bool take_ownership, |
| 301 base::FilePath* out_response_path) const = 0; | 298 base::FilePath* out_response_path) const = 0; |
| 302 }; | 299 }; |
| 303 | 300 |
| 304 } // namespace net | 301 } // namespace net |
| 305 | 302 |
| 306 #endif // NET_URL_REQUEST_URL_FETCHER_H_ | 303 #endif // NET_URL_REQUEST_URL_FETCHER_H_ |
| OLD | NEW |