OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/protocol_intercept_job_factory.h" | 5 #include "net/url_request/protocol_intercept_job_factory.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
9 #include "net/base/load_flags.h" | 9 #include "net/base/load_flags.h" |
mmenke
2013/02/11 17:19:32
While you're here, looks like none of these 3 incl
| |
10 #include "net/url_request/url_request_job_manager.h" | 10 #include "net/url_request/url_request_job_manager.h" |
11 | 11 |
12 class GURL; | 12 class GURL; |
mmenke
2013/02/11 17:19:32
This forward declaration is in the header.
| |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 ProtocolInterceptJobFactory::ProtocolInterceptJobFactory( | 16 ProtocolInterceptJobFactory::ProtocolInterceptJobFactory( |
17 scoped_ptr<URLRequestJobFactory> job_factory, | 17 scoped_ptr<URLRequestJobFactory> job_factory, |
18 scoped_ptr<ProtocolHandler> protocol_handler) | 18 scoped_ptr<ProtocolHandler> protocol_handler) |
19 : job_factory_(job_factory.Pass()), | 19 : job_factory_(job_factory.Pass()), |
20 protocol_handler_(protocol_handler.Pass()) { | 20 protocol_handler_(protocol_handler.Pass()) { |
21 } | 21 } |
22 | 22 |
23 ProtocolInterceptJobFactory::~ProtocolInterceptJobFactory() {} | 23 ProtocolInterceptJobFactory::~ProtocolInterceptJobFactory() {} |
24 | 24 |
25 bool ProtocolInterceptJobFactory::SetProtocolHandler( | |
26 const std::string& scheme, ProtocolHandler* protocol_handler) { | |
27 return job_factory_->SetProtocolHandler(scheme, protocol_handler); | |
28 } | |
29 | |
30 void ProtocolInterceptJobFactory::AddInterceptor(Interceptor* interceptor) { | |
31 return job_factory_->AddInterceptor(interceptor); | |
32 } | |
33 | |
34 URLRequestJob* ProtocolInterceptJobFactory::MaybeCreateJobWithInterceptor( | |
35 URLRequest* request, NetworkDelegate* network_delegate) const { | |
36 return job_factory_->MaybeCreateJobWithInterceptor(request, network_delegate); | |
37 } | |
38 | |
39 URLRequestJob* ProtocolInterceptJobFactory::MaybeCreateJobWithProtocolHandler( | 25 URLRequestJob* ProtocolInterceptJobFactory::MaybeCreateJobWithProtocolHandler( |
40 const std::string& scheme, | 26 const std::string& scheme, |
41 URLRequest* request, | 27 URLRequest* request, |
42 NetworkDelegate* network_delegate) const { | 28 NetworkDelegate* network_delegate) const { |
43 DCHECK(CalledOnValidThread()); | 29 DCHECK(CalledOnValidThread()); |
44 URLRequestJob* job = protocol_handler_->MaybeCreateJob(request, | 30 URLRequestJob* job = protocol_handler_->MaybeCreateJob(request, |
45 network_delegate); | 31 network_delegate); |
46 if (job) | 32 if (job) |
47 return job; | 33 return job; |
48 return job_factory_->MaybeCreateJobWithProtocolHandler( | 34 return job_factory_->MaybeCreateJobWithProtocolHandler( |
49 scheme, request, network_delegate); | 35 scheme, request, network_delegate); |
50 } | 36 } |
51 | 37 |
52 URLRequestJob* ProtocolInterceptJobFactory::MaybeInterceptRedirect( | |
53 const GURL& location, | |
54 URLRequest* request, | |
55 NetworkDelegate* network_delegate) const { | |
56 return job_factory_->MaybeInterceptRedirect( | |
57 location, request, network_delegate); | |
58 } | |
59 | |
60 URLRequestJob* ProtocolInterceptJobFactory::MaybeInterceptResponse( | |
61 URLRequest* request, NetworkDelegate* network_delegate) const { | |
62 return job_factory_->MaybeInterceptResponse(request, network_delegate); | |
63 } | |
64 | |
65 bool ProtocolInterceptJobFactory::IsHandledProtocol( | 38 bool ProtocolInterceptJobFactory::IsHandledProtocol( |
66 const std::string& scheme) const { | 39 const std::string& scheme) const { |
67 return job_factory_->IsHandledProtocol(scheme); | 40 return job_factory_->IsHandledProtocol(scheme); |
68 } | 41 } |
69 | 42 |
70 bool ProtocolInterceptJobFactory::IsHandledURL(const GURL& url) const { | 43 bool ProtocolInterceptJobFactory::IsHandledURL(const GURL& url) const { |
71 return job_factory_->IsHandledURL(url); | 44 return job_factory_->IsHandledURL(url); |
72 } | 45 } |
73 | 46 |
74 } // namespace net | 47 } // namespace net |
OLD | NEW |