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

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

Issue 1680893002: Moving proxy resolution logic out of NetworkDelegate and into ProxyDelegate for DataReductionProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 10 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;
29 class URLRequest; 27 class URLRequest;
30 28
31 class NET_EXPORT NetworkDelegateImpl : public NetworkDelegate { 29 class NET_EXPORT NetworkDelegateImpl : public NetworkDelegate {
32 public: 30 public:
33 ~NetworkDelegateImpl() override {} 31 ~NetworkDelegateImpl() override {}
34 32
35 private: 33 private:
36 // This is the interface for subclasses of NetworkDelegate to implement. These 34 // This is the interface for subclasses of NetworkDelegate to implement. These
37 // member functions will be called by the respective public notification 35 // member functions will be called by the respective public notification
38 // member function, which will perform basic sanity checking. 36 // member function, which will perform basic sanity checking.
39 37
40 // Called before a request is sent. Allows the delegate to rewrite the URL 38 // Called before a request is sent. Allows the delegate to rewrite the URL
41 // being fetched by modifying |new_url|. If set, the URL must be valid. The 39 // being fetched by modifying |new_url|. If set, the URL must be valid. The
42 // reference fragment from the original URL is not automatically appended to 40 // reference fragment from the original URL is not automatically appended to
43 // |new_url|; callers are responsible for copying the reference fragment if 41 // |new_url|; callers are responsible for copying the reference fragment if
44 // desired. 42 // desired.
45 // |callback| and |new_url| are valid only until OnURLRequestDestroyed is 43 // |callback| and |new_url| are valid only until OnURLRequestDestroyed is
46 // called for this request. Returns a net status code, generally either OK to 44 // called for this request. Returns a net status code, generally either OK to
47 // continue with the request or ERR_IO_PENDING if the result is not ready yet. 45 // continue with the request or ERR_IO_PENDING if the result is not ready yet.
48 // A status code other than OK and ERR_IO_PENDING will cancel the request and 46 // A status code other than OK and ERR_IO_PENDING will cancel the request and
49 // report the status code as the reason. 47 // report the status code as the reason.
50 // 48 //
51 // The default implementation returns OK (continue with request). 49 // The default implementation returns OK (continue with request).
52 int OnBeforeURLRequest(URLRequest* request, 50 int OnBeforeURLRequest(URLRequest* request,
53 const CompletionCallback& callback, 51 const CompletionCallback& callback,
54 GURL* new_url) override; 52 GURL* new_url) override;
55 53
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
70 // Called right before the HTTP headers are sent. Allows the delegate to 54 // Called right before the HTTP headers are sent. Allows the delegate to
71 // read/write |headers| before they get sent out. |callback| and |headers| are 55 // read/write |headers| before they get sent out. |callback| and |headers| are
72 // valid only until OnCompleted or OnURLRequestDestroyed is called for this 56 // valid only until OnCompleted or OnURLRequestDestroyed is called for this
73 // request. 57 // request.
74 // See OnBeforeURLRequest for return value description. Returns OK by default. 58 // See OnBeforeURLRequest for return value description. Returns OK by default.
75 int OnBeforeSendHeaders(URLRequest* request, 59 int OnBeforeSendHeaders(URLRequest* request,
76 const CompletionCallback& callback, 60 const CompletionCallback& callback,
77 HttpRequestHeaders* headers) override; 61 HttpRequestHeaders* headers) override;
78 62
79 // Called after a proxy connection. Allows the delegate to read/write 63 // Called after a proxy connection. Allows the delegate to read/write
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // header is stripped from the request. 198 // header is stripped from the request.
215 bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( 199 bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
216 const URLRequest& request, 200 const URLRequest& request,
217 const GURL& target_url, 201 const GURL& target_url,
218 const GURL& referrer_url) const override; 202 const GURL& referrer_url) const override;
219 }; 203 };
220 204
221 } // namespace net 205 } // namespace net
222 206
223 #endif // NET_BASE_NETWORK_DELEGATE_IMPL_H_ 207 #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