Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: net/base/network_delegate.h

Issue 1284993005: Notify NetworkDelegate when bytes have been received over the network. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed tbansal comments Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
9
8 #include <string> 10 #include <string>
9 11
10 #include "base/callback.h" 12 #include "base/callback.h"
11 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
12 #include "base/threading/non_thread_safe.h" 14 #include "base/threading/non_thread_safe.h"
13 #include "net/base/auth.h" 15 #include "net/base/auth.h"
14 #include "net/base/completion_callback.h" 16 #include "net/base/completion_callback.h"
15 #include "net/cookies/canonical_cookie.h" 17 #include "net/cookies/canonical_cookie.h"
16 18
17 class GURL; 19 class GURL;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 int NotifyHeadersReceived( 81 int NotifyHeadersReceived(
80 URLRequest* request, 82 URLRequest* request,
81 const CompletionCallback& callback, 83 const CompletionCallback& callback,
82 const HttpResponseHeaders* original_response_headers, 84 const HttpResponseHeaders* original_response_headers,
83 scoped_refptr<HttpResponseHeaders>* override_response_headers, 85 scoped_refptr<HttpResponseHeaders>* override_response_headers,
84 GURL* allowed_unsafe_redirect_url); 86 GURL* allowed_unsafe_redirect_url);
85 void NotifyBeforeRedirect(URLRequest* request, 87 void NotifyBeforeRedirect(URLRequest* request,
86 const GURL& new_location); 88 const GURL& new_location);
87 void NotifyResponseStarted(URLRequest* request); 89 void NotifyResponseStarted(URLRequest* request);
88 void NotifyRawBytesRead(const URLRequest& request, int bytes_read); 90 void NotifyRawBytesRead(const URLRequest& request, int bytes_read);
91 void NotifyNetworkBytesReceived(const URLRequest& request,
92 int64_t bytes_received);
89 void NotifyCompleted(URLRequest* request, bool started); 93 void NotifyCompleted(URLRequest* request, bool started);
90 void NotifyURLRequestDestroyed(URLRequest* request); 94 void NotifyURLRequestDestroyed(URLRequest* request);
91 void NotifyPACScriptError(int line_number, const base::string16& error); 95 void NotifyPACScriptError(int line_number, const base::string16& error);
92 AuthRequiredResponse NotifyAuthRequired(URLRequest* request, 96 AuthRequiredResponse NotifyAuthRequired(URLRequest* request,
93 const AuthChallengeInfo& auth_info, 97 const AuthChallengeInfo& auth_info,
94 const AuthCallback& callback, 98 const AuthCallback& callback,
95 AuthCredentials* credentials); 99 AuthCredentials* credentials);
96 bool CanGetCookies(const URLRequest& request, 100 bool CanGetCookies(const URLRequest& request,
97 const CookieList& cookie_list); 101 const CookieList& cookie_list);
98 bool CanSetCookie(const URLRequest& request, 102 bool CanSetCookie(const URLRequest& request,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // request. 198 // request.
195 virtual void OnBeforeRedirect(URLRequest* request, 199 virtual void OnBeforeRedirect(URLRequest* request,
196 const GURL& new_location) = 0; 200 const GURL& new_location) = 0;
197 201
198 // This corresponds to URLRequestDelegate::OnResponseStarted. 202 // This corresponds to URLRequestDelegate::OnResponseStarted.
199 virtual void OnResponseStarted(URLRequest* request) = 0; 203 virtual void OnResponseStarted(URLRequest* request) = 0;
200 204
201 // Called every time we read raw bytes. 205 // Called every time we read raw bytes.
202 virtual void OnRawBytesRead(const URLRequest& request, int bytes_read) = 0; 206 virtual void OnRawBytesRead(const URLRequest& request, int bytes_read) = 0;
203 207
208 // Called when bytes are received from the network, such as after receiving
209 // headers or reading raw response bytes. This includes localhost requests.
210 // |bytes_received| is the number of bytes measured at the application layer
211 // that have been received over the network for this request since the last
212 // time OnNetworkBytesReceived was called. |bytes_received| will always be
213 // greater than 0.
214 // Currently, this is only implemented for HTTP transactions, and
215 // |bytes_received| does not include TLS overhead or 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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698