Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / net / http / http_transaction.h
index d440500..52b3c97 100644 (file)
@@ -10,6 +10,7 @@
 #include "net/base/net_export.h"
 #include "net/base/request_priority.h"
 #include "net/base/upload_progress.h"
+#include "net/websockets/websocket_handshake_stream_base.h"
 
 namespace net {
 
@@ -20,6 +21,8 @@ struct HttpRequestInfo;
 class HttpResponseInfo;
 class IOBuffer;
 struct LoadTimingInfo;
+class ProxyInfo;
+class QuicServerInfo;
 class X509Certificate;
 
 // Represents a single HTTP transaction (i.e., a single request/response pair).
@@ -27,6 +30,18 @@ class X509Certificate;
 // answered.  Cookies are assumed to be managed by the caller.
 class NET_EXPORT_PRIVATE HttpTransaction {
  public:
+  // If |*defer| is set to true, the transaction will wait until
+  // ResumeNetworkStart is called before establishing a connection.
+  typedef base::Callback<void(bool* defer)> BeforeNetworkStartCallback;
+
+  // Provides an opportunity to add proxy-specific request headers. Called after
+  // it is determined that a proxy is being used and before the request headers
+  // are sent. |proxy_info| contains information about the proxy being used,
+  // and additional headers may be added to |request_headers|.
+  typedef base::Callback<void(
+      const ProxyInfo& proxy_info,
+      HttpRequestHeaders* request_headers)> BeforeProxyHeadersSentCallback;
+
   // Stops any pending IO and destroys the transaction object.
   virtual ~HttpTransaction() {}
 
@@ -105,6 +120,9 @@ class NET_EXPORT_PRIVATE HttpTransaction {
   // otherwise, returns false and does not modify headers.
   virtual bool GetFullRequestHeaders(HttpRequestHeaders* headers) const = 0;
 
+  // Get the number of bytes received from network.
+  virtual int64 GetTotalReceivedBytes() const = 0;
+
   // Called to tell the transaction that we have successfully reached the end
   // of the stream. This is equivalent to performing an extra Read() at the end
   // that should return 0 bytes. This method should not be called if the
@@ -125,6 +143,10 @@ class NET_EXPORT_PRIVATE HttpTransaction {
   // zero will be returned.  This does not include the request headers.
   virtual UploadProgress GetUploadProgress() const = 0;
 
+  // SetQuicServerInfo sets a object which reads and writes public information
+  // about a QUIC server.
+  virtual void SetQuicServerInfo(QuicServerInfo* quic_server_info) = 0;
+
   // Populates all of load timing, except for request start times and receive
   // headers time.
   // |load_timing_info| must have all null times when called.  Returns false and
@@ -134,6 +156,24 @@ class NET_EXPORT_PRIVATE HttpTransaction {
 
   // Called when the priority of the parent job changes.
   virtual void SetPriority(RequestPriority priority) = 0;
+
+  // Set the WebSocketHandshakeStreamBase::CreateHelper to be used for the
+  // request.  Only relevant to WebSocket transactions. Must be called before
+  // Start(). Ownership of |create_helper| remains with the caller.
+  virtual void SetWebSocketHandshakeStreamCreateHelper(
+      WebSocketHandshakeStreamBase::CreateHelper* create_helper) = 0;
+
+  // Set the callback to receive notification just before network use.
+  virtual void SetBeforeNetworkStartCallback(
+      const BeforeNetworkStartCallback& callback) = 0;
+
+  // Set the callback to receive notification just before a proxy request
+  // is to be sent.
+  virtual void SetBeforeProxyHeadersSentCallback(
+      const BeforeProxyHeadersSentCallback& callback) = 0;
+
+  // Resumes the transaction after being deferred.
+  virtual int ResumeNetworkStart() = 0;
 };
 
 }  // namespace net