| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_URL_REQUEST_URL_REQUEST_INTERCEPTOR_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_INTERCEPTOR_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_INTERCEPTOR_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_INTERCEPTOR_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "net/base/net_export.h" | 9 #include "net/base/net_export.h" |
| 10 | 10 |
| 11 class GURL; |
| 12 |
| 11 namespace net { | 13 namespace net { |
| 12 | 14 |
| 13 class URLRequest; | 15 class URLRequest; |
| 14 class URLRequestJob; | 16 class URLRequestJob; |
| 15 class NetworkDelegate; | 17 class NetworkDelegate; |
| 16 | 18 |
| 17 // A URLRequestInterceptor is given a chance to create a URLRequestJob to | 19 // A URLRequestInterceptor is given a chance to create a URLRequestJob to |
| 18 // handle URLRequests before they're handed off to the ProtocolHandler for | 20 // handle URLRequests before they're handed off to the ProtocolHandler for |
| 19 // the request's scheme. | 21 // the request's scheme. |
| 20 class NET_EXPORT URLRequestInterceptor { | 22 class NET_EXPORT URLRequestInterceptor { |
| 21 public: | 23 public: |
| 22 URLRequestInterceptor(); | 24 URLRequestInterceptor(); |
| 23 virtual ~URLRequestInterceptor(); | 25 virtual ~URLRequestInterceptor(); |
| 24 | 26 |
| 25 // Returns a URLRequestJob to handle |request|, if the interceptor wants to | 27 // Returns a URLRequestJob to handle |request|, if the interceptor wants to |
| 26 // take over the handling the request instead of the default ProtocolHandler. | 28 // take over the handling the request instead of the default ProtocolHandler. |
| 27 // Otherwise, returns NULL. | 29 // Otherwise, returns NULL. |
| 28 virtual URLRequestJob* MaybeInterceptRequest( | 30 virtual URLRequestJob* MaybeInterceptRequest( |
| 29 URLRequest* request, NetworkDelegate* network_delegate) const = 0; | 31 URLRequest* request, NetworkDelegate* network_delegate) const = 0; |
| 30 | 32 |
| 33 // Returns a URLRequestJob to handle |request|, if the interceptor wants to |
| 34 // take over the handling of the request after a redirect is received, |
| 35 // instead of using the default ProtocolHandler. Otherwise, returns NULL. |
| 36 virtual URLRequestJob* MaybeInterceptRedirect( |
| 37 URLRequest* request, |
| 38 NetworkDelegate* network_delegate, |
| 39 const GURL& location) const; |
| 40 |
| 41 // Returns a URLRequestJob to handle |request, if the interceptor wants to |
| 42 // take over the handling of the request after a response has started, |
| 43 // instead of using the default ProtocolHandler. Otherwise, returns NULL. |
| 44 virtual URLRequestJob* MaybeInterceptResponse( |
| 45 URLRequest* request, NetworkDelegate* network_delegate) const; |
| 46 |
| 31 private: | 47 private: |
| 32 DISALLOW_COPY_AND_ASSIGN(URLRequestInterceptor); | 48 DISALLOW_COPY_AND_ASSIGN(URLRequestInterceptor); |
| 33 }; | 49 }; |
| 34 | 50 |
| 35 } // namespace net | 51 } // namespace net |
| 36 | 52 |
| 37 #endif // NET_URL_REQUEST_URL_REQUEST_INTERCEPTOR_H_ | 53 #endif // NET_URL_REQUEST_URL_REQUEST_INTERCEPTOR_H_ |
| OLD | NEW |