Chromium Code Reviews| Index: chrome/browser/net/connect_interceptor.cc |
| diff --git a/chrome/browser/net/connect_interceptor.cc b/chrome/browser/net/connect_interceptor.cc |
| index c1d6deac19b66137cd1179dc5153e8147e91c9de..16b3ed232422802d5a557b1f48372631f23489d3 100644 |
| --- a/chrome/browser/net/connect_interceptor.cc |
| +++ b/chrome/browser/net/connect_interceptor.cc |
| @@ -6,6 +6,7 @@ |
| #include "chrome/browser/net/predictor.h" |
| #include "net/base/load_flags.h" |
| +#include "net/url_request/protocol_intercept_job_factory.h" |
| #include "net/url_request/url_request.h" |
| namespace chrome_browser_net { |
| @@ -17,6 +18,17 @@ namespace chrome_browser_net { |
| // TODO(jar): We should do a persistent field trial to validate/optimize this. |
| static const int kMaxUnusedSocketLifetimeSecondsWithoutAGet = 10; |
| +// static |
| +scoped_ptr<net::URLRequestJobFactory> |
| +ConnectInterceptor::CreateURLRequestJobFactory( |
| + scoped_ptr<net::URLRequestJobFactory> base_job_factory, |
| + Predictor* predictor) { |
| + scoped_ptr<net::URLRequestJobFactory> top_job_factory( |
| + new net::ProtocolInterceptJobFactory(base_job_factory.Pass(), |
| + new ConnectInterceptor(predictor))); |
| + return top_job_factory.Pass(); |
| +} |
| + |
| ConnectInterceptor::ConnectInterceptor(Predictor* predictor) |
| : timed_cache_(base::TimeDelta::FromSeconds( |
| kMaxUnusedSocketLifetimeSecondsWithoutAGet)), |
| @@ -27,7 +39,7 @@ ConnectInterceptor::ConnectInterceptor(Predictor* predictor) |
| ConnectInterceptor::~ConnectInterceptor() { |
| } |
| -net::URLRequestJob* ConnectInterceptor::MaybeIntercept( |
| +net::URLRequestJob* ConnectInterceptor::MaybeCreateJob( |
|
willchan no longer on Chromium
2012/12/11 19:14:38
No, this ConnectInterceptor is all wrong :) When c
pauljensen
2012/12/11 22:28:14
Right now the ConnectionInterceptor is installed i
mmenke
2012/12/13 16:12:04
I think that's fine for now, though should be done
pauljensen
2012/12/13 17:53:30
Sorry, I'm confused.
What is fine for now? Moving
willchan no longer on Chromium
2012/12/13 17:59:53
So, long-term we need to start refactoring ChromeN
pauljensen
2012/12/13 18:21:54
If I move ConnectionInterceptor into the ChromeNet
|
| net::URLRequest* request, net::NetworkDelegate* network_delegate) const { |
| GURL request_scheme_host(Predictor::CanonicalizeUrl(request->url())); |
| if (request_scheme_host == GURL::EmptyGURL()) |
| @@ -87,18 +99,6 @@ net::URLRequestJob* ConnectInterceptor::MaybeIntercept( |
| return NULL; |
| } |
| -net::URLRequestJob* ConnectInterceptor::MaybeInterceptResponse( |
| - net::URLRequest* request, net::NetworkDelegate* network_delegate) const { |
| - return NULL; |
| -} |
| - |
| -net::URLRequestJob* ConnectInterceptor::MaybeInterceptRedirect( |
| - const GURL& location, |
| - net::URLRequest* request, |
| - net::NetworkDelegate* network_delegate) const { |
| - return NULL; |
| -} |
| - |
| ConnectInterceptor::TimedCache::TimedCache(const base::TimeDelta& max_duration) |
| : mru_cache_(UrlMruTimedCache::NO_AUTO_EVICT), |
| max_duration_(max_duration) { |