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 #include "net/url_request/protocol_intercept_job_factory.h" | 5 #include "net/url_request/url_request_intercepting_job_factory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "net/url_request/url_request_interceptor.h" |
8 | 9 |
9 namespace net { | 10 namespace net { |
10 | 11 |
11 ProtocolInterceptJobFactory::ProtocolInterceptJobFactory( | 12 URLRequestInterceptingJobFactory::URLRequestInterceptingJobFactory( |
12 scoped_ptr<URLRequestJobFactory> job_factory, | 13 scoped_ptr<URLRequestJobFactory> job_factory, |
13 scoped_ptr<ProtocolHandler> protocol_handler) | 14 scoped_ptr<URLRequestInterceptor> interceptor) |
14 : job_factory_(job_factory.Pass()), | 15 : job_factory_(job_factory.Pass()), |
15 protocol_handler_(protocol_handler.Pass()) { | 16 interceptor_(interceptor.Pass()) { |
16 } | 17 } |
17 | 18 |
18 ProtocolInterceptJobFactory::~ProtocolInterceptJobFactory() {} | 19 URLRequestInterceptingJobFactory::~URLRequestInterceptingJobFactory() {} |
19 | 20 |
20 URLRequestJob* ProtocolInterceptJobFactory::MaybeCreateJobWithProtocolHandler( | 21 URLRequestJob* URLRequestInterceptingJobFactory:: |
| 22 MaybeCreateJobWithProtocolHandler( |
21 const std::string& scheme, | 23 const std::string& scheme, |
22 URLRequest* request, | 24 URLRequest* request, |
23 NetworkDelegate* network_delegate) const { | 25 NetworkDelegate* network_delegate) const { |
24 DCHECK(CalledOnValidThread()); | 26 DCHECK(CalledOnValidThread()); |
25 URLRequestJob* job = protocol_handler_->MaybeCreateJob(request, | 27 URLRequestJob* job = interceptor_->MaybeInterceptRequest(request, |
26 network_delegate); | 28 network_delegate); |
27 if (job) | 29 if (job) |
28 return job; | 30 return job; |
29 return job_factory_->MaybeCreateJobWithProtocolHandler( | 31 return job_factory_->MaybeCreateJobWithProtocolHandler( |
30 scheme, request, network_delegate); | 32 scheme, request, network_delegate); |
31 } | 33 } |
32 | 34 |
33 bool ProtocolInterceptJobFactory::IsHandledProtocol( | 35 bool URLRequestInterceptingJobFactory::IsHandledProtocol( |
34 const std::string& scheme) const { | 36 const std::string& scheme) const { |
35 return job_factory_->IsHandledProtocol(scheme); | 37 return job_factory_->IsHandledProtocol(scheme); |
36 } | 38 } |
37 | 39 |
38 bool ProtocolInterceptJobFactory::IsHandledURL(const GURL& url) const { | 40 bool URLRequestInterceptingJobFactory::IsHandledURL(const GURL& url) const { |
39 return job_factory_->IsHandledURL(url); | 41 return job_factory_->IsHandledURL(url); |
40 } | 42 } |
41 | 43 |
42 bool ProtocolInterceptJobFactory::IsSafeRedirectTarget( | 44 bool URLRequestInterceptingJobFactory::IsSafeRedirectTarget( |
43 const GURL& location) const { | 45 const GURL& location) const { |
44 return job_factory_->IsSafeRedirectTarget(location); | 46 return job_factory_->IsSafeRedirectTarget(location); |
45 } | 47 } |
46 | 48 |
47 } // namespace net | 49 } // namespace net |
OLD | NEW |