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

Side by Side Diff: net/base/network_delegate_impl.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/network_delegate.cc ('k') | net/base/network_delegate_impl.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 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"
11 #include "net/base/completion_callback.h" 11 #include "net/base/completion_callback.h"
12 #include "net/base/network_delegate.h" 12 #include "net/base/network_delegate.h"
13 #include "net/cookies/canonical_cookie.h" 13 #include "net/cookies/canonical_cookie.h"
14 14
15 class GURL; 15 class GURL;
16 16
17 namespace base { 17 namespace base {
18 class FilePath; 18 class FilePath;
19 } 19 }
20 20
21 namespace net { 21 namespace net {
22 22
23 class CookieOptions; 23 class CookieOptions;
24 class HttpRequestHeaders; 24 class HttpRequestHeaders;
25 class HttpResponseHeaders; 25 class HttpResponseHeaders;
26 class ProxyInfo; 26 class ProxyInfo;
27 class ProxyServer;
28 class ProxyService;
27 class URLRequest; 29 class URLRequest;
28 30
29 class NET_EXPORT NetworkDelegateImpl : public NetworkDelegate { 31 class NET_EXPORT NetworkDelegateImpl : public NetworkDelegate {
30 public: 32 public:
31 ~NetworkDelegateImpl() override {} 33 ~NetworkDelegateImpl() override {}
32 34
33 private: 35 private:
34 // This is the interface for subclasses of NetworkDelegate to implement. These 36 // This is the interface for subclasses of NetworkDelegate to implement. These
35 // member functions will be called by the respective public notification 37 // member functions will be called by the respective public notification
36 // member function, which will perform basic sanity checking. 38 // member function, which will perform basic sanity checking.
37 39
38 // Called before a request is sent. Allows the delegate to rewrite the URL 40 // Called before a request is sent. Allows the delegate to rewrite the URL
39 // being fetched by modifying |new_url|. If set, the URL must be valid. The 41 // being fetched by modifying |new_url|. If set, the URL must be valid. The
40 // reference fragment from the original URL is not automatically appended to 42 // reference fragment from the original URL is not automatically appended to
41 // |new_url|; callers are responsible for copying the reference fragment if 43 // |new_url|; callers are responsible for copying the reference fragment if
42 // desired. 44 // desired.
43 // |callback| and |new_url| are valid only until OnURLRequestDestroyed is 45 // |callback| and |new_url| are valid only until OnURLRequestDestroyed is
44 // called for this request. Returns a net status code, generally either OK to 46 // called for this request. Returns a net status code, generally either OK to
45 // continue with the request or ERR_IO_PENDING if the result is not ready yet. 47 // continue with the request or ERR_IO_PENDING if the result is not ready yet.
46 // A status code other than OK and ERR_IO_PENDING will cancel the request and 48 // A status code other than OK and ERR_IO_PENDING will cancel the request and
47 // report the status code as the reason. 49 // report the status code as the reason.
48 // 50 //
49 // The default implementation returns OK (continue with request). 51 // The default implementation returns OK (continue with request).
50 int OnBeforeURLRequest(URLRequest* request, 52 int OnBeforeURLRequest(URLRequest* request,
51 const CompletionCallback& callback, 53 const CompletionCallback& callback,
52 GURL* new_url) override; 54 GURL* new_url) override;
53 55
56 // Called as the proxy is being resolved for |url|. Allows the delegate to
57 // override the proxy resolution decision made by ProxyService. The delegate
58 // may override the decision by modifying the ProxyInfo |result|.
59 void OnResolveProxy(const GURL& url,
60 int load_flags,
61 const ProxyService& proxy_service,
62 ProxyInfo* result) override;
63
64 // Called when use of |bad_proxy| fails due to |net_error|. |net_error| is
65 // the network error encountered, if any, and OK if the fallback was
66 // for a reason other than a network error (e.g. the proxy service was
67 // explicitly directed to skip a proxy).
68 void OnProxyFallback(const ProxyServer& bad_proxy, int net_error) override;
69
54 // Called right before the HTTP headers are sent. Allows the delegate to 70 // Called right before the HTTP headers are sent. Allows the delegate to
55 // read/write |headers| before they get sent out. |callback| and |headers| are 71 // read/write |headers| before they get sent out. |callback| and |headers| are
56 // valid only until OnCompleted or OnURLRequestDestroyed is called for this 72 // valid only until OnCompleted or OnURLRequestDestroyed is called for this
57 // request. 73 // request.
58 // See OnBeforeURLRequest for return value description. Returns OK by default. 74 // See OnBeforeURLRequest for return value description. Returns OK by default.
59 int OnBeforeSendHeaders(URLRequest* request, 75 int OnBeforeSendHeaders(URLRequest* request,
60 const CompletionCallback& callback, 76 const CompletionCallback& callback,
61 HttpRequestHeaders* headers) override; 77 HttpRequestHeaders* headers) override;
62 78
63 // Called after a proxy connection. Allows the delegate to read/write 79 // Called after a proxy connection. Allows the delegate to read/write
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 // header is stripped from the request. 214 // header is stripped from the request.
199 bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( 215 bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
200 const URLRequest& request, 216 const URLRequest& request,
201 const GURL& target_url, 217 const GURL& target_url,
202 const GURL& referrer_url) const override; 218 const GURL& referrer_url) const override;
203 }; 219 };
204 220
205 } // namespace net 221 } // namespace net
206 222
207 #endif // NET_BASE_NETWORK_DELEGATE_IMPL_H_ 223 #endif // NET_BASE_NETWORK_DELEGATE_IMPL_H_
OLDNEW
« no previous file with comments | « net/base/network_delegate.cc ('k') | net/base/network_delegate_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698