summaryrefslogtreecommitdiffstats
path: root/net/url_request/protocol_intercept_job_factory.cc
blob: d0f92f4bff376c1c7a26cacdb92ab0cca31b16be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/url_request/protocol_intercept_job_factory.h"

#include "base/logging.h"

namespace net {

ProtocolInterceptJobFactory::ProtocolInterceptJobFactory(
    scoped_ptr<URLRequestJobFactory> job_factory,
    scoped_ptr<ProtocolHandler> protocol_handler)
    : job_factory_(job_factory.Pass()),
      protocol_handler_(protocol_handler.Pass()) {
}

ProtocolInterceptJobFactory::~ProtocolInterceptJobFactory() {}

URLRequestJob* ProtocolInterceptJobFactory::MaybeCreateJobWithProtocolHandler(
    const std::string& scheme,
    URLRequest* request,
    NetworkDelegate* network_delegate) const {
  DCHECK(CalledOnValidThread());
  URLRequestJob* job = protocol_handler_->MaybeCreateJob(request,
                                                         network_delegate);
  if (job)
    return job;
  return job_factory_->MaybeCreateJobWithProtocolHandler(
      scheme, request, network_delegate);
}

bool ProtocolInterceptJobFactory::IsHandledProtocol(
    const std::string& scheme) const {
  return job_factory_->IsHandledProtocol(scheme);
}

bool ProtocolInterceptJobFactory::IsHandledURL(const GURL& url) const {
  return job_factory_->IsHandledURL(url);
}

bool ProtocolInterceptJobFactory::IsSafeRedirectTarget(
    const GURL& location) const {
  return job_factory_->IsSafeRedirectTarget(location);
}

}  // namespace net