OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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_RESOURCE_PREFETCH_INTERCEPTOR_H_ | |
6 #define CHROME_BROWSER_NET_RESOURCE_PREFETCH_INTERCEPTOR_H_ | |
7 #pragma once | |
8 | |
9 #include "base/basictypes.h" | |
10 #include "base/memory/ref_counted.h" | |
11 #include "chrome/browser/predictors/resource_prefetch_predictor.h" | |
12 #include "net/url_request/url_request_job_factory.h" | |
dominich
2012/05/21 16:16:53
nit: this include should be first as it defines th
Shishir
2012/05/23 01:46:46
No longer required.
| |
13 | |
14 namespace predictors { | |
15 class URLRequestSummary; | |
16 } | |
17 | |
18 namespace chrome_browser_net { | |
19 | |
20 class ResourcePrefetchInterceptor | |
21 : public net::URLRequestJobFactory::Interceptor { | |
willchan no longer on Chromium
2012/05/21 20:20:18
No, do not use this interface. You're not intercep
Shishir
2012/05/23 01:46:46
Done,
| |
22 public: | |
23 explicit ResourcePrefetchInterceptor( | |
24 scoped_refptr<predictors::ResourcePrefetchPredictor> predictor); | |
25 virtual ~ResourcePrefetchInterceptor(); | |
26 | |
27 protected: | |
28 virtual net::URLRequestJob* MaybeIntercept( | |
29 net::URLRequest* request) const OVERRIDE; | |
30 virtual net::URLRequestJob* MaybeInterceptResponse( | |
31 net::URLRequest* request) const OVERRIDE; | |
32 virtual net::URLRequestJob* MaybeInterceptRedirect( | |
33 const GURL& location, net::URLRequest* request) const OVERRIDE; | |
34 | |
35 private: | |
36 void Intercept( | |
37 net::URLRequest* request, | |
38 bool is_response, | |
39 void(predictors::ResourcePrefetchPredictor::*InterceptFunction) | |
40 (const predictors::ResourcePrefetchPredictor::URLRequestSummary&)) const; | |
41 | |
42 scoped_refptr<predictors::ResourcePrefetchPredictor> predictor_; | |
willchan no longer on Chromium
2012/05/21 20:20:18
Does ResourcePrefetchInterceptor own predictors::R
Shishir
2012/05/23 01:46:46
ResourcePrefetchPredictor is refcounted as it need
| |
43 | |
44 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchInterceptor); | |
45 }; | |
46 | |
47 } // namespace chrome_browser_net | |
48 | |
49 #endif // CHROME_BROWSER_NET_RESOURCE_PREFETCH_INTERCEPTOR_H_ | |
OLD | NEW |