| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_NET_CONNECT_INTERCEPTOR_H_ | 5 #ifndef CHROME_BROWSER_NET_CONNECT_INTERCEPTOR_H_ |
| 6 #define CHROME_BROWSER_NET_CONNECT_INTERCEPTOR_H_ | 6 #define CHROME_BROWSER_NET_CONNECT_INTERCEPTOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "net/url_request/url_request.h" | 9 #include "net/url_request/url_request.h" |
| 10 | 10 |
| 11 namespace chrome_browser_net { | 11 namespace chrome_browser_net { |
| 12 | 12 |
| 13 //------------------------------------------------------------------------------ | 13 //------------------------------------------------------------------------------ |
| 14 // An interceptor to monitor URLRequests so that we can do speculative DNS | 14 // An interceptor to monitor URLRequests so that we can do speculative DNS |
| 15 // resolution and/or speculative TCP preconnections. | 15 // resolution and/or speculative TCP preconnections. |
| 16 class ConnectInterceptor : public URLRequest::Interceptor { | 16 class ConnectInterceptor : public URLRequest::Interceptor { |
| 17 public: | 17 public: |
| 18 // Construction includes registration as an URL. | 18 // Construction includes registration as an URL. |
| 19 ConnectInterceptor(); | 19 ConnectInterceptor(); |
| 20 // Destruction includes unregistering. | 20 // Destruction includes unregistering. |
| 21 virtual ~ConnectInterceptor(); | 21 virtual ~ConnectInterceptor(); |
| 22 | 22 |
| 23 protected: | 23 protected: |
| 24 // URLRequest::Interceptor overrides | 24 // URLRequest::Interceptor overrides |
| 25 // Learn about referrers, and optionally preconnect based on history. | 25 // Learn about referrers, and optionally preconnect based on history. |
| 26 virtual URLRequestJob* MaybeIntercept(URLRequest* request); | 26 virtual URLRequestJob* MaybeIntercept(URLRequest* request); |
| 27 virtual URLRequestJob* MaybeInterceptResponse(URLRequest* request) { | 27 virtual URLRequestJob* MaybeInterceptResponse(URLRequest* request); |
| 28 return NULL; | |
| 29 } | |
| 30 virtual URLRequestJob* MaybeInterceptRedirect(URLRequest* request, | 28 virtual URLRequestJob* MaybeInterceptRedirect(URLRequest* request, |
| 31 const GURL& location) { | 29 const GURL& location); |
| 32 return NULL; | |
| 33 } | |
| 34 | 30 |
| 35 private: | 31 private: |
| 36 DISALLOW_COPY_AND_ASSIGN(ConnectInterceptor); | 32 DISALLOW_COPY_AND_ASSIGN(ConnectInterceptor); |
| 37 }; | 33 }; |
| 38 | 34 |
| 39 } // namespace chrome_browser_net | 35 } // namespace chrome_browser_net |
| 40 | 36 |
| 41 #endif // CHROME_BROWSER_NET_CONNECT_INTERCEPTOR_H_ | 37 #endif // CHROME_BROWSER_NET_CONNECT_INTERCEPTOR_H_ |
| OLD | NEW |