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
3 // found in the LICENSE file.
5 #include "net/url_request/protocol_intercept_job_factory.h"
7 #include "base/logging.h"
11 ProtocolInterceptJobFactory::ProtocolInterceptJobFactory(
12 scoped_ptr
<URLRequestJobFactory
> job_factory
,
13 scoped_ptr
<ProtocolHandler
> protocol_handler
)
14 : job_factory_(job_factory
.Pass()),
15 protocol_handler_(protocol_handler
.Pass()) {
18 ProtocolInterceptJobFactory::~ProtocolInterceptJobFactory() {}
20 URLRequestJob
* ProtocolInterceptJobFactory::MaybeCreateJobWithProtocolHandler(
21 const std::string
& scheme
,
23 NetworkDelegate
* network_delegate
) const {
24 DCHECK(CalledOnValidThread());
25 URLRequestJob
* job
= protocol_handler_
->MaybeCreateJob(request
,
29 return job_factory_
->MaybeCreateJobWithProtocolHandler(
30 scheme
, request
, network_delegate
);
33 bool ProtocolInterceptJobFactory::IsHandledProtocol(
34 const std::string
& scheme
) const {
35 return job_factory_
->IsHandledProtocol(scheme
);
38 bool ProtocolInterceptJobFactory::IsHandledURL(const GURL
& url
) const {
39 return job_factory_
->IsHandledURL(url
);
42 bool ProtocolInterceptJobFactory::IsSafeRedirectTarget(
43 const GURL
& location
) const {
44 return job_factory_
->IsSafeRedirectTarget(location
);