OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H_ | 5 #ifndef NET_BASE_NETWORK_DELEGATE_H_ |
6 #define NET_BASE_NETWORK_DELEGATE_H_ | 6 #define NET_BASE_NETWORK_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 virtual ~NetworkDelegate() {} | 55 virtual ~NetworkDelegate() {} |
56 | 56 |
57 // Notification interface called by the network stack. Note that these | 57 // Notification interface called by the network stack. Note that these |
58 // functions mostly forward to the private virtuals. They also add some sanity | 58 // functions mostly forward to the private virtuals. They also add some sanity |
59 // checking on parameters. See the corresponding virtuals for explanations of | 59 // checking on parameters. See the corresponding virtuals for explanations of |
60 // the methods and their arguments. | 60 // the methods and their arguments. |
61 int NotifyBeforeURLRequest(URLRequest* request, | 61 int NotifyBeforeURLRequest(URLRequest* request, |
62 const CompletionCallback& callback, | 62 const CompletionCallback& callback, |
63 GURL* new_url); | 63 GURL* new_url); |
| 64 void NotifyResolveProxy(const GURL& url, int load_flags, |
| 65 ProxyInfo* result); |
64 int NotifyBeforeSendHeaders(URLRequest* request, | 66 int NotifyBeforeSendHeaders(URLRequest* request, |
65 const CompletionCallback& callback, | 67 const CompletionCallback& callback, |
66 HttpRequestHeaders* headers); | 68 HttpRequestHeaders* headers); |
67 void NotifyBeforeSendProxyHeaders(URLRequest* request, | 69 void NotifyBeforeSendProxyHeaders(URLRequest* request, |
68 const ProxyInfo& proxy_info, | 70 const ProxyInfo& proxy_info, |
69 HttpRequestHeaders* headers); | 71 HttpRequestHeaders* headers); |
70 void NotifySendHeaders(URLRequest* request, | 72 void NotifySendHeaders(URLRequest* request, |
71 const HttpRequestHeaders& headers); | 73 const HttpRequestHeaders& headers); |
72 int NotifyHeadersReceived( | 74 int NotifyHeadersReceived( |
73 URLRequest* request, | 75 URLRequest* request, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // called for this request. Returns a net status code, generally either OK to | 116 // called for this request. Returns a net status code, generally either OK to |
115 // continue with the request or ERR_IO_PENDING if the result is not ready yet. | 117 // continue with the request or ERR_IO_PENDING if the result is not ready yet. |
116 // A status code other than OK and ERR_IO_PENDING will cancel the request and | 118 // A status code other than OK and ERR_IO_PENDING will cancel the request and |
117 // report the status code as the reason. | 119 // report the status code as the reason. |
118 // | 120 // |
119 // The default implementation returns OK (continue with request). | 121 // The default implementation returns OK (continue with request). |
120 virtual int OnBeforeURLRequest(URLRequest* request, | 122 virtual int OnBeforeURLRequest(URLRequest* request, |
121 const CompletionCallback& callback, | 123 const CompletionCallback& callback, |
122 GURL* new_url); | 124 GURL* new_url); |
123 | 125 |
| 126 // Called as the proxy is being resolved for |url|. Allows the delegate to |
| 127 // override the proxy resolution decision made by ProxyService. The delegate |
| 128 // may override the decision by modifying the ProxyInfo |result|. |
| 129 virtual void OnResolveProxy(const GURL& url, |
| 130 int load_flags, |
| 131 ProxyInfo* result); |
| 132 |
124 // Called right before the HTTP headers are sent. Allows the delegate to | 133 // Called right before the HTTP headers are sent. Allows the delegate to |
125 // read/write |headers| before they get sent out. |callback| and |headers| are | 134 // read/write |headers| before they get sent out. |callback| and |headers| are |
126 // valid only until OnCompleted or OnURLRequestDestroyed is called for this | 135 // valid only until OnCompleted or OnURLRequestDestroyed is called for this |
127 // request. | 136 // request. |
128 // See OnBeforeURLRequest for return value description. Returns OK by default. | 137 // See OnBeforeURLRequest for return value description. Returns OK by default. |
129 virtual int OnBeforeSendHeaders(URLRequest* request, | 138 virtual int OnBeforeSendHeaders(URLRequest* request, |
130 const CompletionCallback& callback, | 139 const CompletionCallback& callback, |
131 HttpRequestHeaders* headers); | 140 HttpRequestHeaders* headers); |
132 | 141 |
133 // Called after a proxy connection. Allows the delegate to read/write | 142 // Called after a proxy connection. Allows the delegate to read/write |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 254 |
246 // Called before a SocketStream tries to connect. | 255 // Called before a SocketStream tries to connect. |
247 // See OnBeforeURLRequest for return value description. Returns OK by default. | 256 // See OnBeforeURLRequest for return value description. Returns OK by default. |
248 virtual int OnBeforeSocketStreamConnect( | 257 virtual int OnBeforeSocketStreamConnect( |
249 SocketStream* socket, const CompletionCallback& callback); | 258 SocketStream* socket, const CompletionCallback& callback); |
250 }; | 259 }; |
251 | 260 |
252 } // namespace net | 261 } // namespace net |
253 | 262 |
254 #endif // NET_BASE_NETWORK_DELEGATE_H_ | 263 #endif // NET_BASE_NETWORK_DELEGATE_H_ |
OLD | NEW |