OLD | NEW |
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_PROXY_DELEGATE_H_ | 5 #ifndef NET_BASE_PROXY_DELEGATE_H_ |
6 #define NET_BASE_PROXY_DELEGATE_H_ | 6 #define NET_BASE_PROXY_DELEGATE_H_ |
7 | 7 |
| 8 #include <string> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
10 | 12 |
11 class GURL; | 13 class GURL; |
12 | 14 |
13 namespace net { | 15 namespace net { |
14 | 16 |
15 class HttpRequestHeaders; | 17 class HttpRequestHeaders; |
16 class HttpResponseHeaders; | 18 class HttpResponseHeaders; |
17 class HostPortPair; | 19 class HostPortPair; |
18 class ProxyInfo; | 20 class ProxyInfo; |
19 class ProxyServer; | 21 class ProxyServer; |
20 class ProxyService; | 22 class ProxyService; |
21 class URLRequest; | 23 class URLRequest; |
22 | 24 |
23 // Delegate for setting up a connection. | 25 // Delegate for setting up a connection. |
24 class NET_EXPORT ProxyDelegate { | 26 class NET_EXPORT ProxyDelegate { |
25 public: | 27 public: |
26 ProxyDelegate() { | 28 ProxyDelegate() { |
27 } | 29 } |
28 | 30 |
29 virtual ~ProxyDelegate() { | 31 virtual ~ProxyDelegate() { |
30 } | 32 } |
31 | 33 |
32 // Called as the proxy is being resolved for |url|. Allows the delegate to | 34 // Called as the proxy is being resolved for |url| for a |method| request. |
33 // override the proxy resolution decision made by ProxyService. The delegate | 35 // The caller may pass an empty string to get method agnostic resoulution. |
34 // may override the decision by modifying the ProxyInfo |result|. | 36 // Allows the delegate to override the proxy resolution decision made by |
| 37 // ProxyService. The delegate may override the decision by modifying the |
| 38 // ProxyInfo |result|. |
35 virtual void OnResolveProxy(const GURL& url, | 39 virtual void OnResolveProxy(const GURL& url, |
| 40 const std::string& method, |
36 int load_flags, | 41 int load_flags, |
37 const ProxyService& proxy_service, | 42 const ProxyService& proxy_service, |
38 ProxyInfo* result) = 0; | 43 ProxyInfo* result) = 0; |
39 | 44 |
40 // Called when use of |bad_proxy| fails due to |net_error|. |net_error| is | 45 // Called when use of |bad_proxy| fails due to |net_error|. |net_error| is |
41 // the network error encountered, if any, and OK if the fallback was | 46 // the network error encountered, if any, and OK if the fallback was |
42 // for a reason other than a network error (e.g. the proxy service was | 47 // for a reason other than a network error (e.g. the proxy service was |
43 // explicitly directed to skip a proxy). | 48 // explicitly directed to skip a proxy). |
44 virtual void OnFallback(const ProxyServer& bad_proxy, | 49 virtual void OnFallback(const ProxyServer& bad_proxy, |
45 int net_error) = 0; | 50 int net_error) = 0; |
(...skipping 25 matching lines...) Expand all Loading... |
71 // allowed to push cross-origin resources. | 76 // allowed to push cross-origin resources. |
72 virtual bool IsTrustedSpdyProxy(const net::ProxyServer& proxy_server) = 0; | 77 virtual bool IsTrustedSpdyProxy(const net::ProxyServer& proxy_server) = 0; |
73 | 78 |
74 private: | 79 private: |
75 DISALLOW_COPY_AND_ASSIGN(ProxyDelegate); | 80 DISALLOW_COPY_AND_ASSIGN(ProxyDelegate); |
76 }; | 81 }; |
77 | 82 |
78 } | 83 } |
79 | 84 |
80 #endif // NET_BASE_PROXY_DELEGATE_H_ | 85 #endif // NET_BASE_PROXY_DELEGATE_H_ |
OLD | NEW |