| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 7 |
| 8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "base/memory/mru_cache.h" | 9 #include "base/memory/mru_cache.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 public: | 21 public: |
| 22 // Construction includes registration as an URL. | 22 // Construction includes registration as an URL. |
| 23 explicit ConnectInterceptor(Predictor* predictor); | 23 explicit ConnectInterceptor(Predictor* predictor); |
| 24 // Destruction includes unregistering. | 24 // Destruction includes unregistering. |
| 25 virtual ~ConnectInterceptor(); | 25 virtual ~ConnectInterceptor(); |
| 26 | 26 |
| 27 protected: | 27 protected: |
| 28 // Overridden from net::URLRequest::Interceptor: | 28 // Overridden from net::URLRequest::Interceptor: |
| 29 // Learn about referrers, and optionally preconnect based on history. | 29 // Learn about referrers, and optionally preconnect based on history. |
| 30 virtual net::URLRequestJob* MaybeIntercept( | 30 virtual net::URLRequestJob* MaybeIntercept( |
| 31 net::URLRequest* request) const OVERRIDE; | 31 net::URLRequest* request, |
| 32 net::NetworkDelegate* network_delegate) const OVERRIDE; |
| 32 virtual net::URLRequestJob* MaybeInterceptResponse( | 33 virtual net::URLRequestJob* MaybeInterceptResponse( |
| 33 net::URLRequest* request) const OVERRIDE; | 34 net::URLRequest* request) const OVERRIDE; |
| 34 virtual net::URLRequestJob* MaybeInterceptRedirect( | 35 virtual net::URLRequestJob* MaybeInterceptRedirect( |
| 35 const GURL& location, net::URLRequest* request) const OVERRIDE; | 36 const GURL& location, net::URLRequest* request) const OVERRIDE; |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 // Provide access to local class TimedCache for testing. | 39 // Provide access to local class TimedCache for testing. |
| 39 FRIEND_TEST_ALL_PREFIXES(ConnectInterceptorTest, TimedCacheRecall); | 40 FRIEND_TEST_ALL_PREFIXES(ConnectInterceptorTest, TimedCacheRecall); |
| 40 FRIEND_TEST_ALL_PREFIXES(ConnectInterceptorTest, TimedCacheEviction); | 41 FRIEND_TEST_ALL_PREFIXES(ConnectInterceptorTest, TimedCacheEviction); |
| 41 | 42 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 }; | 74 }; |
| 74 TimedCache timed_cache_; | 75 TimedCache timed_cache_; |
| 75 Predictor* const predictor_; | 76 Predictor* const predictor_; |
| 76 | 77 |
| 77 DISALLOW_COPY_AND_ASSIGN(ConnectInterceptor); | 78 DISALLOW_COPY_AND_ASSIGN(ConnectInterceptor); |
| 78 }; | 79 }; |
| 79 | 80 |
| 80 } // namespace chrome_browser_net | 81 } // namespace chrome_browser_net |
| 81 | 82 |
| 82 #endif // CHROME_BROWSER_NET_CONNECT_INTERCEPTOR_H_ | 83 #endif // CHROME_BROWSER_NET_CONNECT_INTERCEPTOR_H_ |
| OLD | NEW |