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

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: Removed empty cronet OnRawBytesRead implementation Created 5 years, 3 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
« no previous file with comments | « net/base/layered_network_delegate_unittest.cc ('k') | net/base/network_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 const HttpRequestHeaders& headers); 80 const HttpRequestHeaders& headers);
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 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 194
192 // Called right after a redirect response code was received. 195 // Called right after a redirect response code was received.
193 // |new_location| is only valid until OnURLRequestDestroyed is called for this 196 // |new_location| is only valid until OnURLRequestDestroyed is called for this
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 when bytes are received from the network, such as after receiving
202 virtual void OnRawBytesRead(const URLRequest& request, int bytes_read) = 0; 205 // headers or reading raw response bytes. This includes localhost requests.
206 // |bytes_received| is the number of bytes measured at the application layer
207 // that have been received over the network for this request since the last
208 // time OnNetworkBytesReceived was called. |bytes_received| will always be
209 // greater than 0.
210 // Currently, this is only implemented for HTTP transactions, and
211 // |bytes_received| does not include TLS overhead or TCP retransmits.
212 virtual void OnNetworkBytesReceived(const URLRequest& request,
213 int64_t bytes_received) = 0;
203 214
204 // Indicates that the URL request has been completed or failed. 215 // Indicates that the URL request has been completed or failed.
205 // |started| indicates whether the request has been started. If false, 216 // |started| indicates whether the request has been started. If false,
206 // some information like the socket address is not available. 217 // some information like the socket address is not available.
207 virtual void OnCompleted(URLRequest* request, bool started) = 0; 218 virtual void OnCompleted(URLRequest* request, bool started) = 0;
208 219
209 // Called when an URLRequest is being destroyed. Note that the request is 220 // 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 221 // being deleted, so it's not safe to call any methods that may result in
211 // a virtual method call. 222 // a virtual method call.
212 virtual void OnURLRequestDestroyed(URLRequest* request) = 0; 223 virtual void OnURLRequestDestroyed(URLRequest* request) = 0;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // header is stripped from the request. 289 // header is stripped from the request.
279 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( 290 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
280 const URLRequest& request, 291 const URLRequest& request,
281 const GURL& target_url, 292 const GURL& target_url,
282 const GURL& referrer_url) const = 0; 293 const GURL& referrer_url) const = 0;
283 }; 294 };
284 295
285 } // namespace net 296 } // namespace net
286 297
287 #endif // NET_BASE_NETWORK_DELEGATE_H_ 298 #endif // NET_BASE_NETWORK_DELEGATE_H_
OLDNEW
« no previous file with comments | « net/base/layered_network_delegate_unittest.cc ('k') | net/base/network_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698