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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
// Copyright 2014 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/url_request_intercepting_job_factory.h"
#include "base/logging.h"
#include "net/url_request/url_request_interceptor.h"
namespace net {
URLRequestInterceptingJobFactory::URLRequestInterceptingJobFactory(
scoped_ptr<URLRequestJobFactory> job_factory,
scoped_ptr<URLRequestInterceptor> interceptor)
: job_factory_(job_factory.Pass()),
interceptor_(interceptor.Pass()) {
}
URLRequestInterceptingJobFactory::~URLRequestInterceptingJobFactory() {}
URLRequestJob* URLRequestInterceptingJobFactory::
MaybeCreateJobWithProtocolHandler(
const std::string& scheme,
URLRequest* request,
NetworkDelegate* network_delegate) const {
DCHECK(CalledOnValidThread());
URLRequestJob* job = interceptor_->MaybeInterceptRequest(request,
network_delegate);
if (job)
return job;
return job_factory_->MaybeCreateJobWithProtocolHandler(
scheme, request, network_delegate);
}
URLRequestJob* URLRequestInterceptingJobFactory::MaybeInterceptRedirect(
URLRequest* request,
NetworkDelegate* network_delegate,
const GURL& location) const {
DCHECK(CalledOnValidThread());
URLRequestJob* job = interceptor_->MaybeInterceptRedirect(request,
network_delegate,
location);
if (job)
return job;
return job_factory_->MaybeInterceptRedirect(request,
network_delegate,
location);
}
URLRequestJob* URLRequestInterceptingJobFactory::MaybeInterceptResponse(
URLRequest* request,
NetworkDelegate* network_delegate) const {
DCHECK(CalledOnValidThread());
URLRequestJob* job = interceptor_->MaybeInterceptResponse(request,
network_delegate);
if (job)
return job;
return job_factory_->MaybeInterceptResponse(request,
network_delegate);
}
bool URLRequestInterceptingJobFactory::IsHandledProtocol(
const std::string& scheme) const {
return job_factory_->IsHandledProtocol(scheme);
}
bool URLRequestInterceptingJobFactory::IsHandledURL(const GURL& url) const {
return job_factory_->IsHandledURL(url);
}
bool URLRequestInterceptingJobFactory::IsSafeRedirectTarget(
const GURL& location) const {
return job_factory_->IsSafeRedirectTarget(location);
}
} // namespace net
|