OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BASE_NETWORK_DELEGATE_H_ | 5 #ifndef NET_BASE_NETWORK_DELEGATE_H_ |
6 #define NET_BASE_NETWORK_DELEGATE_H_ | 6 #define NET_BASE_NETWORK_DELEGATE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 void NotifyStartTransaction(URLRequest* request, | 73 void NotifyStartTransaction(URLRequest* request, |
74 const HttpRequestHeaders& headers); | 74 const HttpRequestHeaders& headers); |
75 int NotifyHeadersReceived( | 75 int NotifyHeadersReceived( |
76 URLRequest* request, | 76 URLRequest* request, |
77 const CompletionCallback& callback, | 77 const CompletionCallback& callback, |
78 const HttpResponseHeaders* original_response_headers, | 78 const HttpResponseHeaders* original_response_headers, |
79 scoped_refptr<HttpResponseHeaders>* override_response_headers, | 79 scoped_refptr<HttpResponseHeaders>* override_response_headers, |
80 GURL* allowed_unsafe_redirect_url); | 80 GURL* allowed_unsafe_redirect_url); |
81 void NotifyBeforeRedirect(URLRequest* request, | 81 void NotifyBeforeRedirect(URLRequest* request, |
82 const GURL& new_location); | 82 const GURL& new_location); |
| 83 void NotifyResponseStarted(URLRequest* request, int net_error); |
| 84 // Deprecated. |
83 void NotifyResponseStarted(URLRequest* request); | 85 void NotifyResponseStarted(URLRequest* request); |
84 void NotifyNetworkBytesReceived(URLRequest* request, int64_t bytes_received); | 86 void NotifyNetworkBytesReceived(URLRequest* request, int64_t bytes_received); |
85 void NotifyNetworkBytesSent(URLRequest* request, int64_t bytes_sent); | 87 void NotifyNetworkBytesSent(URLRequest* request, int64_t bytes_sent); |
| 88 void NotifyCompleted(URLRequest* request, bool started, int net_error); |
| 89 // Deprecated. |
86 void NotifyCompleted(URLRequest* request, bool started); | 90 void NotifyCompleted(URLRequest* request, bool started); |
87 void NotifyURLRequestDestroyed(URLRequest* request); | 91 void NotifyURLRequestDestroyed(URLRequest* request); |
88 void NotifyPACScriptError(int line_number, const base::string16& error); | 92 void NotifyPACScriptError(int line_number, const base::string16& error); |
89 AuthRequiredResponse NotifyAuthRequired(URLRequest* request, | 93 AuthRequiredResponse NotifyAuthRequired(URLRequest* request, |
90 const AuthChallengeInfo& auth_info, | 94 const AuthChallengeInfo& auth_info, |
91 const AuthCallback& callback, | 95 const AuthCallback& callback, |
92 AuthCredentials* credentials); | 96 AuthCredentials* credentials); |
93 bool CanGetCookies(const URLRequest& request, | 97 bool CanGetCookies(const URLRequest& request, |
94 const CookieList& cookie_list); | 98 const CookieList& cookie_list); |
95 bool CanSetCookie(const URLRequest& request, | 99 bool CanSetCookie(const URLRequest& request, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 scoped_refptr<HttpResponseHeaders>* override_response_headers, | 182 scoped_refptr<HttpResponseHeaders>* override_response_headers, |
179 GURL* allowed_unsafe_redirect_url) = 0; | 183 GURL* allowed_unsafe_redirect_url) = 0; |
180 | 184 |
181 // Called right after a redirect response code was received. | 185 // Called right after a redirect response code was received. |
182 // |new_location| is only valid until OnURLRequestDestroyed is called for this | 186 // |new_location| is only valid until OnURLRequestDestroyed is called for this |
183 // request. | 187 // request. |
184 virtual void OnBeforeRedirect(URLRequest* request, | 188 virtual void OnBeforeRedirect(URLRequest* request, |
185 const GURL& new_location) = 0; | 189 const GURL& new_location) = 0; |
186 | 190 |
187 // This corresponds to URLRequestDelegate::OnResponseStarted. | 191 // This corresponds to URLRequestDelegate::OnResponseStarted. |
188 virtual void OnResponseStarted(URLRequest* request) = 0; | 192 virtual void OnResponseStarted(URLRequest* request, int net_error); |
| 193 // Deprecated. |
| 194 virtual void OnResponseStarted(URLRequest* request); |
189 | 195 |
190 // Called when bytes are received from the network, such as after receiving | 196 // Called when bytes are received from the network, such as after receiving |
191 // headers or reading raw response bytes. This includes localhost requests. | 197 // headers or reading raw response bytes. This includes localhost requests. |
192 // |bytes_received| is the number of bytes measured at the application layer | 198 // |bytes_received| is the number of bytes measured at the application layer |
193 // that have been received over the network for this request since the last | 199 // that have been received over the network for this request since the last |
194 // time OnNetworkBytesReceived was called. |bytes_received| will always be | 200 // time OnNetworkBytesReceived was called. |bytes_received| will always be |
195 // greater than 0. | 201 // greater than 0. |
196 // Currently, this is only implemented for HTTP transactions, and | 202 // Currently, this is only implemented for HTTP transactions, and |
197 // |bytes_received| does not include TLS overhead or TCP retransmits. | 203 // |bytes_received| does not include TLS overhead or TCP retransmits. |
198 virtual void OnNetworkBytesReceived(URLRequest* request, | 204 virtual void OnNetworkBytesReceived(URLRequest* request, |
199 int64_t bytes_received) = 0; | 205 int64_t bytes_received) = 0; |
200 | 206 |
201 // Called when bytes are sent over the network, such as when sending request | 207 // Called when bytes are sent over the network, such as when sending request |
202 // headers or uploading request body bytes. This includes localhost requests. | 208 // headers or uploading request body bytes. This includes localhost requests. |
203 // |bytes_sent| is the number of bytes measured at the application layer that | 209 // |bytes_sent| is the number of bytes measured at the application layer that |
204 // have been sent over the network for this request since the last time | 210 // have been sent over the network for this request since the last time |
205 // OnNetworkBytesSent was called. |bytes_sent| will always be greater than 0. | 211 // OnNetworkBytesSent was called. |bytes_sent| will always be greater than 0. |
206 // Currently, this is only implemented for HTTP transactions, and |bytes_sent| | 212 // Currently, this is only implemented for HTTP transactions, and |bytes_sent| |
207 // does not include TLS overhead or TCP retransmits. | 213 // does not include TLS overhead or TCP retransmits. |
208 virtual void OnNetworkBytesSent(URLRequest* request, int64_t bytes_sent) = 0; | 214 virtual void OnNetworkBytesSent(URLRequest* request, int64_t bytes_sent) = 0; |
209 | 215 |
210 // Indicates that the URL request has been completed or failed. | 216 // Indicates that the URL request has been completed or failed. |
211 // |started| indicates whether the request has been started. If false, | 217 // |started| indicates whether the request has been started. If false, |
212 // some information like the socket address is not available. | 218 // some information like the socket address is not available. |
213 virtual void OnCompleted(URLRequest* request, bool started) = 0; | 219 virtual void OnCompleted(URLRequest* request, bool started, int net_error); |
| 220 // Deprecated. |
| 221 virtual void OnCompleted(URLRequest* request, bool started); |
214 | 222 |
215 // Called when an URLRequest is being destroyed. Note that the request is | 223 // Called when an URLRequest is being destroyed. Note that the request is |
216 // being deleted, so it's not safe to call any methods that may result in | 224 // being deleted, so it's not safe to call any methods that may result in |
217 // a virtual method call. | 225 // a virtual method call. |
218 virtual void OnURLRequestDestroyed(URLRequest* request) = 0; | 226 virtual void OnURLRequestDestroyed(URLRequest* request) = 0; |
219 | 227 |
220 // Corresponds to ProxyResolverJSBindings::OnError. | 228 // Corresponds to ProxyResolverJSBindings::OnError. |
221 virtual void OnPACScriptError(int line_number, | 229 virtual void OnPACScriptError(int line_number, |
222 const base::string16& error) = 0; | 230 const base::string16& error) = 0; |
223 | 231 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 // header is stripped from the request. | 296 // header is stripped from the request. |
289 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 297 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
290 const URLRequest& request, | 298 const URLRequest& request, |
291 const GURL& target_url, | 299 const GURL& target_url, |
292 const GURL& referrer_url) const = 0; | 300 const GURL& referrer_url) const = 0; |
293 }; | 301 }; |
294 | 302 |
295 } // namespace net | 303 } // namespace net |
296 | 304 |
297 #endif // NET_BASE_NETWORK_DELEGATE_H_ | 305 #endif // NET_BASE_NETWORK_DELEGATE_H_ |
OLD | NEW |