#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 {
class HttpResponseInfo;
class IOBuffer;
struct LoadTimingInfo;
+class ProxyInfo;
+class QuicServerInfo;
class X509Certificate;
// Represents a single HTTP transaction (i.e., a single request/response pair).
// 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() {}
// 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
// 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
// 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