Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: content/public/common/url_fetcher.h

Issue 9342007: Add HTTP PUT request type to content:URLFetcher (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CONTENT_PUBLIC_COMMON_URL_FETCHER_H_ 5 #ifndef CONTENT_PUBLIC_COMMON_URL_FETCHER_H_
6 #define CONTENT_PUBLIC_COMMON_URL_FETCHER_H_ 6 #define CONTENT_PUBLIC_COMMON_URL_FETCHER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 enum ResponseCode { 69 enum ResponseCode {
70 RESPONSE_CODE_INVALID = -1 70 RESPONSE_CODE_INVALID = -1
71 }; 71 };
72 72
73 enum RequestType { 73 enum RequestType {
74 GET, 74 GET,
75 POST, 75 POST,
76 HEAD, 76 HEAD,
77 DELETE_REQUEST, // DELETE is already taken on Windows. 77 DELETE_REQUEST, // DELETE is already taken on Windows.
78 // <winnt.h> defines a DELETE macro. 78 // <winnt.h> defines a DELETE macro.
79 PUT,
79 }; 80 };
80 81
81 // |url| is the URL to send the request to. 82 // |url| is the URL to send the request to.
82 // |request_type| is the type of request to make. 83 // |request_type| is the type of request to make.
83 // |d| the object that will receive the callback on fetch completion. 84 // |d| the object that will receive the callback on fetch completion.
84 static URLFetcher* Create(const GURL& url, 85 static URLFetcher* Create(const GURL& url,
85 RequestType request_type, 86 RequestType request_type,
86 URLFetcherDelegate* d); 87 URLFetcherDelegate* d);
87 88
88 // Like above, but if there's a URLFetcherFactory registered with the 89 // Like above, but if there's a URLFetcherFactory registered with the
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 136
136 // The referrer URL for the request. Must be called before the request is 137 // The referrer URL for the request. Must be called before the request is
137 // started. 138 // started.
138 virtual void SetReferrer(const std::string& referrer) = 0; 139 virtual void SetReferrer(const std::string& referrer) = 0;
139 140
140 // Set extra headers on the request. Must be called before the request 141 // Set extra headers on the request. Must be called before the request
141 // is started. 142 // is started.
142 virtual void SetExtraRequestHeaders( 143 virtual void SetExtraRequestHeaders(
143 const std::string& extra_request_headers) = 0; 144 const std::string& extra_request_headers) = 0;
144 145
146 // Add header (with format $key ":" $value) to the request headers.
wtc 2012/02/06 23:34:07 Nit: I'd omit the dollar signs ($) in the format d
kuan 2012/02/06 23:58:17 Done.
147 // Must be called before the request is started.
148 virtual void AddRequestHeaderFromString(
149 const base::StringPiece& header_line) = 0;
wtc 2012/02/06 23:34:07 It's important to explain the difference between t
kuan 2012/02/06 23:58:17 Done.
150
145 virtual void GetExtraRequestHeaders(net::HttpRequestHeaders* headers) = 0; 151 virtual void GetExtraRequestHeaders(net::HttpRequestHeaders* headers) = 0;
146 152
147 // Set the net::URLRequestContext on the request. Must be called before the 153 // Set the net::URLRequestContext on the request. Must be called before the
148 // request is started. 154 // request is started.
149 virtual void SetRequestContext( 155 virtual void SetRequestContext(
150 net::URLRequestContextGetter* request_context_getter) = 0; 156 net::URLRequestContextGetter* request_context_getter) = 0;
151 157
152 // If |retry| is false, 5xx responses will be propagated to the observer, 158 // If |retry| is false, 5xx responses will be propagated to the observer,
153 // if it is true URLFetcher will automatically re-execute the request, 159 // if it is true URLFetcher will automatically re-execute the request,
154 // after backoff_delay() elapses. URLFetcher has it set to true by default. 160 // after backoff_delay() elapses. URLFetcher has it set to true by default.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 // true, caller takes responsibility for the temp file, and it will not 229 // true, caller takes responsibility for the temp file, and it will not
224 // be removed once the URLFetcher is destroyed. User should not take 230 // be removed once the URLFetcher is destroyed. User should not take
225 // ownership more than once, or call this method after taking ownership. 231 // ownership more than once, or call this method after taking ownership.
226 virtual bool GetResponseAsFilePath(bool take_ownership, 232 virtual bool GetResponseAsFilePath(bool take_ownership,
227 FilePath* out_response_path) const = 0; 233 FilePath* out_response_path) const = 0;
228 }; 234 };
229 235
230 } // namespace content 236 } // namespace content
231 237
232 #endif // CONTENT_PUBLIC_COMMON_URL_FETCHER_H_ 238 #endif // CONTENT_PUBLIC_COMMON_URL_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698