| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/url_request_intercepting_job_factory.h" | 5 #include "net/url_request/url_request_intercepting_job_factory.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "net/url_request/url_request_interceptor.h" | 10 #include "net/url_request/url_request_interceptor.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 delete job_factory_; | 28 delete job_factory_; |
| 29 delete interceptor_; | 29 delete interceptor_; |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 | 32 |
| 33 URLRequestJob* URLRequestInterceptingJobFactory:: | 33 URLRequestJob* URLRequestInterceptingJobFactory:: |
| 34 MaybeCreateJobWithProtocolHandler( | 34 MaybeCreateJobWithProtocolHandler( |
| 35 const std::string& scheme, | 35 const std::string& scheme, |
| 36 URLRequest* request, | 36 URLRequest* request, |
| 37 NetworkDelegate* network_delegate) const { | 37 NetworkDelegate* network_delegate) const { |
| 38 DCHECK(CalledOnValidThread()); | 38 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 39 URLRequestJob* job = interceptor_->MaybeInterceptRequest(request, | 39 URLRequestJob* job = interceptor_->MaybeInterceptRequest(request, |
| 40 network_delegate); | 40 network_delegate); |
| 41 if (job) | 41 if (job) |
| 42 return job; | 42 return job; |
| 43 return job_factory_->MaybeCreateJobWithProtocolHandler( | 43 return job_factory_->MaybeCreateJobWithProtocolHandler( |
| 44 scheme, request, network_delegate); | 44 scheme, request, network_delegate); |
| 45 } | 45 } |
| 46 | 46 |
| 47 URLRequestJob* URLRequestInterceptingJobFactory::MaybeInterceptRedirect( | 47 URLRequestJob* URLRequestInterceptingJobFactory::MaybeInterceptRedirect( |
| 48 URLRequest* request, | 48 URLRequest* request, |
| 49 NetworkDelegate* network_delegate, | 49 NetworkDelegate* network_delegate, |
| 50 const GURL& location) const { | 50 const GURL& location) const { |
| 51 DCHECK(CalledOnValidThread()); | 51 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 52 URLRequestJob* job = interceptor_->MaybeInterceptRedirect(request, | 52 URLRequestJob* job = interceptor_->MaybeInterceptRedirect(request, |
| 53 network_delegate, | 53 network_delegate, |
| 54 location); | 54 location); |
| 55 if (job) | 55 if (job) |
| 56 return job; | 56 return job; |
| 57 return job_factory_->MaybeInterceptRedirect(request, | 57 return job_factory_->MaybeInterceptRedirect(request, |
| 58 network_delegate, | 58 network_delegate, |
| 59 location); | 59 location); |
| 60 } | 60 } |
| 61 | 61 |
| 62 URLRequestJob* URLRequestInterceptingJobFactory::MaybeInterceptResponse( | 62 URLRequestJob* URLRequestInterceptingJobFactory::MaybeInterceptResponse( |
| 63 URLRequest* request, | 63 URLRequest* request, |
| 64 NetworkDelegate* network_delegate) const { | 64 NetworkDelegate* network_delegate) const { |
| 65 DCHECK(CalledOnValidThread()); | 65 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 66 URLRequestJob* job = interceptor_->MaybeInterceptResponse(request, | 66 URLRequestJob* job = interceptor_->MaybeInterceptResponse(request, |
| 67 network_delegate); | 67 network_delegate); |
| 68 if (job) | 68 if (job) |
| 69 return job; | 69 return job; |
| 70 return job_factory_->MaybeInterceptResponse(request, | 70 return job_factory_->MaybeInterceptResponse(request, |
| 71 network_delegate); | 71 network_delegate); |
| 72 } | 72 } |
| 73 | 73 |
| 74 bool URLRequestInterceptingJobFactory::IsHandledProtocol( | 74 bool URLRequestInterceptingJobFactory::IsHandledProtocol( |
| 75 const std::string& scheme) const { | 75 const std::string& scheme) const { |
| 76 return job_factory_->IsHandledProtocol(scheme); | 76 return job_factory_->IsHandledProtocol(scheme); |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool URLRequestInterceptingJobFactory::IsSafeRedirectTarget( | 79 bool URLRequestInterceptingJobFactory::IsSafeRedirectTarget( |
| 80 const GURL& location) const { | 80 const GURL& location) const { |
| 81 return job_factory_->IsSafeRedirectTarget(location); | 81 return job_factory_->IsSafeRedirectTarget(location); |
| 82 } | 82 } |
| 83 | 83 |
| 84 } // namespace net | 84 } // namespace net |
| OLD | NEW |