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

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: 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>
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
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, int64 bytes_read);
tbansal1 2015/08/17 20:51:17 |bytes_read| or |bytes_received|? I believe you ar
bengr 2015/08/17 21:30:39 FWIW, I like "received" and "sent".
sclittle 2015/08/17 23:35:13 Changed to bytes_received.
89 void NotifyCompleted(URLRequest* request, bool started); 91 void NotifyCompleted(URLRequest* request, bool started);
90 void NotifyURLRequestDestroyed(URLRequest* request); 92 void NotifyURLRequestDestroyed(URLRequest* request);
91 void NotifyPACScriptError(int line_number, const base::string16& error); 93 void NotifyPACScriptError(int line_number, const base::string16& error);
92 AuthRequiredResponse NotifyAuthRequired(URLRequest* request, 94 AuthRequiredResponse NotifyAuthRequired(URLRequest* request,
93 const AuthChallengeInfo& auth_info, 95 const AuthChallengeInfo& auth_info,
94 const AuthCallback& callback, 96 const AuthCallback& callback,
95 AuthCredentials* credentials); 97 AuthCredentials* credentials);
96 bool CanGetCookies(const URLRequest& request, 98 bool CanGetCookies(const URLRequest& request,
97 const CookieList& cookie_list); 99 const CookieList& cookie_list);
98 bool CanSetCookie(const URLRequest& request, 100 bool CanSetCookie(const URLRequest& request,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // request. 196 // request.
195 virtual void OnBeforeRedirect(URLRequest* request, 197 virtual void OnBeforeRedirect(URLRequest* request,
196 const GURL& new_location) = 0; 198 const GURL& new_location) = 0;
197 199
198 // This corresponds to URLRequestDelegate::OnResponseStarted. 200 // This corresponds to URLRequestDelegate::OnResponseStarted.
199 virtual void OnResponseStarted(URLRequest* request) = 0; 201 virtual void OnResponseStarted(URLRequest* request) = 0;
200 202
201 // Called every time we read raw bytes. 203 // Called every time we read raw bytes.
202 virtual void OnRawBytesRead(const URLRequest& request, int bytes_read) = 0; 204 virtual void OnRawBytesRead(const URLRequest& request, int bytes_read) = 0;
203 205
206 // Called when bytes are received from the network, such as after receiving
tbansal1 2015/08/17 20:51:17 Would this also get triggered on requests that are
sclittle 2015/08/17 23:35:13 I've added a comment here. Right now, this would i
207 // headers or reading raw response bytes. |bytes_received| is the number of
208 // bytes measured at the application layer that have been received over the
bengr 2015/08/17 21:30:39 It's work some more comment space to be ultra spec
sclittle 2015/08/17 23:35:13 I've added some more detail here, but I'm not exac
209 // network since the last time OnNetworkBytesReceived was called.
210 // |bytes_received| will always be greater than 0.
211 virtual void OnNetworkBytesReceived(const URLRequest& request,
212 int64 bytes_received) = 0;
213
204 // Indicates that the URL request has been completed or failed. 214 // Indicates that the URL request has been completed or failed.
205 // |started| indicates whether the request has been started. If false, 215 // |started| indicates whether the request has been started. If false,
206 // some information like the socket address is not available. 216 // some information like the socket address is not available.
207 virtual void OnCompleted(URLRequest* request, bool started) = 0; 217 virtual void OnCompleted(URLRequest* request, bool started) = 0;
208 218
209 // Called when an URLRequest is being destroyed. Note that the request is 219 // 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 220 // being deleted, so it's not safe to call any methods that may result in
211 // a virtual method call. 221 // a virtual method call.
212 virtual void OnURLRequestDestroyed(URLRequest* request) = 0; 222 virtual void OnURLRequestDestroyed(URLRequest* request) = 0;
213 223
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // header is stripped from the request. 288 // header is stripped from the request.
279 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( 289 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
280 const URLRequest& request, 290 const URLRequest& request,
281 const GURL& target_url, 291 const GURL& target_url,
282 const GURL& referrer_url) const = 0; 292 const GURL& referrer_url) const = 0;
283 }; 293 };
284 294
285 } // namespace net 295 } // namespace net
286 296
287 #endif // NET_BASE_NETWORK_DELEGATE_H_ 297 #endif // NET_BASE_NETWORK_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698