| Index: net/url_request/url_request_job_manager.cc
|
| diff --git a/net/url_request/url_request_job_manager.cc b/net/url_request/url_request_job_manager.cc
|
| index dc6af79e909a1ab9055685dc13fc44481c4eb02f..71e9e55158232f9f83a98886433a72f75c7d462e 100644
|
| --- a/net/url_request/url_request_job_manager.cc
|
| +++ b/net/url_request/url_request_job_manager.cc
|
| @@ -49,9 +49,7 @@ URLRequestJobManager* URLRequestJobManager::GetInstance() {
|
|
|
| URLRequestJob* URLRequestJobManager::CreateJob(
|
| URLRequest* request) const {
|
| -#ifndef NDEBUG
|
| DCHECK(IsAllowedThread());
|
| -#endif
|
|
|
| // If we are given an invalid URL, then don't even try to inspect the scheme.
|
| if (!request->url().is_valid())
|
| @@ -132,18 +130,35 @@ URLRequestJob* URLRequestJobManager::CreateJob(
|
| URLRequestJob* URLRequestJobManager::MaybeInterceptRedirect(
|
| URLRequest* request,
|
| const GURL& location) const {
|
| -#ifndef NDEBUG
|
| DCHECK(IsAllowedThread());
|
| -#endif
|
| - if ((request->load_flags() & LOAD_DISABLE_INTERCEPT) ||
|
| - (request->status().status() == URLRequestStatus::CANCELED) ||
|
| - !request->url().is_valid() ||
|
| - !SupportsScheme(request->url().scheme()))
|
| + if (!request->url().is_valid() ||
|
| + request->load_flags() & LOAD_DISABLE_INTERCEPT ||
|
| + request->status().status() == URLRequestStatus::CANCELED) {
|
| + return NULL;
|
| + }
|
| +
|
| + const URLRequestJobFactory* job_factory = NULL;
|
| + if (request->context())
|
| + job_factory = request->context()->job_factory();
|
| +
|
| + const std::string& scheme = request->url().scheme(); // already lowercase
|
| + if (job_factory) {
|
| + if (!job_factory->IsHandledProtocol(scheme)) {
|
| + return NULL;
|
| + }
|
| + } else if (!SupportsScheme(scheme)) {
|
| return NULL;
|
| + }
|
| +
|
| + URLRequestJob* job = NULL;
|
| + if (job_factory)
|
| + job = job_factory->MaybeInterceptRedirect(location, request);
|
| + if (job)
|
| + return job;
|
|
|
| InterceptorList::const_iterator i;
|
| for (i = interceptors_.begin(); i != interceptors_.end(); ++i) {
|
| - URLRequestJob* job = (*i)->MaybeInterceptRedirect(request, location);
|
| + job = (*i)->MaybeInterceptRedirect(request, location);
|
| if (job)
|
| return job;
|
| }
|
| @@ -152,18 +167,35 @@ URLRequestJob* URLRequestJobManager::MaybeInterceptRedirect(
|
|
|
| URLRequestJob* URLRequestJobManager::MaybeInterceptResponse(
|
| URLRequest* request) const {
|
| -#ifndef NDEBUG
|
| DCHECK(IsAllowedThread());
|
| -#endif
|
| - if ((request->load_flags() & LOAD_DISABLE_INTERCEPT) ||
|
| - (request->status().status() == URLRequestStatus::CANCELED) ||
|
| - !request->url().is_valid() ||
|
| - !SupportsScheme(request->url().scheme()))
|
| + if (!request->url().is_valid() ||
|
| + request->load_flags() & LOAD_DISABLE_INTERCEPT ||
|
| + request->status().status() == URLRequestStatus::CANCELED) {
|
| return NULL;
|
| + }
|
| +
|
| + const URLRequestJobFactory* job_factory = NULL;
|
| + if (request->context())
|
| + job_factory = request->context()->job_factory();
|
| +
|
| + const std::string& scheme = request->url().scheme(); // already lowercase
|
| + if (job_factory) {
|
| + if (!job_factory->IsHandledProtocol(scheme)) {
|
| + return NULL;
|
| + }
|
| + } else if (!SupportsScheme(scheme)) {
|
| + return NULL;
|
| + }
|
| +
|
| + URLRequestJob* job = NULL;
|
| + if (job_factory)
|
| + job = job_factory->MaybeInterceptResponse(request);
|
| + if (job)
|
| + return job;
|
|
|
| InterceptorList::const_iterator i;
|
| for (i = interceptors_.begin(); i != interceptors_.end(); ++i) {
|
| - URLRequestJob* job = (*i)->MaybeInterceptResponse(request);
|
| + job = (*i)->MaybeInterceptResponse(request);
|
| if (job)
|
| return job;
|
| }
|
| @@ -188,9 +220,7 @@ bool URLRequestJobManager::SupportsScheme(const std::string& scheme) const {
|
| URLRequest::ProtocolFactory* URLRequestJobManager::RegisterProtocolFactory(
|
| const std::string& scheme,
|
| URLRequest::ProtocolFactory* factory) {
|
| -#ifndef NDEBUG
|
| DCHECK(IsAllowedThread());
|
| -#endif
|
|
|
| base::AutoLock locked(lock_);
|
|
|
| @@ -211,9 +241,7 @@ URLRequest::ProtocolFactory* URLRequestJobManager::RegisterProtocolFactory(
|
|
|
| void URLRequestJobManager::RegisterRequestInterceptor(
|
| URLRequest::Interceptor* interceptor) {
|
| -#ifndef NDEBUG
|
| DCHECK(IsAllowedThread());
|
| -#endif
|
|
|
| base::AutoLock locked(lock_);
|
|
|
| @@ -224,9 +252,7 @@ void URLRequestJobManager::RegisterRequestInterceptor(
|
|
|
| void URLRequestJobManager::UnregisterRequestInterceptor(
|
| URLRequest::Interceptor* interceptor) {
|
| -#ifndef NDEBUG
|
| DCHECK(IsAllowedThread());
|
| -#endif
|
|
|
| base::AutoLock locked(lock_);
|
|
|
|
|