Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_BASE_PROXY_DELEGATE_H_ | |
| 6 #define NET_BASE_PROXY_DELEGATE_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "net/base/net_export.h" | |
| 10 | |
| 11 class GURL; | |
| 12 | |
| 13 namespace net { | |
| 14 | |
| 15 class HttpRequestHeaders; | |
| 16 class HttpResponseHeaders; | |
| 17 class HostPortPair; | |
| 18 class ProxyInfo; | |
| 19 class ProxyServer; | |
| 20 class ProxyService; | |
| 21 class URLRequest; | |
| 22 | |
| 23 // Delegate for setting up a connection. | |
| 24 class NET_EXPORT ProxyDelegate { | |
| 25 public: | |
| 26 | |
|
mef
2014/09/10 15:05:25
nit: no need for empty line.
bengr
2014/09/10 19:18:59
Done.
| |
| 27 ProxyDelegate() { | |
| 28 } | |
| 29 | |
| 30 virtual ~ProxyDelegate() { | |
| 31 } | |
| 32 | |
| 33 // Called as the proxy is being resolved for |url|. Allows the delegate to | |
| 34 // override the proxy resolution decision made by ProxyService. The delegate | |
| 35 // may override the decision by modifying the ProxyInfo |result|. | |
| 36 virtual void OnResolveProxy(const GURL& url, | |
| 37 int load_flags, | |
| 38 const ProxyService& proxy_service, | |
| 39 ProxyInfo* result) = 0; | |
| 40 | |
| 41 // Called when use of |bad_proxy| fails due to |net_error|. |net_error| is | |
| 42 // the network error encountered, if any, and OK if the fallback was | |
| 43 // for a reason other than a network error (e.g. the proxy service was | |
| 44 // explicitly directed to skip a proxy). | |
| 45 virtual void OnFallback(const ProxyServer& bad_proxy, | |
| 46 int net_error) = 0; | |
| 47 | |
| 48 // Called after a proxy connection. Allows the delegate to read/write | |
| 49 // |headers| before they get sent out. |headers| is valid only until | |
| 50 // OnCompleted or OnURLRequestDestroyed is called for this request. | |
| 51 virtual void OnBeforeSendHeaders(URLRequest* request, | |
| 52 const ProxyInfo& proxy_info, | |
| 53 HttpRequestHeaders* headers) = 0; | |
| 54 | |
| 55 // Called immediately before a proxy tunnel request is sent. | |
| 56 // Provides the embedder an opportunity to add extra request headers. | |
| 57 virtual void OnBeforeTunnelRequest(const HostPortPair& proxy_server, | |
| 58 HttpRequestHeaders* extra_headers) = 0; | |
| 59 | |
| 60 // Called after the response headers for the tunnel request are received. | |
| 61 virtual void OnTunnelHeadersReceived( | |
| 62 const HostPortPair& origin, | |
| 63 const HostPortPair& proxy_server, | |
| 64 const HttpResponseHeaders& response_headers) = 0; | |
| 65 | |
| 66 private: | |
| 67 DISALLOW_COPY_AND_ASSIGN(ProxyDelegate); | |
| 68 }; | |
| 69 | |
| 70 } | |
| 71 | |
| 72 #endif // NET_BASE_PROXY_DELEGATE_H_ | |
| OLD | NEW |