OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/url_request_job_manager.h" | 5 #include "net/url_request/url_request_job_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 return NULL; | 121 return NULL; |
122 | 122 |
123 InterceptorList::const_iterator i; | 123 InterceptorList::const_iterator i; |
124 for (i = interceptors_.begin(); i != interceptors_.end(); ++i) { | 124 for (i = interceptors_.begin(); i != interceptors_.end(); ++i) { |
125 URLRequestJob* job = (*i)->MaybeInterceptRedirect(request, | 125 URLRequestJob* job = (*i)->MaybeInterceptRedirect(request, |
126 network_delegate, | 126 network_delegate, |
127 location); | 127 location); |
128 if (job) | 128 if (job) |
129 return job; | 129 return job; |
130 } | 130 } |
131 return NULL; | 131 return request->context()->job_factory()->MaybeInterceptRedirect( |
132 request, network_delegate, location); | |
mmenke
2014/10/30 19:59:24
Ideally, these should ignore the LOAD_DISABLE_INTE
mmenke
2014/10/30 19:59:24
These should go before the old interceptors, for c
bengr
2014/10/31 00:45:31
Acknowledged.
bengr
2014/10/31 00:45:31
Done.
michaeln1
2014/10/31 00:47:10
Consistency with what?
The old URLRequest::Interc
| |
132 } | 133 } |
133 | 134 |
134 URLRequestJob* URLRequestJobManager::MaybeInterceptResponse( | 135 URLRequestJob* URLRequestJobManager::MaybeInterceptResponse( |
135 URLRequest* request, NetworkDelegate* network_delegate) const { | 136 URLRequest* request, NetworkDelegate* network_delegate) const { |
136 DCHECK(IsAllowedThread()); | 137 DCHECK(IsAllowedThread()); |
137 if (!request->url().is_valid() || | 138 if (!request->url().is_valid() || |
138 request->load_flags() & LOAD_DISABLE_INTERCEPT || | 139 request->load_flags() & LOAD_DISABLE_INTERCEPT || |
139 request->status().status() == URLRequestStatus::CANCELED) { | 140 request->status().status() == URLRequestStatus::CANCELED) { |
140 return NULL; | 141 return NULL; |
141 } | 142 } |
142 | 143 |
143 const URLRequestJobFactory* job_factory = NULL; | 144 const URLRequestJobFactory* job_factory = NULL; |
144 job_factory = request->context()->job_factory(); | 145 job_factory = request->context()->job_factory(); |
145 | 146 |
146 const std::string& scheme = request->url().scheme(); // already lowercase | 147 const std::string& scheme = request->url().scheme(); // already lowercase |
147 if (!job_factory->IsHandledProtocol(scheme)) | 148 if (!job_factory->IsHandledProtocol(scheme)) |
148 return NULL; | 149 return NULL; |
149 | 150 |
150 InterceptorList::const_iterator i; | 151 InterceptorList::const_iterator i; |
151 for (i = interceptors_.begin(); i != interceptors_.end(); ++i) { | 152 for (i = interceptors_.begin(); i != interceptors_.end(); ++i) { |
152 URLRequestJob* job = (*i)->MaybeInterceptResponse(request, | 153 URLRequestJob* job = (*i)->MaybeInterceptResponse(request, |
153 network_delegate); | 154 network_delegate); |
154 if (job) | 155 if (job) |
155 return job; | 156 return job; |
156 } | 157 } |
157 return NULL; | 158 return request->context()->job_factory()->MaybeInterceptResponse( |
159 request, network_delegate); | |
158 } | 160 } |
159 | 161 |
160 // static | 162 // static |
161 bool URLRequestJobManager::SupportsScheme(const std::string& scheme) { | 163 bool URLRequestJobManager::SupportsScheme(const std::string& scheme) { |
162 for (size_t i = 0; i < arraysize(kBuiltinFactories); ++i) { | 164 for (size_t i = 0; i < arraysize(kBuiltinFactories); ++i) { |
163 if (LowerCaseEqualsASCII(scheme, kBuiltinFactories[i].scheme)) | 165 if (LowerCaseEqualsASCII(scheme, kBuiltinFactories[i].scheme)) |
164 return true; | 166 return true; |
165 } | 167 } |
166 | 168 |
167 return false; | 169 return false; |
(...skipping 23 matching lines...) Expand all Loading... | |
191 } | 193 } |
192 | 194 |
193 URLRequestJobManager::URLRequestJobManager() | 195 URLRequestJobManager::URLRequestJobManager() |
194 : allowed_thread_(0), | 196 : allowed_thread_(0), |
195 allowed_thread_initialized_(false) { | 197 allowed_thread_initialized_(false) { |
196 } | 198 } |
197 | 199 |
198 URLRequestJobManager::~URLRequestJobManager() {} | 200 URLRequestJobManager::~URLRequestJobManager() {} |
199 | 201 |
200 } // namespace net | 202 } // namespace net |
OLD | NEW |