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

Side by Side Diff: net/url_request/url_fetcher.h

Issue 809663003: net: Add SetUploadStream method to URLFetcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix retrying. Created 6 years 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
OLDNEW
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 DELETE_REQUEST, // DELETE is already taken on Windows. 85 DELETE_REQUEST, // DELETE is already taken on Windows.
86 // <winnt.h> defines a DELETE macro. 86 // <winnt.h> defines a DELETE macro.
87 PUT, 87 PUT,
88 PATCH, 88 PATCH,
89 }; 89 };
90 90
91 // Used by SetURLRequestUserData. The callback should make a fresh 91 // Used by SetURLRequestUserData. The callback should make a fresh
92 // base::SupportsUserData::Data object every time it's called. 92 // base::SupportsUserData::Data object every time it's called.
93 typedef base::Callback<base::SupportsUserData::Data*()> CreateDataCallback; 93 typedef base::Callback<base::SupportsUserData::Data*()> CreateDataCallback;
94 94
95 // Used by SetUploadStreamFactory. The callback should assign content type and
96 // a
mmenke 2015/01/09 17:42:25 The callback should not assign content type - that
hirono 2015/01/15 08:14:27 Done.
97 // fresh upload data stream every time it's called.
mmenke 2015/01/09 17:42:25 Nit: Merge lines
hirono 2015/01/15 08:14:27 Done.
98 typedef base::Callback<scoped_ptr<UploadDataStream>()>
99 CreateUploadStreamCallback;
100
95 virtual ~URLFetcher(); 101 virtual ~URLFetcher();
96 102
97 // |url| is the URL to send the request to. 103 // |url| is the URL to send the request to.
98 // |request_type| is the type of request to make. 104 // |request_type| is the type of request to make.
99 // |d| the object that will receive the callback on fetch completion. 105 // |d| the object that will receive the callback on fetch completion.
100 // Caller is responsible for destroying the returned URLFetcher. 106 // Caller is responsible for destroying the returned URLFetcher.
101 static URLFetcher* Create(const GURL& url, 107 static URLFetcher* Create(const GURL& url,
102 URLFetcher::RequestType request_type, 108 URLFetcher::RequestType request_type,
103 URLFetcherDelegate* d); 109 URLFetcherDelegate* d);
104 110
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // |range_offset| and |range_length| specify the range of the part 148 // |range_offset| and |range_length| specify the range of the part
143 // to be uploaded. To upload the whole file, (0, kuint64max) can be used. 149 // to be uploaded. To upload the whole file, (0, kuint64max) can be used.
144 // |file_task_runner| will be used for all file operations. 150 // |file_task_runner| will be used for all file operations.
145 virtual void SetUploadFilePath( 151 virtual void SetUploadFilePath(
146 const std::string& upload_content_type, 152 const std::string& upload_content_type,
147 const base::FilePath& file_path, 153 const base::FilePath& file_path,
148 uint64 range_offset, 154 uint64 range_offset,
149 uint64 range_length, 155 uint64 range_length,
150 scoped_refptr<base::TaskRunner> file_task_runner) = 0; 156 scoped_refptr<base::TaskRunner> file_task_runner) = 0;
151 157
158 // Sets data only needed by POSTs. All callers making POST requests should
159 // call one of the SetUpload* methods before the request is started.
160 // |upload_content_type| is the MIME type of the content, while
161 // |upload_stream| is the data to be sent (the Content-Length header value
162 // will be set to the length of this data).
mmenke 2015/01/09 17:42:24 There is no |upload_stream|. Should say something
hirono 2015/01/15 08:14:27 Done.
163 virtual void SetUploadStreamFactory(
164 const std::string& upload_content_type,
165 const CreateUploadStreamCallback& callback) = 0;
166
152 // Indicates that the POST data is sent via chunked transfer encoding. 167 // Indicates that the POST data is sent via chunked transfer encoding.
153 // This may only be called before calling Start(). 168 // This may only be called before calling Start().
154 // Use AppendChunkToUpload() to give the data chunks after calling Start(). 169 // Use AppendChunkToUpload() to give the data chunks after calling Start().
155 virtual void SetChunkedUpload(const std::string& upload_content_type) = 0; 170 virtual void SetChunkedUpload(const std::string& upload_content_type) = 0;
156 171
157 // Adds the given bytes to a request's POST data transmitted using chunked 172 // Adds the given bytes to a request's POST data transmitted using chunked
158 // transfer encoding. 173 // transfer encoding.
159 // This method should be called ONLY after calling Start(). 174 // This method should be called ONLY after calling Start().
160 virtual void AppendChunkToUpload(const std::string& data, 175 virtual void AppendChunkToUpload(const std::string& data,
161 bool is_last_chunk) = 0; 176 bool is_last_chunk) = 0;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 // be removed once the URLFetcher is destroyed. User should not take 316 // be removed once the URLFetcher is destroyed. User should not take
302 // ownership more than once, or call this method after taking ownership. 317 // ownership more than once, or call this method after taking ownership.
303 virtual bool GetResponseAsFilePath( 318 virtual bool GetResponseAsFilePath(
304 bool take_ownership, 319 bool take_ownership,
305 base::FilePath* out_response_path) const = 0; 320 base::FilePath* out_response_path) const = 0;
306 }; 321 };
307 322
308 } // namespace net 323 } // namespace net
309 324
310 #endif // NET_URL_REQUEST_URL_FETCHER_H_ 325 #endif // NET_URL_REQUEST_URL_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698