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

Unified Diff: components/cronet/android/url_request_adapter.h

Issue 470443005: Cronet modifications to support AGSA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Cronet modifications to support AGSA. Created 6 years, 4 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: components/cronet/android/url_request_adapter.h
diff --git a/components/cronet/android/url_request_adapter.h b/components/cronet/android/url_request_adapter.h
index 482f175f626527975157ff9f2736fde8f475030d..91e2619fa1b52b06224d572b776a4ad8327d5a49 100644
--- a/components/cronet/android/url_request_adapter.h
+++ b/components/cronet/android/url_request_adapter.h
@@ -30,14 +30,15 @@ class URLRequestContextAdapter;
// object.
class URLRequestAdapter : public net::URLRequest::Delegate {
public:
// The delegate which is called when the request finishes.
class URLRequestAdapterDelegate
: public base::RefCountedThreadSafe<URLRequestAdapterDelegate> {
public:
+ virtual void OnAppendChunkCompleted(URLRequestAdapter* request) = 0;
virtual void OnResponseStarted(URLRequestAdapter* request) = 0;
virtual void OnBytesRead(URLRequestAdapter* request) = 0;
virtual void OnRequestFinished(URLRequestAdapter* request) = 0;
virtual int ReadFromUploadChannel(net::IOBuffer* buf, int buf_length) = 0;
protected:
friend class base::RefCountedThreadSafe<URLRequestAdapterDelegate>;
@@ -58,14 +59,22 @@ class URLRequestAdapter : public net::URLRequest::Delegate {
// Sets the contents of the POST or PUT request
void SetUploadContent(const char* bytes, int bytes_len);
// Sets the request to streaming upload.
void SetUploadChannel(JNIEnv* env, int64 content_length);
+ // Indicates that the request body will be streamed by calling AppendChunk()
+ // repeatedly. This must be called before Start().
+ void EnableChunkedUpload();
+
+ // Appends a chunk to the POST body.
+ // This must be called after EnableChunkedUpload() and Start().
+ void AppendChunk(const char* bytes, int bytes_len, bool is_last_chunk);
+
// Starts the request.
void Start();
// Cancels the request.
void Cancel();
// Releases all resources for the request and deletes the object itself.
@@ -91,14 +100,17 @@ class URLRequestAdapter : public net::URLRequest::Delegate {
// Returns the value of the specified response header.
std::string GetHeader(const std::string& name) const;
// Get all response headers, as a HttpResponseHeaders object.
net::HttpResponseHeaders* GetResponseHeaders() const;
+ // Gets all request headers, if possible.
+ bool GetFullRequestHeaders(net::HttpRequestHeaders* headers) const;
+
// Returns the overall number of bytes read.
size_t bytes_read() const { return bytes_read_; }
// Returns a pointer to the downloaded data.
unsigned char* Data() const;
virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE;
@@ -132,14 +144,15 @@ class URLRequestAdapter : public net::URLRequest::Delegate {
int bytes_read_;
int total_bytes_read_;
int error_code_;
int http_status_code_;
std::string content_type_;
bool canceled_;
int64 expected_size_;
+ bool chunked_upload_;
DISALLOW_COPY_AND_ASSIGN(URLRequestAdapter);
};
} // namespace cronet
#endif // COMPONENTS_CRONET_ANDROID_URL_REQUEST_ADAPTER_H_

Powered by Google App Engine
This is Rietveld 408576698