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

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

Issue 1362793003: Notify NetworkDelegate when bytes have been sent over the network. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initial patch set Created 5 years, 2 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 <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 void NotifyProxyFallback(const ProxyServer& bad_proxy, 71 void NotifyProxyFallback(const ProxyServer& bad_proxy,
72 int net_error); 72 int net_error);
73 int NotifyBeforeSendHeaders(URLRequest* request, 73 int NotifyBeforeSendHeaders(URLRequest* request,
74 const CompletionCallback& callback, 74 const CompletionCallback& callback,
75 HttpRequestHeaders* headers); 75 HttpRequestHeaders* headers);
76 void NotifyBeforeSendProxyHeaders(URLRequest* request, 76 void NotifyBeforeSendProxyHeaders(URLRequest* request,
77 const ProxyInfo& proxy_info, 77 const ProxyInfo& proxy_info,
78 HttpRequestHeaders* headers); 78 HttpRequestHeaders* headers);
79 void NotifySendHeaders(URLRequest* request, 79 void NotifySendHeaders(URLRequest* request,
80 const HttpRequestHeaders& headers); 80 const HttpRequestHeaders& headers);
81 void NotifyNetworkBytesSent(const URLRequest& request, int64_t bytes_sent);
mmenke 2015/09/24 21:30:24 While I see you put this roughly in the order it's
sclittle 2015/09/24 22:20:42 Done.
81 int NotifyHeadersReceived( 82 int NotifyHeadersReceived(
82 URLRequest* request, 83 URLRequest* request,
83 const CompletionCallback& callback, 84 const CompletionCallback& callback,
84 const HttpResponseHeaders* original_response_headers, 85 const HttpResponseHeaders* original_response_headers,
85 scoped_refptr<HttpResponseHeaders>* override_response_headers, 86 scoped_refptr<HttpResponseHeaders>* override_response_headers,
86 GURL* allowed_unsafe_redirect_url); 87 GURL* allowed_unsafe_redirect_url);
87 void NotifyBeforeRedirect(URLRequest* request, 88 void NotifyBeforeRedirect(URLRequest* request,
88 const GURL& new_location); 89 const GURL& new_location);
89 void NotifyResponseStarted(URLRequest* request); 90 void NotifyResponseStarted(URLRequest* request);
90 void NotifyNetworkBytesReceived(const URLRequest& request, 91 void NotifyNetworkBytesReceived(const URLRequest& request,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 virtual void OnBeforeSendProxyHeaders(URLRequest* request, 167 virtual void OnBeforeSendProxyHeaders(URLRequest* request,
167 const ProxyInfo& proxy_info, 168 const ProxyInfo& proxy_info,
168 HttpRequestHeaders* headers) = 0; 169 HttpRequestHeaders* headers) = 0;
169 170
170 // Called right before the HTTP request(s) are being sent to the network. 171 // Called right before the HTTP request(s) are being sent to the network.
171 // |headers| is only valid until OnCompleted or OnURLRequestDestroyed is 172 // |headers| is only valid until OnCompleted or OnURLRequestDestroyed is
172 // called for this request. 173 // called for this request.
173 virtual void OnSendHeaders(URLRequest* request, 174 virtual void OnSendHeaders(URLRequest* request,
174 const HttpRequestHeaders& headers) = 0; 175 const HttpRequestHeaders& headers) = 0;
175 176
177 // Called when bytes are sent over the network, such as when sending request
178 // headers or uploading request body bytes. This includes localhost requests.
179 // |bytes_sent| is the number of bytes measured at the application layer that
180 // have been sent over the network for this request since the last time
181 // OnNetworkBytesSent was called. |bytes_sent| will always be greater than 0.
182 // Currently, this is only implemented for HTTP transactions, and |bytes_sent|
183 // does not include TLS overhead or TCP retransmits.
184 virtual void OnNetworkBytesSent(const URLRequest& request,
185 int64_t bytes_sent) = 0;
186
176 // Called for HTTP requests when the headers have been received. 187 // Called for HTTP requests when the headers have been received.
177 // |original_response_headers| contains the headers as received over the 188 // |original_response_headers| contains the headers as received over the
178 // network, these must not be modified. |override_response_headers| can be set 189 // network, these must not be modified. |override_response_headers| can be set
179 // to new values, that should be considered as overriding 190 // to new values, that should be considered as overriding
180 // |original_response_headers|. 191 // |original_response_headers|.
181 // If the response is a redirect, and the Location response header value is 192 // If the response is a redirect, and the Location response header value is
182 // identical to |allowed_unsafe_redirect_url|, then the redirect is never 193 // identical to |allowed_unsafe_redirect_url|, then the redirect is never
183 // blocked and the reference fragment is not copied from the original URL 194 // blocked and the reference fragment is not copied from the original URL
184 // to the redirection target. 195 // to the redirection target.
185 // 196 //
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 // header is stripped from the request. 308 // header is stripped from the request.
298 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( 309 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
299 const URLRequest& request, 310 const URLRequest& request,
300 const GURL& target_url, 311 const GURL& target_url,
301 const GURL& referrer_url) const = 0; 312 const GURL& referrer_url) const = 0;
302 }; 313 };
303 314
304 } // namespace net 315 } // namespace net
305 316
306 #endif // NET_BASE_NETWORK_DELEGATE_H_ 317 #endif // NET_BASE_NETWORK_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698