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

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

Issue 649763002: git cl format the second third of the net/base directory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // functions mostly forward to the private virtuals. They also add some sanity 60 // functions mostly forward to the private virtuals. They also add some sanity
61 // checking on parameters. See the corresponding virtuals for explanations of 61 // checking on parameters. See the corresponding virtuals for explanations of
62 // the methods and their arguments. 62 // the methods and their arguments.
63 int NotifyBeforeURLRequest(URLRequest* request, 63 int NotifyBeforeURLRequest(URLRequest* request,
64 const CompletionCallback& callback, 64 const CompletionCallback& callback,
65 GURL* new_url); 65 GURL* new_url);
66 void NotifyResolveProxy(const GURL& url, 66 void NotifyResolveProxy(const GURL& url,
67 int load_flags, 67 int load_flags,
68 const ProxyService& proxy_service, 68 const ProxyService& proxy_service,
69 ProxyInfo* result); 69 ProxyInfo* result);
70 void NotifyProxyFallback(const ProxyServer& bad_proxy, 70 void NotifyProxyFallback(const ProxyServer& bad_proxy, int net_error);
71 int net_error);
72 int NotifyBeforeSendHeaders(URLRequest* request, 71 int NotifyBeforeSendHeaders(URLRequest* request,
73 const CompletionCallback& callback, 72 const CompletionCallback& callback,
74 HttpRequestHeaders* headers); 73 HttpRequestHeaders* headers);
75 void NotifyBeforeSendProxyHeaders(URLRequest* request, 74 void NotifyBeforeSendProxyHeaders(URLRequest* request,
76 const ProxyInfo& proxy_info, 75 const ProxyInfo& proxy_info,
77 HttpRequestHeaders* headers); 76 HttpRequestHeaders* headers);
78 void NotifySendHeaders(URLRequest* request, 77 void NotifySendHeaders(URLRequest* request,
79 const HttpRequestHeaders& headers); 78 const HttpRequestHeaders& headers);
80 int NotifyHeadersReceived( 79 int NotifyHeadersReceived(
81 URLRequest* request, 80 URLRequest* request,
82 const CompletionCallback& callback, 81 const CompletionCallback& callback,
83 const HttpResponseHeaders* original_response_headers, 82 const HttpResponseHeaders* original_response_headers,
84 scoped_refptr<HttpResponseHeaders>* override_response_headers, 83 scoped_refptr<HttpResponseHeaders>* override_response_headers,
85 GURL* allowed_unsafe_redirect_url); 84 GURL* allowed_unsafe_redirect_url);
86 void NotifyBeforeRedirect(URLRequest* request, 85 void NotifyBeforeRedirect(URLRequest* request, const GURL& new_location);
87 const GURL& new_location);
88 void NotifyResponseStarted(URLRequest* request); 86 void NotifyResponseStarted(URLRequest* request);
89 void NotifyRawBytesRead(const URLRequest& request, int bytes_read); 87 void NotifyRawBytesRead(const URLRequest& request, int bytes_read);
90 void NotifyCompleted(URLRequest* request, bool started); 88 void NotifyCompleted(URLRequest* request, bool started);
91 void NotifyURLRequestDestroyed(URLRequest* request); 89 void NotifyURLRequestDestroyed(URLRequest* request);
92 void NotifyPACScriptError(int line_number, const base::string16& error); 90 void NotifyPACScriptError(int line_number, const base::string16& error);
93 AuthRequiredResponse NotifyAuthRequired(URLRequest* request, 91 AuthRequiredResponse NotifyAuthRequired(URLRequest* request,
94 const AuthChallengeInfo& auth_info, 92 const AuthChallengeInfo& auth_info,
95 const AuthCallback& callback, 93 const AuthCallback& callback,
96 AuthCredentials* credentials); 94 AuthCredentials* credentials);
97 bool CanGetCookies(const URLRequest& request, 95 bool CanGetCookies(const URLRequest& request, const CookieList& cookie_list);
98 const CookieList& cookie_list);
99 bool CanSetCookie(const URLRequest& request, 96 bool CanSetCookie(const URLRequest& request,
100 const std::string& cookie_line, 97 const std::string& cookie_line,
101 CookieOptions* options); 98 CookieOptions* options);
102 bool CanAccessFile(const URLRequest& request, 99 bool CanAccessFile(const URLRequest& request,
103 const base::FilePath& path) const; 100 const base::FilePath& path) const;
104 bool CanThrottleRequest(const URLRequest& request) const; 101 bool CanThrottleRequest(const URLRequest& request) const;
105 bool CanEnablePrivacyMode(const GURL& url, 102 bool CanEnablePrivacyMode(const GURL& url,
106 const GURL& first_party_for_cookies) const; 103 const GURL& first_party_for_cookies) const;
107 104
108 int NotifyBeforeSocketStreamConnect(SocketStream* socket, 105 int NotifyBeforeSocketStreamConnect(SocketStream* socket,
(...skipping 30 matching lines...) Expand all
139 // may override the decision by modifying the ProxyInfo |result|. 136 // may override the decision by modifying the ProxyInfo |result|.
140 virtual void OnResolveProxy(const GURL& url, 137 virtual void OnResolveProxy(const GURL& url,
141 int load_flags, 138 int load_flags,
142 const ProxyService& proxy_service, 139 const ProxyService& proxy_service,
143 ProxyInfo* result); 140 ProxyInfo* result);
144 141
145 // Called when use of |bad_proxy| fails due to |net_error|. |net_error| is 142 // Called when use of |bad_proxy| fails due to |net_error|. |net_error| is
146 // the network error encountered, if any, and OK if the fallback was 143 // the network error encountered, if any, and OK if the fallback was
147 // for a reason other than a network error (e.g. the proxy service was 144 // for a reason other than a network error (e.g. the proxy service was
148 // explicitly directed to skip a proxy). 145 // explicitly directed to skip a proxy).
149 virtual void OnProxyFallback(const ProxyServer& bad_proxy, 146 virtual void OnProxyFallback(const ProxyServer& bad_proxy, int net_error);
150 int net_error);
151 147
152 // Called right before the HTTP headers are sent. Allows the delegate to 148 // Called right before the HTTP headers are sent. Allows the delegate to
153 // read/write |headers| before they get sent out. |callback| and |headers| are 149 // read/write |headers| before they get sent out. |callback| and |headers| are
154 // valid only until OnCompleted or OnURLRequestDestroyed is called for this 150 // valid only until OnCompleted or OnURLRequestDestroyed is called for this
155 // request. 151 // request.
156 // See OnBeforeURLRequest for return value description. Returns OK by default. 152 // See OnBeforeURLRequest for return value description. Returns OK by default.
157 virtual int OnBeforeSendHeaders(URLRequest* request, 153 virtual int OnBeforeSendHeaders(URLRequest* request,
158 const CompletionCallback& callback, 154 const CompletionCallback& callback,
159 HttpRequestHeaders* headers); 155 HttpRequestHeaders* headers);
160 156
(...skipping 26 matching lines...) Expand all
187 virtual int OnHeadersReceived( 183 virtual int OnHeadersReceived(
188 URLRequest* request, 184 URLRequest* request,
189 const CompletionCallback& callback, 185 const CompletionCallback& callback,
190 const HttpResponseHeaders* original_response_headers, 186 const HttpResponseHeaders* original_response_headers,
191 scoped_refptr<HttpResponseHeaders>* override_response_headers, 187 scoped_refptr<HttpResponseHeaders>* override_response_headers,
192 GURL* allowed_unsafe_redirect_url); 188 GURL* allowed_unsafe_redirect_url);
193 189
194 // Called right after a redirect response code was received. 190 // Called right after a redirect response code was received.
195 // |new_location| is only valid until OnURLRequestDestroyed is called for this 191 // |new_location| is only valid until OnURLRequestDestroyed is called for this
196 // request. 192 // request.
197 virtual void OnBeforeRedirect(URLRequest* request, 193 virtual void OnBeforeRedirect(URLRequest* request, const GURL& new_location);
198 const GURL& new_location);
199 194
200 // This corresponds to URLRequestDelegate::OnResponseStarted. 195 // This corresponds to URLRequestDelegate::OnResponseStarted.
201 virtual void OnResponseStarted(URLRequest* request); 196 virtual void OnResponseStarted(URLRequest* request);
202 197
203 // Called every time we read raw bytes. 198 // Called every time we read raw bytes.
204 virtual void OnRawBytesRead(const URLRequest& request, int bytes_read); 199 virtual void OnRawBytesRead(const URLRequest& request, int bytes_read);
205 200
206 // Indicates that the URL request has been completed or failed. 201 // Indicates that the URL request has been completed or failed.
207 // |started| indicates whether the request has been started. If false, 202 // |started| indicates whether the request has been started. If false,
208 // some information like the socket address is not available. 203 // some information like the socket address is not available.
209 virtual void OnCompleted(URLRequest* request, bool started); 204 virtual void OnCompleted(URLRequest* request, bool started);
210 205
211 // Called when an URLRequest is being destroyed. Note that the request is 206 // Called when an URLRequest is being destroyed. Note that the request is
212 // being deleted, so it's not safe to call any methods that may result in 207 // being deleted, so it's not safe to call any methods that may result in
213 // a virtual method call. 208 // a virtual method call.
214 virtual void OnURLRequestDestroyed(URLRequest* request); 209 virtual void OnURLRequestDestroyed(URLRequest* request);
215 210
216 // Corresponds to ProxyResolverJSBindings::OnError. 211 // Corresponds to ProxyResolverJSBindings::OnError.
217 virtual void OnPACScriptError(int line_number, 212 virtual void OnPACScriptError(int line_number, const base::string16& error);
218 const base::string16& error);
219 213
220 // Called when a request receives an authentication challenge 214 // Called when a request receives an authentication challenge
221 // specified by |auth_info|, and is unable to respond using cached 215 // specified by |auth_info|, and is unable to respond using cached
222 // credentials. |callback| and |credentials| must be non-NULL, and must 216 // credentials. |callback| and |credentials| must be non-NULL, and must
223 // be valid until OnURLRequestDestroyed is called for |request|. 217 // be valid until OnURLRequestDestroyed is called for |request|.
224 // 218 //
225 // The following return values are allowed: 219 // The following return values are allowed:
226 // - AUTH_REQUIRED_RESPONSE_NO_ACTION: |auth_info| is observed, but 220 // - AUTH_REQUIRED_RESPONSE_NO_ACTION: |auth_info| is observed, but
227 // no action is being taken on it. 221 // no action is being taken on it.
228 // - AUTH_REQUIRED_RESPONSE_SET_AUTH: |credentials| is filled in with 222 // - AUTH_REQUIRED_RESPONSE_SET_AUTH: |credentials| is filled in with
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 260
267 // Returns true if the given |url| has to be requested over connection that 261 // Returns true if the given |url| has to be requested over connection that
268 // is not tracked by the server. Usually is false, unless user privacy 262 // is not tracked by the server. Usually is false, unless user privacy
269 // settings block cookies from being get or set. 263 // settings block cookies from being get or set.
270 virtual bool OnCanEnablePrivacyMode( 264 virtual bool OnCanEnablePrivacyMode(
271 const GURL& url, 265 const GURL& url,
272 const GURL& first_party_for_cookies) const; 266 const GURL& first_party_for_cookies) const;
273 267
274 // Called before a SocketStream tries to connect. 268 // Called before a SocketStream tries to connect.
275 // See OnBeforeURLRequest for return value description. Returns OK by default. 269 // See OnBeforeURLRequest for return value description. Returns OK by default.
276 virtual int OnBeforeSocketStreamConnect( 270 virtual int OnBeforeSocketStreamConnect(SocketStream* socket,
277 SocketStream* socket, const CompletionCallback& callback); 271 const CompletionCallback& callback);
278 272
279 // Called when the |referrer_url| for requesting |target_url| during handling 273 // Called when the |referrer_url| for requesting |target_url| during handling
280 // of the |request| is does not comply with the referrer policy (e.g. a 274 // of the |request| is does not comply with the referrer policy (e.g. a
281 // secure referrer for an insecure initial target). 275 // secure referrer for an insecure initial target).
282 // Returns true if the request should be cancelled. Otherwise, the referrer 276 // Returns true if the request should be cancelled. Otherwise, the referrer
283 // header is stripped from the request. 277 // header is stripped from the request.
284 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( 278 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
285 const URLRequest& request, 279 const URLRequest& request,
286 const GURL& target_url, 280 const GURL& target_url,
287 const GURL& referrer_url) const; 281 const GURL& referrer_url) const;
288 }; 282 };
289 283
290 } // namespace net 284 } // namespace net
291 285
292 #endif // NET_BASE_NETWORK_DELEGATE_H_ 286 #endif // NET_BASE_NETWORK_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698