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