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

Unified 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: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: net/url_request/url_fetcher.h
diff --git a/net/url_request/url_fetcher.h b/net/url_request/url_fetcher.h
index 5dcaedde0a9d7945a10bf9f2c40d0a086a8960d1..4c92a34c0c75cbf256682e1654e5f8bbe183c8bc 100644
--- a/net/url_request/url_fetcher.h
+++ b/net/url_request/url_fetcher.h
@@ -92,6 +92,11 @@ class NET_EXPORT URLFetcher {
// base::SupportsUserData::Data object every time it's called.
typedef base::Callback<base::SupportsUserData::Data*()> CreateDataCallback;
+ // Used by SetUploadStreamFactory. The callback should assign a fresh upload
+ // data stream every time it's called.
+ typedef base::Callback<scoped_ptr<UploadDataStream>()>
+ CreateUploadStreamCallback;
+
virtual ~URLFetcher();
// |url| is the URL to send the request to.
@@ -149,6 +154,15 @@ class NET_EXPORT URLFetcher {
uint64 range_length,
scoped_refptr<base::TaskRunner> file_task_runner) = 0;
+ // Sets data only needed by POSTs. All callers making POST requests should
+ // call one of the SetUpload* methods before the request is started.
+ // |upload_content_type| is the MIME type of the content, while |callback| is
+ // the callback to create the upload data stream (the Content-Length header
+ // value will be set to the length of this data).
mmenke 2015/01/15 15:38:54 Worth mentioning the callback may be called multip
hirono 2015/01/16 03:55:58 Done.
+ virtual void SetUploadStreamFactory(
+ const std::string& upload_content_type,
+ const CreateUploadStreamCallback& callback) = 0;
+
// Indicates that the POST data is sent via chunked transfer encoding.
// This may only be called before calling Start().
// Use AppendChunkToUpload() to give the data chunks after calling Start().

Powered by Google App Engine
This is Rietveld 408576698