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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 class HttpResponseInfo; | 21 class HttpResponseInfo; |
22 class IOBuffer; | 22 class IOBuffer; |
23 struct LoadTimingInfo; | 23 struct LoadTimingInfo; |
24 class X509Certificate; | 24 class X509Certificate; |
25 | 25 |
26 // Represents a single HTTP transaction (i.e., a single request/response pair). | 26 // Represents a single HTTP transaction (i.e., a single request/response pair). |
27 // HTTP redirects are not followed and authentication challenges are not | 27 // HTTP redirects are not followed and authentication challenges are not |
28 // answered. Cookies are assumed to be managed by the caller. | 28 // answered. Cookies are assumed to be managed by the caller. |
29 class NET_EXPORT_PRIVATE HttpTransaction { | 29 class NET_EXPORT_PRIVATE HttpTransaction { |
30 public: | 30 public: |
| 31 // If |*defer| is set to true, the transaction will wait until |
| 32 // ResumeNetworkStart is called before establishing a connection. |
| 33 typedef base::Callback<void(bool* defer)> BeforeNetworkStartCallback; |
| 34 |
31 // Stops any pending IO and destroys the transaction object. | 35 // Stops any pending IO and destroys the transaction object. |
32 virtual ~HttpTransaction() {} | 36 virtual ~HttpTransaction() {} |
33 | 37 |
34 // Starts the HTTP transaction (i.e., sends the HTTP request). | 38 // Starts the HTTP transaction (i.e., sends the HTTP request). |
35 // | 39 // |
36 // Returns OK if the transaction could be started synchronously, which means | 40 // Returns OK if the transaction could be started synchronously, which means |
37 // that the request was served from the cache. ERR_IO_PENDING is returned to | 41 // that the request was served from the cache. ERR_IO_PENDING is returned to |
38 // indicate that the CompletionCallback will be notified once response info is | 42 // indicate that the CompletionCallback will be notified once response info is |
39 // available or if an IO error occurs. Any other return value indicates that | 43 // available or if an IO error occurs. Any other return value indicates that |
40 // the transaction could not be started. | 44 // the transaction could not be started. |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 virtual bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const = 0; | 141 virtual bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const = 0; |
138 | 142 |
139 // Called when the priority of the parent job changes. | 143 // Called when the priority of the parent job changes. |
140 virtual void SetPriority(RequestPriority priority) = 0; | 144 virtual void SetPriority(RequestPriority priority) = 0; |
141 | 145 |
142 // Set the WebSocketHandshakeStreamBase::CreateHelper to be used for the | 146 // Set the WebSocketHandshakeStreamBase::CreateHelper to be used for the |
143 // request. Only relevant to WebSocket transactions. Must be called before | 147 // request. Only relevant to WebSocket transactions. Must be called before |
144 // Start(). Ownership of |create_helper| remains with the caller. | 148 // Start(). Ownership of |create_helper| remains with the caller. |
145 virtual void SetWebSocketHandshakeStreamCreateHelper( | 149 virtual void SetWebSocketHandshakeStreamCreateHelper( |
146 WebSocketHandshakeStreamBase::CreateHelper* create_helper) = 0; | 150 WebSocketHandshakeStreamBase::CreateHelper* create_helper) = 0; |
| 151 |
| 152 // Set the callback to receive notification just before network use. |
| 153 virtual void SetBeforeNetworkStartCallback( |
| 154 const BeforeNetworkStartCallback& callback) = 0; |
| 155 |
| 156 // Resumes the transaction after being deferred. |
| 157 virtual int ResumeNetworkStart() = 0; |
147 }; | 158 }; |
148 | 159 |
149 } // namespace net | 160 } // namespace net |
150 | 161 |
151 #endif // NET_HTTP_HTTP_TRANSACTION_H_ | 162 #endif // NET_HTTP_HTTP_TRANSACTION_H_ |
OLD | NEW |