Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / components / cronet / android / url_request_adapter.h
index aad1893..1ee3c4e 100644 (file)
@@ -20,6 +20,7 @@ namespace net {
 class GrowableIOBuffer;
 class HttpResponseHeaders;
 class UploadDataStream;
+class RedirectInfo;
 }  // namespace net
 
 namespace cronet {
@@ -62,6 +63,9 @@ class URLRequestAdapter : public net::URLRequest::Delegate {
   // Sets the request to streaming upload.
   void SetUploadChannel(JNIEnv* env, int64 content_length);
 
+  // Disables redirect. Note that redirect is enabled by default.
+  void DisableRedirects();
+
   // Indicates that the request body will be streamed by calling AppendChunk()
   // repeatedly. This must be called before Start().
   void EnableChunkedUpload();
@@ -91,6 +95,11 @@ class URLRequestAdapter : public net::URLRequest::Delegate {
     return http_status_code_;
   };
 
+  // Returns the HTTP status text of the normalized status line.
+  const std::string& http_status_text() const {
+    return http_status_text_;
+  }
+
   // Returns the value of the content-length response header.
   int64 content_length() const { return expected_size_; }
 
@@ -112,10 +121,14 @@ class URLRequestAdapter : public net::URLRequest::Delegate {
   // Get NPN or ALPN Negotiated Protocol (if any) from HttpResponseInfo.
   std::string GetNegotiatedProtocol() const;
 
-  virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE;
+  // net::URLRequest::Delegate implementation:
+  void OnResponseStarted(net::URLRequest* request) override;
+  void OnReadCompleted(net::URLRequest* request, int bytes_read) override;
+  void OnReceivedRedirect(net::URLRequest* request,
+                          const net::RedirectInfo& redirect_info,
+                          bool* defer_redirect) override;
 
-  virtual void OnReadCompleted(net::URLRequest* request,
-                               int bytes_read) OVERRIDE;
+  bool OnNetworkThread() const;
 
  private:
   static void OnDestroyRequest(URLRequestAdapter* self);
@@ -145,10 +158,13 @@ class URLRequestAdapter : public net::URLRequest::Delegate {
   int total_bytes_read_;
   int error_code_;
   int http_status_code_;
+  std::string http_status_text_;
   std::string content_type_;
   bool canceled_;
   int64 expected_size_;
   bool chunked_upload_;
+  // Indicates whether redirect has been disabled.
+  bool disable_redirect_;
 
   DISALLOW_COPY_AND_ASSIGN(URLRequestAdapter);
 };