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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 | 57 |
58 // Notification interface called by the network stack. Note that these | 58 // Notification interface called by the network stack. Note that these |
59 // functions mostly forward to the private virtuals. They also add some sanity | 59 // functions mostly forward to the private virtuals. They also add some sanity |
60 // checking on parameters. See the corresponding virtuals for explanations of | 60 // checking on parameters. See the corresponding virtuals for explanations of |
61 // the methods and their arguments. | 61 // the methods and their arguments. |
62 int NotifyBeforeURLRequest(URLRequest* request, | 62 int NotifyBeforeURLRequest(URLRequest* request, |
63 const CompletionCallback& callback, | 63 const CompletionCallback& callback, |
64 GURL* new_url); | 64 GURL* new_url); |
65 void NotifyResolveProxy(const GURL& url, int load_flags, | 65 void NotifyResolveProxy(const GURL& url, int load_flags, |
66 ProxyInfo* result); | 66 ProxyInfo* result); |
67 void NotifyProxyFallback(const ProxyServer& bad_proxy, | 67 virtual void NotifyProxyFallback(const ProxyServer& bad_proxy, |
bengr
2014/08/14 00:52:52
This should not be virtual.
Not at Google. Contact bengr
2014/08/14 01:28:32
Done
| |
68 int net_error, | 68 int net_error); |
69 bool did_fallback); | |
70 int NotifyBeforeSendHeaders(URLRequest* request, | 69 int NotifyBeforeSendHeaders(URLRequest* request, |
71 const CompletionCallback& callback, | 70 const CompletionCallback& callback, |
72 HttpRequestHeaders* headers); | 71 HttpRequestHeaders* headers); |
73 void NotifyBeforeSendProxyHeaders(URLRequest* request, | 72 void NotifyBeforeSendProxyHeaders(URLRequest* request, |
74 const ProxyInfo& proxy_info, | 73 const ProxyInfo& proxy_info, |
75 HttpRequestHeaders* headers); | 74 HttpRequestHeaders* headers); |
76 void NotifySendHeaders(URLRequest* request, | 75 void NotifySendHeaders(URLRequest* request, |
77 const HttpRequestHeaders& headers); | 76 const HttpRequestHeaders& headers); |
78 int NotifyHeadersReceived( | 77 int NotifyHeadersReceived( |
79 URLRequest* request, | 78 URLRequest* request, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 const CompletionCallback& callback, | 126 const CompletionCallback& callback, |
128 GURL* new_url); | 127 GURL* new_url); |
129 | 128 |
130 // Called as the proxy is being resolved for |url|. Allows the delegate to | 129 // Called as the proxy is being resolved for |url|. Allows the delegate to |
131 // override the proxy resolution decision made by ProxyService. The delegate | 130 // override the proxy resolution decision made by ProxyService. The delegate |
132 // may override the decision by modifying the ProxyInfo |result|. | 131 // may override the decision by modifying the ProxyInfo |result|. |
133 virtual void OnResolveProxy(const GURL& url, | 132 virtual void OnResolveProxy(const GURL& url, |
134 int load_flags, | 133 int load_flags, |
135 ProxyInfo* result); | 134 ProxyInfo* result); |
136 | 135 |
137 // Called when use of |bad_proxy| fails due to |net_error|. |did_fallback| is | 136 // Called when use of |bad_proxy| fails due to |net_error|. |net_error| is |
138 // true if the proxy service was able to fallback to another proxy | 137 // the network error encountered, if any. |
bengr
2014/08/14 00:52:52
Clarify that net_error == 0 indicates that the pro
Not at Google. Contact bengr
2014/08/14 01:28:32
Done.
| |
139 // configuration. | |
140 virtual void OnProxyFallback(const ProxyServer& bad_proxy, | 138 virtual void OnProxyFallback(const ProxyServer& bad_proxy, |
141 int net_error, | 139 int net_error); |
142 bool did_fallback); | |
143 | 140 |
144 // Called right before the HTTP headers are sent. Allows the delegate to | 141 // Called right before the HTTP headers are sent. Allows the delegate to |
145 // read/write |headers| before they get sent out. |callback| and |headers| are | 142 // read/write |headers| before they get sent out. |callback| and |headers| are |
146 // valid only until OnCompleted or OnURLRequestDestroyed is called for this | 143 // valid only until OnCompleted or OnURLRequestDestroyed is called for this |
147 // request. | 144 // request. |
148 // See OnBeforeURLRequest for return value description. Returns OK by default. | 145 // See OnBeforeURLRequest for return value description. Returns OK by default. |
149 virtual int OnBeforeSendHeaders(URLRequest* request, | 146 virtual int OnBeforeSendHeaders(URLRequest* request, |
150 const CompletionCallback& callback, | 147 const CompletionCallback& callback, |
151 HttpRequestHeaders* headers); | 148 HttpRequestHeaders* headers); |
152 | 149 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
265 | 262 |
266 // Called before a SocketStream tries to connect. | 263 // Called before a SocketStream tries to connect. |
267 // See OnBeforeURLRequest for return value description. Returns OK by default. | 264 // See OnBeforeURLRequest for return value description. Returns OK by default. |
268 virtual int OnBeforeSocketStreamConnect( | 265 virtual int OnBeforeSocketStreamConnect( |
269 SocketStream* socket, const CompletionCallback& callback); | 266 SocketStream* socket, const CompletionCallback& callback); |
270 }; | 267 }; |
271 | 268 |
272 } // namespace net | 269 } // namespace net |
273 | 270 |
274 #endif // NET_BASE_NETWORK_DELEGATE_H_ | 271 #endif // NET_BASE_NETWORK_DELEGATE_H_ |
OLD | NEW |