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