Update V8 to version 4.6.55.
[chromium-blink-merge.git] / net / url_request / url_request_intercepting_job_factory.cc
blobea2d1f29d09970b6a3899a112b99205b3df9a218
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
3 // found in the LICENSE file.
5 #include "net/url_request/url_request_intercepting_job_factory.h"
7 #include "base/logging.h"
8 #include "net/url_request/url_request_interceptor.h"
10 namespace net {
12 URLRequestInterceptingJobFactory::URLRequestInterceptingJobFactory(
13 scoped_ptr<URLRequestJobFactory> job_factory,
14 scoped_ptr<URLRequestInterceptor> interceptor)
15 : job_factory_(job_factory.Pass()),
16 interceptor_(interceptor.Pass()) {
19 URLRequestInterceptingJobFactory::~URLRequestInterceptingJobFactory() {}
21 URLRequestJob* URLRequestInterceptingJobFactory::
22 MaybeCreateJobWithProtocolHandler(
23 const std::string& scheme,
24 URLRequest* request,
25 NetworkDelegate* network_delegate) const {
26 DCHECK(CalledOnValidThread());
27 URLRequestJob* job = interceptor_->MaybeInterceptRequest(request,
28 network_delegate);
29 if (job)
30 return job;
31 return job_factory_->MaybeCreateJobWithProtocolHandler(
32 scheme, request, network_delegate);
35 URLRequestJob* URLRequestInterceptingJobFactory::MaybeInterceptRedirect(
36 URLRequest* request,
37 NetworkDelegate* network_delegate,
38 const GURL& location) const {
39 DCHECK(CalledOnValidThread());
40 URLRequestJob* job = interceptor_->MaybeInterceptRedirect(request,
41 network_delegate,
42 location);
43 if (job)
44 return job;
45 return job_factory_->MaybeInterceptRedirect(request,
46 network_delegate,
47 location);
50 URLRequestJob* URLRequestInterceptingJobFactory::MaybeInterceptResponse(
51 URLRequest* request,
52 NetworkDelegate* network_delegate) const {
53 DCHECK(CalledOnValidThread());
54 URLRequestJob* job = interceptor_->MaybeInterceptResponse(request,
55 network_delegate);
56 if (job)
57 return job;
58 return job_factory_->MaybeInterceptResponse(request,
59 network_delegate);
62 bool URLRequestInterceptingJobFactory::IsHandledProtocol(
63 const std::string& scheme) const {
64 return job_factory_->IsHandledProtocol(scheme);
67 bool URLRequestInterceptingJobFactory::IsHandledURL(const GURL& url) const {
68 return job_factory_->IsHandledURL(url);
71 bool URLRequestInterceptingJobFactory::IsSafeRedirectTarget(
72 const GURL& location) const {
73 return job_factory_->IsSafeRedirectTarget(location);
76 } // namespace net