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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 enum RequestType { | 77 enum RequestType { |
78 GET, | 78 GET, |
79 POST, | 79 POST, |
80 HEAD, | 80 HEAD, |
81 DELETE_REQUEST, // DELETE is already taken on Windows. | 81 DELETE_REQUEST, // DELETE is already taken on Windows. |
82 // <winnt.h> defines a DELETE macro. | 82 // <winnt.h> defines a DELETE macro. |
83 PUT, | 83 PUT, |
84 PATCH, | 84 PATCH, |
85 | 85 |
86 // This is POST method with no body, no content-type header and | 86 // DEPRECATED: Now POST should work well for empty body, and this value |
87 // no content-length header. | 87 // will be removed soon. |
| 88 // This is POST method with no body, and no content-type header. |
88 POST_WITHOUT_BODY, | 89 POST_WITHOUT_BODY, |
89 }; | 90 }; |
90 | 91 |
91 // Used by SetURLRequestUserData. The callback should make a fresh | 92 // Used by SetURLRequestUserData. The callback should make a fresh |
92 // base::SupportsUserData::Data object every time it's called. | 93 // base::SupportsUserData::Data object every time it's called. |
93 typedef base::Callback<base::SupportsUserData::Data*()> CreateDataCallback; | 94 typedef base::Callback<base::SupportsUserData::Data*()> CreateDataCallback; |
94 | 95 |
95 virtual ~URLFetcher(); | 96 virtual ~URLFetcher(); |
96 | 97 |
97 // |url| is the URL to send the request to. | 98 // |url| is the URL to send the request to. |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 282 |
282 // Get the response as a string. Return false if the fetcher was not | 283 // Get the response as a string. Return false if the fetcher was not |
283 // set to store the response as a string. | 284 // set to store the response as a string. |
284 virtual bool GetResponseAsString(std::string* out_response_string) const = 0; | 285 virtual bool GetResponseAsString(std::string* out_response_string) const = 0; |
285 | 286 |
286 // Get the path to the file containing the response body. Returns false | 287 // Get the path to the file containing the response body. Returns false |
287 // if the response body was not saved to a file. If take_ownership is | 288 // if the response body was not saved to a file. If take_ownership is |
288 // true, caller takes responsibility for the file, and it will not | 289 // true, caller takes responsibility for the file, and it will not |
289 // be removed once the URLFetcher is destroyed. User should not take | 290 // be removed once the URLFetcher is destroyed. User should not take |
290 // ownership more than once, or call this method after taking ownership. | 291 // ownership more than once, or call this method after taking ownership. |
291 virtual bool GetResponseAsFilePath(bool take_ownership, | 292 virtual bool GetResponseAsFilePath( |
292 base::FilePath* out_response_path) const =
0; | 293 bool take_ownership, |
| 294 base::FilePath* out_response_path) const = 0; |
293 }; | 295 }; |
294 | 296 |
295 } // namespace net | 297 } // namespace net |
296 | 298 |
297 #endif // NET_URL_REQUEST_URL_FETCHER_H_ | 299 #endif // NET_URL_REQUEST_URL_FETCHER_H_ |
OLD | NEW |