• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_BROWSER_NET_CONNECT_INTERCEPTOR_H_
6 #define CHROME_BROWSER_NET_CONNECT_INTERCEPTOR_H_
7 #pragma once
8 
9 #include "net/url_request/url_request.h"
10 
11 namespace chrome_browser_net {
12 
13 //------------------------------------------------------------------------------
14 // An interceptor to monitor URLRequests so that we can do speculative DNS
15 // resolution and/or speculative TCP preconnections.
16 class ConnectInterceptor : public net::URLRequest::Interceptor {
17  public:
18   // Construction includes registration as an URL.
19   ConnectInterceptor();
20   // Destruction includes unregistering.
21   virtual ~ConnectInterceptor();
22 
23  protected:
24   // Overridden from net::URLRequest::Interceptor:
25   // Learn about referrers, and optionally preconnect based on history.
26   virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request);
27   virtual net::URLRequestJob* MaybeInterceptResponse(net::URLRequest* request);
28   virtual net::URLRequestJob* MaybeInterceptRedirect(net::URLRequest* request,
29                                                      const GURL& location);
30 
31  private:
32   DISALLOW_COPY_AND_ASSIGN(ConnectInterceptor);
33 };
34 
35 }  // namespace chrome_browser_net
36 
37 #endif  // CHROME_BROWSER_NET_CONNECT_INTERCEPTOR_H_
38