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

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: more fixes 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.
107 void OnResponseStarted(URLRequest* request) override; 109 void OnResponseStarted(URLRequest* request) override;
108 110
109 // Called when bytes are received from the network, such as after receiving 111 // Called when bytes are received from the network, such as after receiving
110 // headers or reading raw response bytes. This includes localhost requests. 112 // headers or reading raw response bytes. This includes localhost requests.
111 // |bytes_received| is the number of bytes measured at the application layer 113 // |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 114 // that have been received over the network for this request since the last
113 // time OnNetworkBytesReceived was called. |bytes_received| will always be 115 // time OnNetworkBytesReceived was called. |bytes_received| will always be
114 // greater than 0. 116 // greater than 0.
115 // Currently, this is only implemented for HTTP transactions, and 117 // Currently, this is only implemented for HTTP transactions, and
116 // |bytes_received| does not include TLS overhead or TCP retransmits. 118 // |bytes_received| does not include TLS overhead or TCP retransmits.
117 void OnNetworkBytesReceived(URLRequest* request, 119 void OnNetworkBytesReceived(URLRequest* request,
118 int64_t bytes_received) override; 120 int64_t bytes_received) override;
119 121
120 // Called when bytes are sent over the network, such as when sending request 122 // Called when bytes are sent over the network, such as when sending request
121 // headers or uploading request body bytes. This includes localhost requests. 123 // headers or uploading request body bytes. This includes localhost requests.
122 // |bytes_sent| is the number of bytes measured at the application layer that 124 // |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 125 // 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. 126 // OnNetworkBytesSent was called. |bytes_sent| will always be greater than 0.
125 // Currently, this is only implemented for HTTP transactions, and |bytes_sent| 127 // Currently, this is only implemented for HTTP transactions, and |bytes_sent|
126 // does not include TLS overhead or TCP retransmits. 128 // does not include TLS overhead or TCP retransmits.
127 void OnNetworkBytesSent(URLRequest* request, int64_t bytes_sent) override; 129 void OnNetworkBytesSent(URLRequest* request, int64_t bytes_sent) override;
128 130
129 // Indicates that the URL request has been completed or failed. 131 // Indicates that the URL request has been completed or failed.
130 // |started| indicates whether the request has been started. If false, 132 // |started| indicates whether the request has been started. If false,
131 // some information like the socket address is not available. 133 // some information like the socket address is not available.
134 void OnCompleted(URLRequest* request, bool started, int net_error) override;
135 // Deprecated.
132 void OnCompleted(URLRequest* request, bool started) override; 136 void OnCompleted(URLRequest* request, bool started) override;
133 137
134 // Called when an URLRequest is being destroyed. Note that the request is 138 // 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 139 // being deleted, so it's not safe to call any methods that may result in
136 // a virtual method call. 140 // a virtual method call.
137 void OnURLRequestDestroyed(URLRequest* request) override; 141 void OnURLRequestDestroyed(URLRequest* request) override;
138 142
139 // Corresponds to ProxyResolverJSBindings::OnError. 143 // Corresponds to ProxyResolverJSBindings::OnError.
140 void OnPACScriptError(int line_number, const base::string16& error) override; 144 void OnPACScriptError(int line_number, const base::string16& error) override;
141 145
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // header is stripped from the request. 205 // header is stripped from the request.
202 bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( 206 bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
203 const URLRequest& request, 207 const URLRequest& request,
204 const GURL& target_url, 208 const GURL& target_url,
205 const GURL& referrer_url) const override; 209 const GURL& referrer_url) const override;
206 }; 210 };
207 211
208 } // namespace net 212 } // namespace net
209 213
210 #endif // NET_BASE_NETWORK_DELEGATE_IMPL_H_ 214 #endif // NET_BASE_NETWORK_DELEGATE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698