Chromium Code Reviews| Index: net/url_request/http_intercept_job_factory.cc |
| diff --git a/net/url_request/http_intercept_job_factory.cc b/net/url_request/http_intercept_job_factory.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..83aed9852af81423ce5f54435171fc9ed8c034dd |
| --- /dev/null |
| +++ b/net/url_request/http_intercept_job_factory.cc |
| @@ -0,0 +1,72 @@ |
| +// 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/http_intercept_job_factory.h" |
| + |
| +#include "base/stl_util.h" |
| +#include "googleurl/src/gurl.h" |
| +#include "net/base/load_flags.h" |
| +#include "net/url_request/url_request_job_manager.h" |
| + |
| +class GURL; |
| + |
| +namespace net { |
| + |
| +HttpInterceptJobFactory::HttpInterceptJobFactory( |
| + const URLRequestJobFactory* job_factory, |
| + ProtocolHandler* protocol_handler) |
| + : job_factory_(job_factory), |
| + protocol_handler_(protocol_handler) { |
| +} |
| + |
| +HttpInterceptJobFactory::~HttpInterceptJobFactory() {} |
| + |
| +bool HttpInterceptJobFactory::SetProtocolHandler( |
| + const std::string& scheme, ProtocolHandler* protocol_handler) { |
| + return false; |
| +} |
| + |
| +void HttpInterceptJobFactory::AddInterceptor(Interceptor* interceptor) { |
| + // Interceptor addition is not allowed. |
| + DCHECK(false); |
|
erikwright (departed)
2012/08/16 15:49:01
NOTREACHED()
shalev
2012/08/16 18:40:39
Done.
|
| +} |
| + |
| +URLRequestJob* HttpInterceptJobFactory::MaybeCreateJobWithInterceptor( |
| + URLRequest* request) const { |
| + return job_factory_->MaybeCreateJobWithInterceptor(request); |
| +} |
| + |
| +URLRequestJob* HttpInterceptJobFactory::MaybeCreateJobWithProtocolHandler( |
| + const std::string& scheme, URLRequest* request) const { |
| + DCHECK(CalledOnValidThread()); |
| + if (scheme == "http" || scheme == "https") |
|
erikwright (departed)
2012/08/16 15:49:01
constants for http/https?
shalev
2012/08/16 18:40:39
I can't use the constant chrome::kHttpScheme becau
|
| + return protocol_handler_->MaybeCreateJob(request); |
| + return job_factory_->MaybeCreateJobWithProtocolHandler(scheme, request); |
| +} |
| + |
| +URLRequestJob* HttpInterceptJobFactory::MaybeInterceptRedirect( |
| + const GURL& location, URLRequest* request) const { |
| + return job_factory_->MaybeInterceptRedirect(location, request); |
| +} |
| + |
| +URLRequestJob* HttpInterceptJobFactory::MaybeInterceptResponse( |
| + URLRequest* request) const { |
| + return job_factory_->MaybeInterceptResponse(request); |
| +} |
| + |
| +bool HttpInterceptJobFactory::IsHandledProtocol( |
| + const std::string& scheme) const { |
| + DCHECK(CalledOnValidThread()); |
| + if (scheme == "http" || scheme == "https") |
|
erikwright (departed)
2012/08/16 15:49:01
constants
shalev
2012/08/16 18:40:39
Done.
|
| + return true; |
| + return job_factory_->IsHandledProtocol(scheme); |
| +} |
| + |
| +bool HttpInterceptJobFactory::IsHandledURL(const GURL& url) const { |
| + if (url.scheme() == "http" || url.scheme() == "https") |
|
erikwright (departed)
2012/08/16 15:49:01
constants
shalev
2012/08/16 18:40:39
Done.
|
| + return true; |
| + return job_factory_->IsHandledURL(url); |
| +} |
| + |
| +} // namespace net |