OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_HTTP_HTTP_TRANSACTION_H_ | 5 #ifndef NET_HTTP_HTTP_TRANSACTION_H_ |
6 #define NET_HTTP_HTTP_TRANSACTION_H_ | 6 #define NET_HTTP_HTTP_TRANSACTION_H_ |
7 | 7 |
8 #include "net/base/completion_callback.h" | 8 #include "net/base/completion_callback.h" |
9 #include "net/base/load_states.h" | 9 #include "net/base/load_states.h" |
10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
11 #include "net/base/request_priority.h" | 11 #include "net/base/request_priority.h" |
12 #include "net/base/upload_progress.h" | 12 #include "net/base/upload_progress.h" |
13 #include "net/websockets/websocket_handshake_stream_base.h" | 13 #include "net/websockets/websocket_handshake_stream_base.h" |
14 | 14 |
15 namespace net { | 15 namespace net { |
16 | 16 |
17 class AuthCredentials; | 17 class AuthCredentials; |
18 class BoundNetLog; | 18 class BoundNetLog; |
19 class HttpRequestHeaders; | 19 class HttpRequestHeaders; |
20 struct HttpRequestInfo; | 20 struct HttpRequestInfo; |
21 class HttpResponseInfo; | 21 class HttpResponseInfo; |
22 class IOBuffer; | 22 class IOBuffer; |
23 struct LoadTimingInfo; | 23 struct LoadTimingInfo; |
| 24 class ProxyInfo; |
24 class QuicServerInfo; | 25 class QuicServerInfo; |
25 class X509Certificate; | 26 class X509Certificate; |
26 | 27 |
27 // Represents a single HTTP transaction (i.e., a single request/response pair). | 28 // Represents a single HTTP transaction (i.e., a single request/response pair). |
28 // HTTP redirects are not followed and authentication challenges are not | 29 // HTTP redirects are not followed and authentication challenges are not |
29 // answered. Cookies are assumed to be managed by the caller. | 30 // answered. Cookies are assumed to be managed by the caller. |
30 class NET_EXPORT_PRIVATE HttpTransaction { | 31 class NET_EXPORT_PRIVATE HttpTransaction { |
31 public: | 32 public: |
32 // If |*defer| is set to true, the transaction will wait until | 33 // If |*defer| is set to true, the transaction will wait until |
33 // ResumeNetworkStart is called before establishing a connection. | 34 // ResumeNetworkStart is called before establishing a connection. |
34 typedef base::Callback<void(bool* defer)> BeforeNetworkStartCallback; | 35 typedef base::Callback<void(bool* defer)> BeforeNetworkStartCallback; |
35 | 36 |
| 37 // Provides an opportunity to add proxy-specific request headers. Called after |
| 38 // it is determined that a proxy is being used and before the request headers |
| 39 // are sent. |proxy_info| contains information about the proxy being used. |
| 40 typedef base::Callback<void( |
| 41 const ProxyInfo& proxy_info)> BeforeProxyHeadersSentCallback; |
| 42 |
36 // Stops any pending IO and destroys the transaction object. | 43 // Stops any pending IO and destroys the transaction object. |
37 virtual ~HttpTransaction() {} | 44 virtual ~HttpTransaction() {} |
38 | 45 |
39 // Starts the HTTP transaction (i.e., sends the HTTP request). | 46 // Starts the HTTP transaction (i.e., sends the HTTP request). |
40 // | 47 // |
41 // Returns OK if the transaction could be started synchronously, which means | 48 // Returns OK if the transaction could be started synchronously, which means |
42 // that the request was served from the cache. ERR_IO_PENDING is returned to | 49 // that the request was served from the cache. ERR_IO_PENDING is returned to |
43 // indicate that the CompletionCallback will be notified once response info is | 50 // indicate that the CompletionCallback will be notified once response info is |
44 // available or if an IO error occurs. Any other return value indicates that | 51 // available or if an IO error occurs. Any other return value indicates that |
45 // the transaction could not be started. | 52 // the transaction could not be started. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // Set the WebSocketHandshakeStreamBase::CreateHelper to be used for the | 158 // Set the WebSocketHandshakeStreamBase::CreateHelper to be used for the |
152 // request. Only relevant to WebSocket transactions. Must be called before | 159 // request. Only relevant to WebSocket transactions. Must be called before |
153 // Start(). Ownership of |create_helper| remains with the caller. | 160 // Start(). Ownership of |create_helper| remains with the caller. |
154 virtual void SetWebSocketHandshakeStreamCreateHelper( | 161 virtual void SetWebSocketHandshakeStreamCreateHelper( |
155 WebSocketHandshakeStreamBase::CreateHelper* create_helper) = 0; | 162 WebSocketHandshakeStreamBase::CreateHelper* create_helper) = 0; |
156 | 163 |
157 // Set the callback to receive notification just before network use. | 164 // Set the callback to receive notification just before network use. |
158 virtual void SetBeforeNetworkStartCallback( | 165 virtual void SetBeforeNetworkStartCallback( |
159 const BeforeNetworkStartCallback& callback) = 0; | 166 const BeforeNetworkStartCallback& callback) = 0; |
160 | 167 |
| 168 // Set the callback to receive notification just before a proxy request |
| 169 // is to be sent. |
| 170 virtual void SetBeforeProxyHeadersSentCallback( |
| 171 const BeforeProxyHeadersSentCallback& callback) = 0; |
| 172 |
161 // Resumes the transaction after being deferred. | 173 // Resumes the transaction after being deferred. |
162 virtual int ResumeNetworkStart() = 0; | 174 virtual int ResumeNetworkStart() = 0; |
163 }; | 175 }; |
164 | 176 |
165 } // namespace net | 177 } // namespace net |
166 | 178 |
167 #endif // NET_HTTP_HTTP_TRANSACTION_H_ | 179 #endif // NET_HTTP_HTTP_TRANSACTION_H_ |
OLD | NEW |