| 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 ProxyDelegate() { | |
| 27 } | |
| 28 | |
| 29 virtual ~ProxyDelegate() { | |
| 30 } | |
| 31 | |
| 32 // Called as the proxy is being resolved for |url|. Allows the delegate to | |
| 33 // override the proxy resolution decision made by ProxyService. The delegate | |
| 34 // may override the decision by modifying the ProxyInfo |result|. | |
| 35 virtual void OnResolveProxy(const GURL& url, | |
| 36 int load_flags, | |
| 37 const ProxyService& proxy_service, | |
| 38 ProxyInfo* result) = 0; | |
| 39 | |
| 40 // 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 | |
| 42 // for a reason other than a network error (e.g. the proxy service was | |
| 43 // explicitly directed to skip a proxy). | |
| 44 virtual void OnFallback(const ProxyServer& bad_proxy, | |
| 45 int net_error) = 0; | |
| 46 | |
| 47 // Called after a proxy connection. Allows the delegate to read/write | |
| 48 // |headers| before they get sent out. |headers| is valid only until | |
| 49 // OnCompleted or OnURLRequestDestroyed is called for this request. | |
| 50 virtual void OnBeforeSendHeaders(URLRequest* request, | |
| 51 const ProxyInfo& proxy_info, | |
| 52 HttpRequestHeaders* headers) = 0; | |
| 53 | |
| 54 // Called immediately before a proxy tunnel request is sent. | |
| 55 // Provides the embedder an opportunity to add extra request headers. | |
| 56 virtual void OnBeforeTunnelRequest(const HostPortPair& proxy_server, | |
| 57 HttpRequestHeaders* extra_headers) = 0; | |
| 58 | |
| 59 // Called when the connect attempt to a CONNECT proxy has completed. | |
| 60 virtual void OnTunnelConnectCompleted(const HostPortPair& endpoint, | |
| 61 const HostPortPair& proxy_server, | |
| 62 int net_error) = 0; | |
| 63 | |
| 64 // Called after the response headers for the tunnel request are received. | |
| 65 virtual void OnTunnelHeadersReceived( | |
| 66 const HostPortPair& origin, | |
| 67 const HostPortPair& proxy_server, | |
| 68 const HttpResponseHeaders& response_headers) = 0; | |
| 69 | |
| 70 private: | |
| 71 DISALLOW_COPY_AND_ASSIGN(ProxyDelegate); | |
| 72 }; | |
| 73 | |
| 74 } | |
| 75 | |
| 76 #endif // NET_BASE_PROXY_DELEGATE_H_ | |
| OLD | NEW |