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

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

Issue 1735203002: Revert of Moving proxy resolution logic out of NetworkDelegate and into ProxyDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 20 matching lines...) Expand all
31 // submodule. Also, since the lower levels in net/ may callback into higher 31 // submodule. Also, since the lower levels in net/ may callback into higher
32 // levels, we may encounter dangerous casting issues. 32 // levels, we may encounter dangerous casting issues.
33 // 33 //
34 // NOTE: It is not okay to add any compile-time dependencies on symbols outside 34 // NOTE: It is not okay to add any compile-time dependencies on symbols outside
35 // of net/base here, because we have a net_base library. Forward declarations 35 // of net/base here, because we have a net_base library. Forward declarations
36 // are ok. 36 // are ok.
37 class CookieOptions; 37 class CookieOptions;
38 class HttpRequestHeaders; 38 class HttpRequestHeaders;
39 class HttpResponseHeaders; 39 class HttpResponseHeaders;
40 class ProxyInfo; 40 class ProxyInfo;
41 class ProxyServer;
42 class ProxyService;
41 class URLRequest; 43 class URLRequest;
42 44
43 class NET_EXPORT NetworkDelegate : public base::NonThreadSafe { 45 class NET_EXPORT NetworkDelegate : public base::NonThreadSafe {
44 public: 46 public:
45 // AuthRequiredResponse indicates how a NetworkDelegate handles an 47 // AuthRequiredResponse indicates how a NetworkDelegate handles an
46 // OnAuthRequired call. It's placed in this file to prevent url_request.h 48 // OnAuthRequired call. It's placed in this file to prevent url_request.h
47 // from having to include network_delegate.h. 49 // from having to include network_delegate.h.
48 enum AuthRequiredResponse { 50 enum AuthRequiredResponse {
49 AUTH_REQUIRED_RESPONSE_NO_ACTION, 51 AUTH_REQUIRED_RESPONSE_NO_ACTION,
50 AUTH_REQUIRED_RESPONSE_SET_AUTH, 52 AUTH_REQUIRED_RESPONSE_SET_AUTH,
51 AUTH_REQUIRED_RESPONSE_CANCEL_AUTH, 53 AUTH_REQUIRED_RESPONSE_CANCEL_AUTH,
52 AUTH_REQUIRED_RESPONSE_IO_PENDING, 54 AUTH_REQUIRED_RESPONSE_IO_PENDING,
53 }; 55 };
54 typedef base::Callback<void(AuthRequiredResponse)> AuthCallback; 56 typedef base::Callback<void(AuthRequiredResponse)> AuthCallback;
55 57
56 virtual ~NetworkDelegate() {} 58 virtual ~NetworkDelegate() {}
57 59
58 // Notification interface called by the network stack. Note that these 60 // Notification interface called by the network stack. Note that these
59 // functions mostly forward to the private virtuals. They also add some sanity 61 // functions mostly forward to the private virtuals. They also add some sanity
60 // checking on parameters. See the corresponding virtuals for explanations of 62 // checking on parameters. See the corresponding virtuals for explanations of
61 // the methods and their arguments. 63 // the methods and their arguments.
62 int NotifyBeforeURLRequest(URLRequest* request, 64 int NotifyBeforeURLRequest(URLRequest* request,
63 const CompletionCallback& callback, 65 const CompletionCallback& callback,
64 GURL* new_url); 66 GURL* new_url);
67 void NotifyResolveProxy(const GURL& url,
68 int load_flags,
69 const ProxyService& proxy_service,
70 ProxyInfo* result);
71 void NotifyProxyFallback(const ProxyServer& bad_proxy,
72 int net_error);
65 int NotifyBeforeSendHeaders(URLRequest* request, 73 int NotifyBeforeSendHeaders(URLRequest* request,
66 const CompletionCallback& callback, 74 const CompletionCallback& callback,
67 HttpRequestHeaders* headers); 75 HttpRequestHeaders* headers);
68 void NotifyBeforeSendProxyHeaders(URLRequest* request, 76 void NotifyBeforeSendProxyHeaders(URLRequest* request,
69 const ProxyInfo& proxy_info, 77 const ProxyInfo& proxy_info,
70 HttpRequestHeaders* headers); 78 HttpRequestHeaders* headers);
71 void NotifySendHeaders(URLRequest* request, 79 void NotifySendHeaders(URLRequest* request,
72 const HttpRequestHeaders& headers); 80 const HttpRequestHeaders& headers);
73 int NotifyHeadersReceived( 81 int NotifyHeadersReceived(
74 URLRequest* request, 82 URLRequest* request,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // called for this request. Returns a net status code, generally either OK to 133 // called for this request. Returns a net status code, generally either OK to
126 // continue with the request or ERR_IO_PENDING if the result is not ready yet. 134 // continue with the request or ERR_IO_PENDING if the result is not ready yet.
127 // A status code other than OK and ERR_IO_PENDING will cancel the request and 135 // A status code other than OK and ERR_IO_PENDING will cancel the request and
128 // report the status code as the reason. 136 // report the status code as the reason.
129 // 137 //
130 // The default implementation returns OK (continue with request). 138 // The default implementation returns OK (continue with request).
131 virtual int OnBeforeURLRequest(URLRequest* request, 139 virtual int OnBeforeURLRequest(URLRequest* request,
132 const CompletionCallback& callback, 140 const CompletionCallback& callback,
133 GURL* new_url) = 0; 141 GURL* new_url) = 0;
134 142
143 // Called as the proxy is being resolved for |url|. Allows the delegate to
144 // override the proxy resolution decision made by ProxyService. The delegate
145 // may override the decision by modifying the ProxyInfo |result|.
146 virtual void OnResolveProxy(const GURL& url,
147 int load_flags,
148 const ProxyService& proxy_service,
149 ProxyInfo* result) = 0;
150
151 // Called when use of |bad_proxy| fails due to |net_error|. |net_error| is
152 // the network error encountered, if any, and OK if the fallback was
153 // for a reason other than a network error (e.g. the proxy service was
154 // explicitly directed to skip a proxy).
155 virtual void OnProxyFallback(const ProxyServer& bad_proxy, int net_error) = 0;
156
135 // Called right before the HTTP headers are sent. Allows the delegate to 157 // Called right before the HTTP headers are sent. Allows the delegate to
136 // read/write |headers| before they get sent out. |callback| and |headers| are 158 // read/write |headers| before they get sent out. |callback| and |headers| are
137 // valid only until OnCompleted or OnURLRequestDestroyed is called for this 159 // valid only until OnCompleted or OnURLRequestDestroyed is called for this
138 // request. 160 // request.
139 // See OnBeforeURLRequest for return value description. Returns OK by default. 161 // See OnBeforeURLRequest for return value description. Returns OK by default.
140 virtual int OnBeforeSendHeaders(URLRequest* request, 162 virtual int OnBeforeSendHeaders(URLRequest* request,
141 const CompletionCallback& callback, 163 const CompletionCallback& callback,
142 HttpRequestHeaders* headers) = 0; 164 HttpRequestHeaders* headers) = 0;
143 165
144 // Called after a proxy connection. Allows the delegate to read/write 166 // Called after a proxy connection. Allows the delegate to read/write
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 // header is stripped from the request. 310 // header is stripped from the request.
289 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( 311 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
290 const URLRequest& request, 312 const URLRequest& request,
291 const GURL& target_url, 313 const GURL& target_url,
292 const GURL& referrer_url) const = 0; 314 const GURL& referrer_url) const = 0;
293 }; 315 };
294 316
295 } // namespace net 317 } // namespace net
296 318
297 #endif // NET_BASE_NETWORK_DELEGATE_H_ 319 #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