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

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

Issue 2262653003: Make URLRequest::Read to return net errors or bytes read instead of a bool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_IMPL_H_ 5 #ifndef NET_BASE_NETWORK_DELEGATE_IMPL_H_
6 #define NET_BASE_NETWORK_DELEGATE_IMPL_H_ 6 #define NET_BASE_NETWORK_DELEGATE_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 const HttpResponseHeaders* original_response_headers, 97 const HttpResponseHeaders* original_response_headers,
98 scoped_refptr<HttpResponseHeaders>* override_response_headers, 98 scoped_refptr<HttpResponseHeaders>* override_response_headers,
99 GURL* allowed_unsafe_redirect_url) override; 99 GURL* allowed_unsafe_redirect_url) override;
100 100
101 // Called right after a redirect response code was received. 101 // Called right after a redirect response code was received.
102 // |new_location| is only valid until OnURLRequestDestroyed is called for this 102 // |new_location| is only valid until OnURLRequestDestroyed is called for this
103 // request. 103 // request.
104 void OnBeforeRedirect(URLRequest* request, const GURL& new_location) override; 104 void OnBeforeRedirect(URLRequest* request, const GURL& new_location) override;
105 105
106 // This corresponds to URLRequestDelegate::OnResponseStarted. 106 // This corresponds to URLRequestDelegate::OnResponseStarted.
107 void OnResponseStarted(URLRequest* request, int net_error) override;
108 // Deprecated.
109 // TODO(maksims): Remove this;
107 void OnResponseStarted(URLRequest* request) override; 110 void OnResponseStarted(URLRequest* request) override;
108 111
109 // Called when bytes are received from the network, such as after receiving 112 // Called when bytes are received from the network, such as after receiving
110 // headers or reading raw response bytes. This includes localhost requests. 113 // headers or reading raw response bytes. This includes localhost requests.
111 // |bytes_received| is the number of bytes measured at the application layer 114 // |bytes_received| is the number of bytes measured at the application layer
112 // that have been received over the network for this request since the last 115 // that have been received over the network for this request since the last
113 // time OnNetworkBytesReceived was called. |bytes_received| will always be 116 // time OnNetworkBytesReceived was called. |bytes_received| will always be
114 // greater than 0. 117 // greater than 0.
115 // Currently, this is only implemented for HTTP transactions, and 118 // Currently, this is only implemented for HTTP transactions, and
116 // |bytes_received| does not include TLS overhead or TCP retransmits. 119 // |bytes_received| does not include TLS overhead or TCP retransmits.
117 void OnNetworkBytesReceived(URLRequest* request, 120 void OnNetworkBytesReceived(URLRequest* request,
118 int64_t bytes_received) override; 121 int64_t bytes_received) override;
119 122
120 // Called when bytes are sent over the network, such as when sending request 123 // Called when bytes are sent over the network, such as when sending request
121 // headers or uploading request body bytes. This includes localhost requests. 124 // headers or uploading request body bytes. This includes localhost requests.
122 // |bytes_sent| is the number of bytes measured at the application layer that 125 // |bytes_sent| is the number of bytes measured at the application layer that
123 // have been sent over the network for this request since the last time 126 // have been sent over the network for this request since the last time
124 // OnNetworkBytesSent was called. |bytes_sent| will always be greater than 0. 127 // OnNetworkBytesSent was called. |bytes_sent| will always be greater than 0.
125 // Currently, this is only implemented for HTTP transactions, and |bytes_sent| 128 // Currently, this is only implemented for HTTP transactions, and |bytes_sent|
126 // does not include TLS overhead or TCP retransmits. 129 // does not include TLS overhead or TCP retransmits.
127 void OnNetworkBytesSent(URLRequest* request, int64_t bytes_sent) override; 130 void OnNetworkBytesSent(URLRequest* request, int64_t bytes_sent) override;
128 131
129 // Indicates that the URL request has been completed or failed. 132 // Indicates that the URL request has been completed or failed.
130 // |started| indicates whether the request has been started. If false, 133 // |started| indicates whether the request has been started. If false,
131 // some information like the socket address is not available. 134 // some information like the socket address is not available.
135 void OnCompleted(URLRequest* request, bool started, int net_error) override;
136 // Deprecated.
137 // TODO(maksims): Remove this;
132 void OnCompleted(URLRequest* request, bool started) override; 138 void OnCompleted(URLRequest* request, bool started) override;
133 139
134 // Called when an URLRequest is being destroyed. Note that the request is 140 // Called when an URLRequest is being destroyed. Note that the request is
135 // being deleted, so it's not safe to call any methods that may result in 141 // being deleted, so it's not safe to call any methods that may result in
136 // a virtual method call. 142 // a virtual method call.
137 void OnURLRequestDestroyed(URLRequest* request) override; 143 void OnURLRequestDestroyed(URLRequest* request) override;
138 144
139 // Corresponds to ProxyResolverJSBindings::OnError. 145 // Corresponds to ProxyResolverJSBindings::OnError.
140 void OnPACScriptError(int line_number, const base::string16& error) override; 146 void OnPACScriptError(int line_number, const base::string16& error) override;
141 147
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // header is stripped from the request. 207 // header is stripped from the request.
202 bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( 208 bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
203 const URLRequest& request, 209 const URLRequest& request,
204 const GURL& target_url, 210 const GURL& target_url,
205 const GURL& referrer_url) const override; 211 const GURL& referrer_url) const override;
206 }; 212 };
207 213
208 } // namespace net 214 } // namespace net
209 215
210 #endif // NET_BASE_NETWORK_DELEGATE_IMPL_H_ 216 #endif // NET_BASE_NETWORK_DELEGATE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698