OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // TODO: Insert description here. (generated by megjablon) |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | 2 |
5 #ifndef NET_BASE_NETWORK_DELEGATE_H_ | 3 #ifndef NET_BASE_WRAPPING_NETWORK_DELEGATE_H_ |
6 #define NET_BASE_NETWORK_DELEGATE_H_ | 4 #define NET_BASE_WRAPPING_NETWORK_DELEGATE_H_ |
7 | 5 |
8 #include <string> | 6 #include "base/memory/scoped_ptr.h" |
9 | |
10 #include "base/callback.h" | |
11 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
12 #include "base/threading/non_thread_safe.h" | |
13 #include "net/base/auth.h" | |
14 #include "net/base/completion_callback.h" | 8 #include "net/base/completion_callback.h" |
9 #include "net/base/network_delegate.h" | |
15 #include "net/cookies/canonical_cookie.h" | 10 #include "net/cookies/canonical_cookie.h" |
16 | 11 |
17 class GURL; | 12 class GURL; |
18 | 13 |
19 namespace base { | 14 namespace base { |
20 class FilePath; | 15 class FilePath; |
21 } | 16 } |
22 | 17 |
23 namespace net { | 18 namespace net { |
24 | 19 |
25 // NOTE: Layering violations! | |
26 // We decided to accept these violations (depending | |
27 // on other net/ submodules from net/base/), because otherwise NetworkDelegate | |
28 // would have to be broken up into too many smaller interfaces targeted to each | |
29 // submodule. Also, since the lower levels in net/ may callback into higher | |
30 // levels, we may encounter dangerous casting issues. | |
31 // | |
32 // NOTE: It is not okay to add any compile-time dependencies on symbols outside | |
33 // of net/base here, because we have a net_base library. Forward declarations | |
34 // are ok. | |
35 class CookieOptions; | 20 class CookieOptions; |
36 class HttpRequestHeaders; | 21 class HttpRequestHeaders; |
37 class HttpResponseHeaders; | 22 class HttpResponseHeaders; |
38 class ProxyInfo; | 23 class ProxyInfo; |
39 class ProxyServer; | 24 class ProxyServer; |
40 class ProxyService; | 25 class ProxyService; |
41 class SocketStream; | |
42 class URLRequest; | 26 class URLRequest; |
43 | 27 |
44 class NET_EXPORT NetworkDelegate : public base::NonThreadSafe { | 28 class NET_EXPORT WrappingNetworkDelegate : public NetworkDelegate { |
bengr
2014/11/18 19:30:56
Should this subclass NetworkDelegateImpl?
megjablon
2014/11/19 19:23:41
Acknowledged.
| |
45 public: | 29 public: |
46 // AuthRequiredResponse indicates how a NetworkDelegate handles an | 30 WrappingNetworkDelegate(scoped_ptr<NetworkDelegate> network_delegate); |
47 // OnAuthRequired call. It's placed in this file to prevent url_request.h | 31 virtual ~WrappingNetworkDelegate(); |
48 // from having to include network_delegate.h. | |
49 enum AuthRequiredResponse { | |
50 AUTH_REQUIRED_RESPONSE_NO_ACTION, | |
51 AUTH_REQUIRED_RESPONSE_SET_AUTH, | |
52 AUTH_REQUIRED_RESPONSE_CANCEL_AUTH, | |
53 AUTH_REQUIRED_RESPONSE_IO_PENDING, | |
54 }; | |
55 typedef base::Callback<void(AuthRequiredResponse)> AuthCallback; | |
56 | 32 |
57 virtual ~NetworkDelegate() {} | 33 protected: |
34 virtual void OnBeforeURLRequestInternal(URLRequest* request, | |
35 const CompletionCallback& callback, | |
36 GURL* new_url); | |
58 | 37 |
59 // Notification interface called by the network stack. Note that these | 38 virtual void OnResolveProxyInternal(const GURL& url, |
60 // functions mostly forward to the private virtuals. They also add some sanity | 39 int load_flags, |
61 // checking on parameters. See the corresponding virtuals for explanations of | 40 const ProxyService& proxy_service, |
62 // the methods and their arguments. | 41 ProxyInfo* result); |
63 int NotifyBeforeURLRequest(URLRequest* request, | 42 |
64 const CompletionCallback& callback, | 43 virtual void OnProxyFallbackInternal(const ProxyServer& bad_proxy, |
65 GURL* new_url); | 44 int net_error); |
66 void NotifyResolveProxy(const GURL& url, | 45 |
67 int load_flags, | 46 virtual void OnBeforeSendHeadersInternal(URLRequest* request, |
68 const ProxyService& proxy_service, | 47 const CompletionCallback& callback, |
69 ProxyInfo* result); | 48 HttpRequestHeaders* headers); |
70 void NotifyProxyFallback(const ProxyServer& bad_proxy, | 49 |
71 int net_error); | 50 virtual void OnSendHeadersInternal(URLRequest* request, |
72 int NotifyBeforeSendHeaders(URLRequest* request, | 51 const HttpRequestHeaders& headers); |
73 const CompletionCallback& callback, | 52 |
74 HttpRequestHeaders* headers); | 53 virtual void OnBeforeSendProxyHeadersInternal(URLRequest* request, |
75 void NotifyBeforeSendProxyHeaders(URLRequest* request, | 54 const ProxyInfo& proxy_info, |
76 const ProxyInfo& proxy_info, | 55 HttpRequestHeaders* headers); |
77 HttpRequestHeaders* headers); | 56 |
78 void NotifySendHeaders(URLRequest* request, | 57 virtual void OnHeadersReceivedInternal( |
79 const HttpRequestHeaders& headers); | |
80 int NotifyHeadersReceived( | |
81 URLRequest* request, | 58 URLRequest* request, |
82 const CompletionCallback& callback, | 59 const CompletionCallback& callback, |
83 const HttpResponseHeaders* original_response_headers, | 60 const HttpResponseHeaders* original_response_headers, |
84 scoped_refptr<HttpResponseHeaders>* override_response_headers, | 61 scoped_refptr<HttpResponseHeaders>* override_response_headers, |
85 GURL* allowed_unsafe_redirect_url); | 62 GURL* allowed_unsafe_redirect_url); |
86 void NotifyBeforeRedirect(URLRequest* request, | |
87 const GURL& new_location); | |
88 void NotifyResponseStarted(URLRequest* request); | |
89 void NotifyRawBytesRead(const URLRequest& request, int bytes_read); | |
90 void NotifyCompleted(URLRequest* request, bool started); | |
91 void NotifyURLRequestDestroyed(URLRequest* request); | |
92 void NotifyPACScriptError(int line_number, const base::string16& error); | |
93 AuthRequiredResponse NotifyAuthRequired(URLRequest* request, | |
94 const AuthChallengeInfo& auth_info, | |
95 const AuthCallback& callback, | |
96 AuthCredentials* credentials); | |
97 bool CanGetCookies(const URLRequest& request, | |
98 const CookieList& cookie_list); | |
99 bool CanSetCookie(const URLRequest& request, | |
100 const std::string& cookie_line, | |
101 CookieOptions* options); | |
102 bool CanAccessFile(const URLRequest& request, | |
103 const base::FilePath& path) const; | |
104 bool CanThrottleRequest(const URLRequest& request) const; | |
105 bool CanEnablePrivacyMode(const GURL& url, | |
106 const GURL& first_party_for_cookies) const; | |
107 | 63 |
108 bool CancelURLRequestWithPolicyViolatingReferrerHeader( | 64 virtual void OnBeforeRedirectInternal(URLRequest* request, |
65 const GURL& new_location); | |
66 | |
67 virtual void OnResponseStartedInternal(URLRequest* request); | |
68 | |
69 virtual void OnRawBytesReadInternal(const URLRequest& request, | |
70 int bytes_read); | |
71 | |
72 virtual void OnCompletedInternal(URLRequest* request, bool started); | |
73 virtual void OnURLRequestDestroyedInternal(URLRequest* request); | |
74 | |
75 virtual void OnAuthRequiredInternal( | |
76 URLRequest* request, | |
77 const AuthChallengeInfo& auth_info, | |
78 const AuthCallback& callback, | |
79 AuthCredentials* credentials); | |
80 | |
81 virtual void OnCanGetCookiesInternal(const URLRequest& request, | |
82 const CookieList& cookie_list) final; | |
83 | |
84 virtual void OnCanAccessFileInternal(const URLRequest& request, | |
85 const base::FilePath& path) const; | |
86 | |
87 virtual void OnCanThrottleRequestInternal(const URLRequest& request) const; | |
88 | |
89 virtual void OnCanEnablePrivacyModeInternal( | |
90 const GURL& url, | |
91 const GURL& first_party_for_cookies) const; | |
92 | |
93 virtual void OnBeforeSocketStreamConnectInternal( | |
94 SocketStream* socket, const CompletionCallback& callback); | |
95 | |
96 virtual void OnCancelURLRequestWithPolicyViolatingReferrerHeaderInternal( | |
109 const URLRequest& request, | 97 const URLRequest& request, |
110 const GURL& target_url, | 98 const GURL& target_url, |
111 const GURL& referrer_url) const; | 99 const GURL& referrer_url) const; |
112 | 100 |
113 private: | 101 private: |
114 // This is the interface for subclasses of NetworkDelegate to implement. These | 102 // This is the interface for subclasses of NetworkDelegate to implement. These |
115 // member functions will be called by the respective public notification | 103 // member functions will be called by the respective public notification |
116 // member function, which will perform basic sanity checking. | 104 // member function, which will perform basic sanity checking. |
117 | 105 |
118 // Called before a request is sent. Allows the delegate to rewrite the URL | 106 // Called before a request is sent. Allows the delegate to rewrite the URL |
119 // being fetched by modifying |new_url|. If set, the URL must be valid. The | 107 // being fetched by modifying |new_url|. If set, the URL must be valid. The |
120 // reference fragment from the original URL is not automatically appended to | 108 // reference fragment from the original URL is not automatically appended to |
121 // |new_url|; callers are responsible for copying the reference fragment if | 109 // |new_url|; callers are responsible for copying the reference fragment if |
122 // desired. | 110 // desired. |
123 // |callback| and |new_url| are valid only until OnURLRequestDestroyed is | 111 // |callback| and |new_url| are valid only until OnURLRequestDestroyed is |
124 // called for this request. Returns a net status code, generally either OK to | 112 // called for this request. Returns a net status code, generally either OK to |
125 // continue with the request or ERR_IO_PENDING if the result is not ready yet. | 113 // continue with the request or ERR_IO_PENDING if the result is not ready yet. |
126 // A status code other than OK and ERR_IO_PENDING will cancel the request and | 114 // A status code other than OK and ERR_IO_PENDING will cancel the request and |
127 // report the status code as the reason. | 115 // report the status code as the reason. |
128 // | 116 // |
129 // The default implementation returns OK (continue with request). | 117 // The default implementation returns OK (continue with request). |
130 virtual int OnBeforeURLRequest(URLRequest* request, | 118 virtual int OnBeforeURLRequest(URLRequest* request, |
131 const CompletionCallback& callback, | 119 const CompletionCallback& callback, |
132 GURL* new_url); | 120 GURL* new_url) final; |
133 | 121 |
134 // Called as the proxy is being resolved for |url|. Allows the delegate to | 122 // Called as the proxy is being resolved for |url|. Allows the delegate to |
135 // override the proxy resolution decision made by ProxyService. The delegate | 123 // override the proxy resolution decision made by ProxyService. The delegate |
136 // may override the decision by modifying the ProxyInfo |result|. | 124 // may override the decision by modifying the ProxyInfo |result|. |
137 virtual void OnResolveProxy(const GURL& url, | 125 virtual void OnResolveProxy(const GURL& url, |
138 int load_flags, | 126 int load_flags, |
139 const ProxyService& proxy_service, | 127 const ProxyService& proxy_service, |
140 ProxyInfo* result); | 128 ProxyInfo* result) final; |
141 | 129 |
142 // Called when use of |bad_proxy| fails due to |net_error|. |net_error| is | 130 // Called when use of |bad_proxy| fails due to |net_error|. |net_error| is |
143 // the network error encountered, if any, and OK if the fallback was | 131 // the network error encountered, if any, and OK if the fallback was |
144 // for a reason other than a network error (e.g. the proxy service was | 132 // for a reason other than a network error (e.g. the proxy service was |
145 // explicitly directed to skip a proxy). | 133 // explicitly directed to skip a proxy). |
146 virtual void OnProxyFallback(const ProxyServer& bad_proxy, | 134 virtual void OnProxyFallback(const ProxyServer& bad_proxy, |
147 int net_error); | 135 int net_error) final; |
148 | 136 |
149 // Called right before the HTTP headers are sent. Allows the delegate to | 137 // Called right before the HTTP headers are sent. Allows the delegate to |
150 // read/write |headers| before they get sent out. |callback| and |headers| are | 138 // read/write |headers| before they get sent out. |callback| and |headers| are |
151 // valid only until OnCompleted or OnURLRequestDestroyed is called for this | 139 // valid only until OnCompleted or OnURLRequestDestroyed is called for this |
152 // request. | 140 // request. |
153 // See OnBeforeURLRequest for return value description. Returns OK by default. | 141 // See OnBeforeURLRequest for return value description. Returns OK by default. |
154 virtual int OnBeforeSendHeaders(URLRequest* request, | 142 virtual int OnBeforeSendHeaders(URLRequest* request, |
155 const CompletionCallback& callback, | 143 const CompletionCallback& callback, |
156 HttpRequestHeaders* headers); | 144 HttpRequestHeaders* headers) final; |
157 | 145 |
158 // Called after a proxy connection. Allows the delegate to read/write | 146 // Called after a proxy connection. Allows the delegate to read/write |
159 // |headers| before they get sent out. |headers| is valid only until | 147 // |headers| before they get sent out. |headers| is valid only until |
160 // OnCompleted or OnURLRequestDestroyed is called for this request. | 148 // OnCompleted or OnURLRequestDestroyed is called for this request. |
161 virtual void OnBeforeSendProxyHeaders(URLRequest* request, | 149 virtual void OnBeforeSendProxyHeaders(URLRequest* request, |
162 const ProxyInfo& proxy_info, | 150 const ProxyInfo& proxy_info, |
163 HttpRequestHeaders* headers); | 151 HttpRequestHeaders* headers) final; |
164 | 152 |
165 // Called right before the HTTP request(s) are being sent to the network. | 153 // Called right before the HTTP request(s) are being sent to the network. |
166 // |headers| is only valid until OnCompleted or OnURLRequestDestroyed is | 154 // |headers| is only valid until OnCompleted or OnURLRequestDestroyed is |
167 // called for this request. | 155 // called for this request. |
168 virtual void OnSendHeaders(URLRequest* request, | 156 virtual void OnSendHeaders(URLRequest* request, |
169 const HttpRequestHeaders& headers); | 157 const HttpRequestHeaders& headers) final; |
170 | 158 |
171 // Called for HTTP requests when the headers have been received. | 159 // Called for HTTP requests when the headers have been received. |
172 // |original_response_headers| contains the headers as received over the | 160 // |original_response_headers| contains the headers as received over the |
173 // network, these must not be modified. |override_response_headers| can be set | 161 // network, these must not be modified. |override_response_headers| can be set |
174 // to new values, that should be considered as overriding | 162 // to new values, that should be considered as overriding |
175 // |original_response_headers|. | 163 // |original_response_headers|. |
176 // If the response is a redirect, and the Location response header value is | 164 // If the response is a redirect, and the Location response header value is |
177 // identical to |allowed_unsafe_redirect_url|, then the redirect is never | 165 // identical to |allowed_unsafe_redirect_url|, then the redirect is never |
178 // blocked and the reference fragment is not copied from the original URL | 166 // blocked and the reference fragment is not copied from the original URL |
179 // to the redirection target. | 167 // to the redirection target. |
180 // | 168 // |
181 // |callback|, |original_response_headers|, and |override_response_headers| | 169 // |callback|, |original_response_headers|, and |override_response_headers| |
182 // are only valid until OnURLRequestDestroyed is called for this request. | 170 // are only valid until OnURLRequestDestroyed is called for this request. |
183 // See OnBeforeURLRequest for return value description. Returns OK by default. | 171 // See OnBeforeURLRequest for return value description. Returns OK by default. |
184 virtual int OnHeadersReceived( | 172 virtual int OnHeadersReceived( |
185 URLRequest* request, | 173 URLRequest* request, |
186 const CompletionCallback& callback, | 174 const CompletionCallback& callback, |
187 const HttpResponseHeaders* original_response_headers, | 175 const HttpResponseHeaders* original_response_headers, |
188 scoped_refptr<HttpResponseHeaders>* override_response_headers, | 176 scoped_refptr<HttpResponseHeaders>* override_response_headers, |
189 GURL* allowed_unsafe_redirect_url); | 177 GURL* allowed_unsafe_redirect_url) final; |
190 | 178 |
191 // Called right after a redirect response code was received. | 179 // Called right after a redirect response code was received. |
192 // |new_location| is only valid until OnURLRequestDestroyed is called for this | 180 // |new_location| is only valid until OnURLRequestDestroyed is called for this |
193 // request. | 181 // request. |
194 virtual void OnBeforeRedirect(URLRequest* request, | 182 virtual void OnBeforeRedirect(URLRequest* request, |
195 const GURL& new_location); | 183 const GURL& new_location) final; |
196 | 184 |
197 // This corresponds to URLRequestDelegate::OnResponseStarted. | 185 // This corresponds to URLRequestDelegate::OnResponseStarted. |
198 virtual void OnResponseStarted(URLRequest* request); | 186 virtual void OnResponseStarted(URLRequest* request) final; |
199 | 187 |
200 // Called every time we read raw bytes. | 188 // Called every time we read raw bytes. |
201 virtual void OnRawBytesRead(const URLRequest& request, int bytes_read); | 189 virtual void OnRawBytesRead(const URLRequest& request, int bytes_read) final; |
202 | 190 |
203 // Indicates that the URL request has been completed or failed. | 191 // Indicates that the URL request has been completed or failed. |
204 // |started| indicates whether the request has been started. If false, | 192 // |started| indicates whether the request has been started. If false, |
205 // some information like the socket address is not available. | 193 // some information like the socket address is not available. |
206 virtual void OnCompleted(URLRequest* request, bool started); | 194 virtual void OnCompleted(URLRequest* request, bool started) final; |
207 | 195 |
208 // Called when an URLRequest is being destroyed. Note that the request is | 196 // Called when an URLRequest is being destroyed. Note that the request is |
209 // being deleted, so it's not safe to call any methods that may result in | 197 // being deleted, so it's not safe to call any methods that may result in |
210 // a virtual method call. | 198 // a virtual method call. |
211 virtual void OnURLRequestDestroyed(URLRequest* request); | 199 virtual void OnURLRequestDestroyed(URLRequest* request) final; |
212 | 200 |
213 // Corresponds to ProxyResolverJSBindings::OnError. | 201 // Corresponds to ProxyResolverJSBindings::OnError. |
214 virtual void OnPACScriptError(int line_number, | 202 virtual void OnPACScriptError(int line_number, |
215 const base::string16& error); | 203 const base::string16& error) final; |
204 virtual void OnPACScriptErrorInternal(int line_number, | |
205 const base::string16& error); | |
216 | 206 |
217 // Called when a request receives an authentication challenge | 207 // Called when a request receives an authentication challenge |
218 // specified by |auth_info|, and is unable to respond using cached | 208 // specified by |auth_info|, and is unable to respond using cached |
219 // credentials. |callback| and |credentials| must be non-NULL, and must | 209 // credentials. |callback| and |credentials| must be non-NULL, and must |
220 // be valid until OnURLRequestDestroyed is called for |request|. | 210 // be valid until OnURLRequestDestroyed is called for |request|. |
221 // | 211 // |
222 // The following return values are allowed: | 212 // The following return values are allowed: |
223 // - AUTH_REQUIRED_RESPONSE_NO_ACTION: |auth_info| is observed, but | 213 // - AUTH_REQUIRED_RESPONSE_NO_ACTION: |auth_info| is observed, but |
224 // no action is being taken on it. | 214 // no action is being taken on it. |
225 // - AUTH_REQUIRED_RESPONSE_SET_AUTH: |credentials| is filled in with | 215 // - AUTH_REQUIRED_RESPONSE_SET_AUTH: |credentials| is filled in with |
226 // a username and password, which should be used in a response to | 216 // a username and password, which should be used in a response to |
227 // |auth_info|. | 217 // |auth_info|. |
228 // - AUTH_REQUIRED_RESPONSE_CANCEL_AUTH: The authentication challenge | 218 // - AUTH_REQUIRED_RESPONSE_CANCEL_AUTH: The authentication challenge |
229 // should not be attempted. | 219 // should not be attempted. |
230 // - AUTH_REQUIRED_RESPONSE_IO_PENDING: The action will be decided | 220 // - AUTH_REQUIRED_RESPONSE_IO_PENDING: The action will be decided |
231 // asynchronously. |callback| will be invoked when the decision is made, | 221 // asynchronously. |callback| will be invoked when the decision is made, |
232 // and one of the other AuthRequiredResponse values will be passed in with | 222 // and one of the other AuthRequiredResponse values will be passed in with |
233 // the same semantics as described above. | 223 // the same semantics as described above. |
234 virtual AuthRequiredResponse OnAuthRequired( | 224 virtual AuthRequiredResponse OnAuthRequired( |
235 URLRequest* request, | 225 URLRequest* request, |
236 const AuthChallengeInfo& auth_info, | 226 const AuthChallengeInfo& auth_info, |
237 const AuthCallback& callback, | 227 const AuthCallback& callback, |
238 AuthCredentials* credentials); | 228 AuthCredentials* credentials) final; |
239 | 229 |
240 // Called when reading cookies to allow the network delegate to block access | 230 // Called when reading cookies to allow the network delegate to block access |
241 // to the cookie. This method will never be invoked when | 231 // to the cookie. This method will never be invoked when |
242 // LOAD_DO_NOT_SEND_COOKIES is specified. | 232 // LOAD_DO_NOT_SEND_COOKIES is specified. |
243 virtual bool OnCanGetCookies(const URLRequest& request, | 233 virtual bool OnCanGetCookies(const URLRequest& request, |
244 const CookieList& cookie_list); | 234 const CookieList& cookie_list) final; |
245 | 235 |
246 // Called when a cookie is set to allow the network delegate to block access | 236 // Called when a cookie is set to allow the network delegate to block access |
247 // to the cookie. This method will never be invoked when | 237 // to the cookie. This method will never be invoked when |
248 // LOAD_DO_NOT_SAVE_COOKIES is specified. | 238 // LOAD_DO_NOT_SAVE_COOKIES is specified. |
249 virtual bool OnCanSetCookie(const URLRequest& request, | 239 virtual bool OnCanSetCookie(const URLRequest& request, |
250 const std::string& cookie_line, | 240 const std::string& cookie_line, |
251 CookieOptions* options); | 241 CookieOptions* options) final; |
242 | |
243 virtual void OnCanSetCookieInternal(const URLRequest& request, | |
244 const std::string& cookie_line, | |
245 CookieOptions* options); | |
252 | 246 |
253 // Called when a file access is attempted to allow the network delegate to | 247 // Called when a file access is attempted to allow the network delegate to |
254 // allow or block access to the given file path. Returns true if access is | 248 // allow or block access to the given file path. Returns true if access is |
255 // allowed. | 249 // allowed. |
256 virtual bool OnCanAccessFile(const URLRequest& request, | 250 virtual bool OnCanAccessFile(const URLRequest& request, |
257 const base::FilePath& path) const; | 251 const base::FilePath& path) const final; |
258 | 252 |
259 // Returns true if the given request may be rejected when the | 253 // Returns true if the given request may be rejected when the |
260 // URLRequestThrottlerManager believes the server servicing the | 254 // URLRequestThrottlerManager believes the server servicing the |
261 // request is overloaded or down. | 255 // request is overloaded or down. |
262 virtual bool OnCanThrottleRequest(const URLRequest& request) const; | 256 virtual bool OnCanThrottleRequest(const URLRequest& request) const final; |
263 | 257 |
264 // Returns true if the given |url| has to be requested over connection that | 258 // Returns true if the given |url| has to be requested over connection that |
265 // is not tracked by the server. Usually is false, unless user privacy | 259 // is not tracked by the server. Usually is false, unless user privacy |
266 // settings block cookies from being get or set. | 260 // settings block cookies from being get or set. |
267 virtual bool OnCanEnablePrivacyMode( | 261 virtual bool OnCanEnablePrivacyMode( |
268 const GURL& url, | 262 const GURL& url, |
269 const GURL& first_party_for_cookies) const; | 263 const GURL& first_party_for_cookies) const final; |
270 | 264 |
271 // Called before a SocketStream tries to connect. | 265 // Called before a SocketStream tries to connect. |
272 // See OnBeforeURLRequest for return value description. Returns OK by default. | 266 // See OnBeforeURLRequest for return value description. Returns OK by default. |
273 virtual int OnBeforeSocketStreamConnect( | 267 virtual int OnBeforeSocketStreamConnect( |
274 SocketStream* socket, const CompletionCallback& callback); | 268 SocketStream* socket, const CompletionCallback& callback) final; |
275 | 269 |
276 // Called when the |referrer_url| for requesting |target_url| during handling | 270 // Called when the |referrer_url| for requesting |target_url| during handling |
277 // of the |request| is does not comply with the referrer policy (e.g. a | 271 // of the |request| is does not comply with the referrer policy (e.g. a |
278 // secure referrer for an insecure initial target). | 272 // secure referrer for an insecure initial target). |
279 // Returns true if the request should be cancelled. Otherwise, the referrer | 273 // Returns true if the request should be cancelled. Otherwise, the referrer |
280 // header is stripped from the request. | 274 // header is stripped from the request. |
281 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 275 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
282 const URLRequest& request, | 276 const URLRequest& request, |
283 const GURL& target_url, | 277 const GURL& target_url, |
284 const GURL& referrer_url) const; | 278 const GURL& referrer_url) const final; |
279 | |
280 // WrappingNetworkDelegate takes ownership of this. | |
281 scoped_ptr<NetworkDelegate> wrapped_network_delegate_; | |
285 }; | 282 }; |
286 | 283 |
287 } // namespace net | 284 } // namespace net |
288 | 285 #endif // NET_BASE_WRAPPING_NETWORK_DELEGATE_H_ |
289 #endif // NET_BASE_NETWORK_DELEGATE_H_ | |
OLD | NEW |