| 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 <string> | 9 #include <string> | 
| 9 | 10 | 
| 10 #include "base/callback.h" | 11 #include "base/callback.h" | 
| 11 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" | 
| 12 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" | 
| 13 #include "net/base/auth.h" | 14 #include "net/base/auth.h" | 
| 14 #include "net/base/completion_callback.h" | 15 #include "net/base/completion_callback.h" | 
| 15 #include "net/cookies/canonical_cookie.h" | 16 #include "net/cookies/canonical_cookie.h" | 
| 16 | 17 | 
| 17 class GURL; | 18 class GURL; | 
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 79   int NotifyHeadersReceived( | 80   int NotifyHeadersReceived( | 
| 80       URLRequest* request, | 81       URLRequest* request, | 
| 81       const CompletionCallback& callback, | 82       const CompletionCallback& callback, | 
| 82       const HttpResponseHeaders* original_response_headers, | 83       const HttpResponseHeaders* original_response_headers, | 
| 83       scoped_refptr<HttpResponseHeaders>* override_response_headers, | 84       scoped_refptr<HttpResponseHeaders>* override_response_headers, | 
| 84       GURL* allowed_unsafe_redirect_url); | 85       GURL* allowed_unsafe_redirect_url); | 
| 85   void NotifyBeforeRedirect(URLRequest* request, | 86   void NotifyBeforeRedirect(URLRequest* request, | 
| 86                             const GURL& new_location); | 87                             const GURL& new_location); | 
| 87   void NotifyResponseStarted(URLRequest* request); | 88   void NotifyResponseStarted(URLRequest* request); | 
| 88   void NotifyRawBytesRead(const URLRequest& request, int bytes_read); | 89   void NotifyRawBytesRead(const URLRequest& request, int bytes_read); | 
|  | 90   void NotifyNetworkBytesReceived(const URLRequest& request, | 
|  | 91                                   int64_t bytes_received); | 
| 89   void NotifyCompleted(URLRequest* request, bool started); | 92   void NotifyCompleted(URLRequest* request, bool started); | 
| 90   void NotifyURLRequestDestroyed(URLRequest* request); | 93   void NotifyURLRequestDestroyed(URLRequest* request); | 
| 91   void NotifyPACScriptError(int line_number, const base::string16& error); | 94   void NotifyPACScriptError(int line_number, const base::string16& error); | 
| 92   AuthRequiredResponse NotifyAuthRequired(URLRequest* request, | 95   AuthRequiredResponse NotifyAuthRequired(URLRequest* request, | 
| 93                                           const AuthChallengeInfo& auth_info, | 96                                           const AuthChallengeInfo& auth_info, | 
| 94                                           const AuthCallback& callback, | 97                                           const AuthCallback& callback, | 
| 95                                           AuthCredentials* credentials); | 98                                           AuthCredentials* credentials); | 
| 96   bool CanGetCookies(const URLRequest& request, | 99   bool CanGetCookies(const URLRequest& request, | 
| 97                      const CookieList& cookie_list); | 100                      const CookieList& cookie_list); | 
| 98   bool CanSetCookie(const URLRequest& request, | 101   bool CanSetCookie(const URLRequest& request, | 
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 194   // request. | 197   // request. | 
| 195   virtual void OnBeforeRedirect(URLRequest* request, | 198   virtual void OnBeforeRedirect(URLRequest* request, | 
| 196                                 const GURL& new_location) = 0; | 199                                 const GURL& new_location) = 0; | 
| 197 | 200 | 
| 198   // This corresponds to URLRequestDelegate::OnResponseStarted. | 201   // This corresponds to URLRequestDelegate::OnResponseStarted. | 
| 199   virtual void OnResponseStarted(URLRequest* request) = 0; | 202   virtual void OnResponseStarted(URLRequest* request) = 0; | 
| 200 | 203 | 
| 201   // Called every time we read raw bytes. | 204   // Called every time we read raw bytes. | 
| 202   virtual void OnRawBytesRead(const URLRequest& request, int bytes_read) = 0; | 205   virtual void OnRawBytesRead(const URLRequest& request, int bytes_read) = 0; | 
| 203 | 206 | 
|  | 207   // Called when bytes are received from the network, such as after receiving | 
|  | 208   // headers or reading raw response bytes. This includes localhost requests. | 
|  | 209   // |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 | 
|  | 211   // time OnNetworkBytesReceived was called. |bytes_received| will always be | 
|  | 212   // greater than 0. | 
|  | 213   // Currently, this is only implemented for HTTP transactions, and | 
|  | 214   // |bytes_received| does not include TLS overhead or any overhead below the | 
|  | 215   // application layer such as TCP retransmits. | 
|  | 216   virtual void OnNetworkBytesReceived(const URLRequest& request, | 
|  | 217                                       int64_t bytes_received) = 0; | 
|  | 218 | 
| 204   // Indicates that the URL request has been completed or failed. | 219   // Indicates that the URL request has been completed or failed. | 
| 205   // |started| indicates whether the request has been started. If false, | 220   // |started| indicates whether the request has been started. If false, | 
| 206   // some information like the socket address is not available. | 221   // some information like the socket address is not available. | 
| 207   virtual void OnCompleted(URLRequest* request, bool started) = 0; | 222   virtual void OnCompleted(URLRequest* request, bool started) = 0; | 
| 208 | 223 | 
| 209   // Called when an URLRequest is being destroyed. Note that the request is | 224   // Called when an URLRequest is being destroyed. Note that the request is | 
| 210   // being deleted, so it's not safe to call any methods that may result in | 225   // being deleted, so it's not safe to call any methods that may result in | 
| 211   // a virtual method call. | 226   // a virtual method call. | 
| 212   virtual void OnURLRequestDestroyed(URLRequest* request) = 0; | 227   virtual void OnURLRequestDestroyed(URLRequest* request) = 0; | 
| 213 | 228 | 
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 278   // header is stripped from the request. | 293   // header is stripped from the request. | 
| 279   virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 294   virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 
| 280       const URLRequest& request, | 295       const URLRequest& request, | 
| 281       const GURL& target_url, | 296       const GURL& target_url, | 
| 282       const GURL& referrer_url) const = 0; | 297       const GURL& referrer_url) const = 0; | 
| 283 }; | 298 }; | 
| 284 | 299 | 
| 285 }  // namespace net | 300 }  // namespace net | 
| 286 | 301 | 
| 287 #endif  // NET_BASE_NETWORK_DELEGATE_H_ | 302 #endif  // NET_BASE_NETWORK_DELEGATE_H_ | 
| OLD | NEW | 
|---|