| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_NET_CONNECT_INTERCEPTOR_H_ | |
| 6 #define CHROME_BROWSER_NET_CONNECT_INTERCEPTOR_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/gtest_prod_util.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "chrome/browser/net/timed_cache.h" | |
| 13 | |
| 14 class GURL; | |
| 15 | |
| 16 namespace net { | |
| 17 class URLRequest; | |
| 18 } | |
| 19 | |
| 20 namespace chrome_browser_net { | |
| 21 | |
| 22 class Predictor; | |
| 23 | |
| 24 //------------------------------------------------------------------------------ | |
| 25 // An interceptor to monitor URLRequests so that we can do speculative DNS | |
| 26 // resolution and/or speculative TCP preconnections. | |
| 27 class ConnectInterceptor { | |
| 28 public: | |
| 29 // Construction includes registration as an URL. | |
| 30 explicit ConnectInterceptor(Predictor* predictor); | |
| 31 // Destruction includes unregistering. | |
| 32 virtual ~ConnectInterceptor(); | |
| 33 | |
| 34 // Learn about referrers, and optionally preconnect based on history. | |
| 35 void WitnessURLRequest(net::URLRequest* request); | |
| 36 | |
| 37 private: | |
| 38 // Provide access to local class TimedCache for testing. | |
| 39 FRIEND_TEST_ALL_PREFIXES(ConnectInterceptorTest, TimedCacheRecall); | |
| 40 FRIEND_TEST_ALL_PREFIXES(ConnectInterceptorTest, TimedCacheEviction); | |
| 41 | |
| 42 TimedCache timed_cache_; | |
| 43 Predictor* const predictor_; | |
| 44 | |
| 45 DISALLOW_COPY_AND_ASSIGN(ConnectInterceptor); | |
| 46 }; | |
| 47 | |
| 48 } // namespace chrome_browser_net | |
| 49 | |
| 50 #endif // CHROME_BROWSER_NET_CONNECT_INTERCEPTOR_H_ | |
| OLD | NEW |