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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 URLRequest* request, | 82 URLRequest* request, |
83 const CompletionCallback& callback, | 83 const CompletionCallback& callback, |
84 const HttpResponseHeaders* original_response_headers, | 84 const HttpResponseHeaders* original_response_headers, |
85 scoped_refptr<HttpResponseHeaders>* override_response_headers, | 85 scoped_refptr<HttpResponseHeaders>* override_response_headers, |
86 GURL* allowed_unsafe_redirect_url); | 86 GURL* allowed_unsafe_redirect_url); |
87 void NotifyBeforeRedirect(URLRequest* request, | 87 void NotifyBeforeRedirect(URLRequest* request, |
88 const GURL& new_location); | 88 const GURL& new_location); |
89 void NotifyResponseStarted(URLRequest* request); | 89 void NotifyResponseStarted(URLRequest* request); |
90 void NotifyNetworkBytesReceived(const URLRequest& request, | 90 void NotifyNetworkBytesReceived(const URLRequest& request, |
91 int64_t bytes_received); | 91 int64_t bytes_received); |
| 92 void NotifyNetworkBytesSent(const URLRequest& request, int64_t bytes_sent); |
92 void NotifyCompleted(URLRequest* request, bool started); | 93 void NotifyCompleted(URLRequest* request, bool started); |
93 void NotifyURLRequestDestroyed(URLRequest* request); | 94 void NotifyURLRequestDestroyed(URLRequest* request); |
94 void NotifyURLRequestJobOrphaned(URLRequest* request); | 95 void NotifyURLRequestJobOrphaned(URLRequest* request); |
95 void NotifyPACScriptError(int line_number, const base::string16& error); | 96 void NotifyPACScriptError(int line_number, const base::string16& error); |
96 AuthRequiredResponse NotifyAuthRequired(URLRequest* request, | 97 AuthRequiredResponse NotifyAuthRequired(URLRequest* request, |
97 const AuthChallengeInfo& auth_info, | 98 const AuthChallengeInfo& auth_info, |
98 const AuthCallback& callback, | 99 const AuthCallback& callback, |
99 AuthCredentials* credentials); | 100 AuthCredentials* credentials); |
100 bool CanGetCookies(const URLRequest& request, | 101 bool CanGetCookies(const URLRequest& request, |
101 const CookieList& cookie_list); | 102 const CookieList& cookie_list); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 // headers or reading raw response bytes. This includes localhost requests. | 207 // headers or reading raw response bytes. This includes localhost requests. |
207 // |bytes_received| is the number of bytes measured at the application layer | 208 // |bytes_received| is the number of bytes measured at the application layer |
208 // that have been received over the network for this request since the last | 209 // that have been received over the network for this request since the last |
209 // time OnNetworkBytesReceived was called. |bytes_received| will always be | 210 // time OnNetworkBytesReceived was called. |bytes_received| will always be |
210 // greater than 0. | 211 // greater than 0. |
211 // Currently, this is only implemented for HTTP transactions, and | 212 // Currently, this is only implemented for HTTP transactions, and |
212 // |bytes_received| does not include TLS overhead or TCP retransmits. | 213 // |bytes_received| does not include TLS overhead or TCP retransmits. |
213 virtual void OnNetworkBytesReceived(const URLRequest& request, | 214 virtual void OnNetworkBytesReceived(const URLRequest& request, |
214 int64_t bytes_received) = 0; | 215 int64_t bytes_received) = 0; |
215 | 216 |
| 217 // Called when bytes are sent over the network, such as when sending request |
| 218 // headers or uploading request body bytes. This includes localhost requests. |
| 219 // |bytes_sent| is the number of bytes measured at the application layer that |
| 220 // have been sent over the network for this request since the last time |
| 221 // OnNetworkBytesSent was called. |bytes_sent| will always be greater than 0. |
| 222 // Currently, this is only implemented for HTTP transactions, and |bytes_sent| |
| 223 // does not include TLS overhead or TCP retransmits. |
| 224 virtual void OnNetworkBytesSent(const URLRequest& request, |
| 225 int64_t bytes_sent) = 0; |
| 226 |
216 // Indicates that the URL request has been completed or failed. | 227 // Indicates that the URL request has been completed or failed. |
217 // |started| indicates whether the request has been started. If false, | 228 // |started| indicates whether the request has been started. If false, |
218 // some information like the socket address is not available. | 229 // some information like the socket address is not available. |
219 virtual void OnCompleted(URLRequest* request, bool started) = 0; | 230 virtual void OnCompleted(URLRequest* request, bool started) = 0; |
220 | 231 |
221 // Called when an URLRequest is being destroyed. Note that the request is | 232 // Called when an URLRequest is being destroyed. Note that the request is |
222 // being deleted, so it's not safe to call any methods that may result in | 233 // being deleted, so it's not safe to call any methods that may result in |
223 // a virtual method call. | 234 // a virtual method call. |
224 virtual void OnURLRequestDestroyed(URLRequest* request) = 0; | 235 virtual void OnURLRequestDestroyed(URLRequest* request) = 0; |
225 | 236 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 // header is stripped from the request. | 308 // header is stripped from the request. |
298 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 309 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
299 const URLRequest& request, | 310 const URLRequest& request, |
300 const GURL& target_url, | 311 const GURL& target_url, |
301 const GURL& referrer_url) const = 0; | 312 const GURL& referrer_url) const = 0; |
302 }; | 313 }; |
303 | 314 |
304 } // namespace net | 315 } // namespace net |
305 | 316 |
306 #endif // NET_BASE_NETWORK_DELEGATE_H_ | 317 #endif // NET_BASE_NETWORK_DELEGATE_H_ |
OLD | NEW |