summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorpauljensen@chromium.org <pauljensen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-12 21:22:47 +0000
committerpauljensen@chromium.org <pauljensen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-12 21:22:47 +0000
commitd6545d502892013c1e5723278740f72d2db2f1b2 (patch)
tree623f8de69e70386d07c11c866715413ae676bbcb /net
parentd9e19bf440d639afd0201e0ac13c4bf1f1626ed5 (diff)
downloadchromium_src-d6545d502892013c1e5723278740f72d2db2f1b2.zip
chromium_src-d6545d502892013c1e5723278740f72d2db2f1b2.tar.gz
chromium_src-d6545d502892013c1e5723278740f72d2db2f1b2.tar.bz2
Remove unused pieces of URLRequestJobFactory API.
This is mostly the Interceptor logic which is now unused. Also switch DebugDevToolsInterceptor (the last remaining Interceptor) to a ProtocolHandler. BUG=146602,161529 Review URL: https://chromiumcodereview.appspot.com/12217095 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182016 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/url_request/protocol_intercept_job_factory.cc34
-rw-r--r--net/url_request/protocol_intercept_job_factory.h11
-rw-r--r--net/url_request/url_request.h17
-rw-r--r--net/url_request/url_request_job_factory.cc7
-rw-r--r--net/url_request/url_request_job_factory.h64
-rw-r--r--net/url_request/url_request_job_factory_impl.cc63
-rw-r--r--net/url_request/url_request_job_factory_impl.h21
-rw-r--r--net/url_request/url_request_job_factory_impl_unittest.cc123
-rw-r--r--net/url_request/url_request_job_manager.cc30
9 files changed, 18 insertions, 352 deletions
diff --git a/net/url_request/protocol_intercept_job_factory.cc b/net/url_request/protocol_intercept_job_factory.cc
index 1a1a95f..f72fbf9 100644
--- a/net/url_request/protocol_intercept_job_factory.cc
+++ b/net/url_request/protocol_intercept_job_factory.cc
@@ -4,12 +4,7 @@
#include "net/url_request/protocol_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;
+#include "base/logging.h"
namespace net {
@@ -22,20 +17,6 @@ ProtocolInterceptJobFactory::ProtocolInterceptJobFactory(
ProtocolInterceptJobFactory::~ProtocolInterceptJobFactory() {}
-bool ProtocolInterceptJobFactory::SetProtocolHandler(
- const std::string& scheme, ProtocolHandler* protocol_handler) {
- return job_factory_->SetProtocolHandler(scheme, protocol_handler);
-}
-
-void ProtocolInterceptJobFactory::AddInterceptor(Interceptor* interceptor) {
- return job_factory_->AddInterceptor(interceptor);
-}
-
-URLRequestJob* ProtocolInterceptJobFactory::MaybeCreateJobWithInterceptor(
- URLRequest* request, NetworkDelegate* network_delegate) const {
- return job_factory_->MaybeCreateJobWithInterceptor(request, network_delegate);
-}
-
URLRequestJob* ProtocolInterceptJobFactory::MaybeCreateJobWithProtocolHandler(
const std::string& scheme,
URLRequest* request,
@@ -49,19 +30,6 @@ URLRequestJob* ProtocolInterceptJobFactory::MaybeCreateJobWithProtocolHandler(
scheme, request, network_delegate);
}
-URLRequestJob* ProtocolInterceptJobFactory::MaybeInterceptRedirect(
- const GURL& location,
- URLRequest* request,
- NetworkDelegate* network_delegate) const {
- return job_factory_->MaybeInterceptRedirect(
- location, request, network_delegate);
-}
-
-URLRequestJob* ProtocolInterceptJobFactory::MaybeInterceptResponse(
- URLRequest* request, NetworkDelegate* network_delegate) const {
- return job_factory_->MaybeInterceptResponse(request, network_delegate);
-}
-
bool ProtocolInterceptJobFactory::IsHandledProtocol(
const std::string& scheme) const {
return job_factory_->IsHandledProtocol(scheme);
diff --git a/net/url_request/protocol_intercept_job_factory.h b/net/url_request/protocol_intercept_job_factory.h
index 13bfc1c..7deeb30 100644
--- a/net/url_request/protocol_intercept_job_factory.h
+++ b/net/url_request/protocol_intercept_job_factory.h
@@ -29,21 +29,10 @@ class NET_EXPORT ProtocolInterceptJobFactory : public URLRequestJobFactory {
virtual ~ProtocolInterceptJobFactory();
// URLRequestJobFactory implementation
- virtual bool SetProtocolHandler(const std::string& scheme,
- ProtocolHandler* protocol_handler) OVERRIDE;
- virtual void AddInterceptor(Interceptor* interceptor) OVERRIDE;
- virtual URLRequestJob* MaybeCreateJobWithInterceptor(
- URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE;
virtual URLRequestJob* MaybeCreateJobWithProtocolHandler(
const std::string& scheme,
URLRequest* request,
NetworkDelegate* network_delegate) const OVERRIDE;
- virtual URLRequestJob* MaybeInterceptRedirect(
- const GURL& location,
- URLRequest* request,
- NetworkDelegate* network_delegate) const OVERRIDE;
- virtual URLRequestJob* MaybeInterceptResponse(
- URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE;
virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE;
virtual bool IsHandledURL(const GURL& url) const OVERRIDE;
diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h
index 3c1c2d52..5580b63 100644
--- a/net/url_request/url_request.h
+++ b/net/url_request/url_request.h
@@ -33,7 +33,6 @@
// Temporary layering violation to allow existing users of a deprecated
// interface.
class ChildProcessSecurityPolicyTest;
-class ComponentUpdateInterceptor;
class TestAutomationProvider;
class URLRequestAutomationJob;
@@ -59,13 +58,6 @@ class ResourceDispatcherHostTest;
// Temporary layering violation to allow existing users of a deprecated
// interface.
-namespace extensions {
-class AutoUpdateInterceptor;
-class UserScriptListenerTest;
-}
-
-// Temporary layering violation to allow existing users of a deprecated
-// interface.
namespace fileapi {
class FileSystemDirURLRequestJobTest;
class FileSystemURLRequestJobTest;
@@ -74,12 +66,6 @@ class FileWriterDelegateTest;
// Temporary layering violation to allow existing users of a deprecated
// interface.
-namespace policy {
-class CannedResponseInterceptor;
-}
-
-// Temporary layering violation to allow existing users of a deprecated
-// interface.
namespace webkit_blob {
class BlobURLRequestJobTest;
}
@@ -206,7 +192,8 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe),
static ProtocolFactory* RegisterProtocolFactory(const std::string& scheme,
ProtocolFactory* factory);
- // Use URLRequestJobFactory::Interceptor instead.
+ // TODO(pauljensen): Remove this when AppCacheInterceptor is a
+ // ProtocolHandler, see crbug.com/161547.
static void RegisterRequestInterceptor(Interceptor* interceptor);
static void UnregisterRequestInterceptor(Interceptor* interceptor);
diff --git a/net/url_request/url_request_job_factory.cc b/net/url_request/url_request_job_factory.cc
index e07152a..c1f070b 100644
--- a/net/url_request/url_request_job_factory.cc
+++ b/net/url_request/url_request_job_factory.cc
@@ -8,13 +8,6 @@ namespace net {
URLRequestJobFactory::ProtocolHandler::~ProtocolHandler() {}
-URLRequestJobFactory::Interceptor::~Interceptor() {}
-
-bool URLRequestJobFactory::Interceptor::WillHandleProtocol(
- const std::string& protocol) const {
- return false;
-}
-
URLRequestJobFactory::URLRequestJobFactory() {}
URLRequestJobFactory::~URLRequestJobFactory() {}
diff --git a/net/url_request/url_request_job_factory.h b/net/url_request/url_request_job_factory.h
index adff7f1..bbd1d09 100644
--- a/net/url_request/url_request_job_factory.h
+++ b/net/url_request/url_request_job_factory.h
@@ -32,78 +32,14 @@ class NET_EXPORT URLRequestJobFactory
URLRequest* request, NetworkDelegate* network_delegate) const = 0;
};
- // TODO(shalev): Move this to URLRequestJobFactoryImpl.
- class NET_EXPORT Interceptor {
- public:
- virtual ~Interceptor();
-
- // Called for every request made. Should return a new job to handle the
- // request if it should be intercepted, or NULL to allow the request to
- // be handled in the normal manner.
- virtual URLRequestJob* MaybeIntercept(
- URLRequest* request, NetworkDelegate* network_delegate) const = 0;
-
- // Called after having received a redirect response, but prior to the
- // the request delegate being informed of the redirect. Can return a new
- // job to replace the existing job if it should be intercepted, or NULL
- // to allow the normal handling to continue. If a new job is provided,
- // the delegate never sees the original redirect response, instead the
- // response produced by the intercept job will be returned.
- virtual URLRequestJob* MaybeInterceptRedirect(
- const GURL& location,
- URLRequest* request,
- NetworkDelegate* network_delegate) const = 0;
-
- // Called after having received a final response, but prior to the
- // the request delegate being informed of the response. This is also
- // called when there is no server response at all to allow interception
- // on DNS or network errors. Can return a new job to replace the existing
- // job if it should be intercepted, or NULL to allow the normal handling to
- // continue. If a new job is provided, the delegate never sees the original
- // response, instead the response produced by the intercept job will be
- // returned.
- virtual URLRequestJob* MaybeInterceptResponse(
- URLRequest* request, NetworkDelegate* network_delegate) const = 0;
-
- // Returns true if this interceptor handles requests for URLs with the
- // given protocol. Returning false does not imply that this interceptor
- // can't or won't handle requests with the given protocol.
- virtual bool WillHandleProtocol(const std::string& protocol) const;
- };
-
URLRequestJobFactory();
virtual ~URLRequestJobFactory();
- // TODO(shalev): Remove this from the interface.
- // Sets the ProtocolHandler for a scheme. Returns true on success, false on
- // failure (a ProtocolHandler already exists for |scheme|). On success,
- // URLRequestJobFactory takes ownership of |protocol_handler|.
- virtual bool SetProtocolHandler(const std::string& scheme,
- ProtocolHandler* protocol_handler) = 0;
-
- // TODO(shalev): Remove this from the interface.
- // Takes ownership of |interceptor|. Adds it to the end of the Interceptor
- // list.
- virtual void AddInterceptor(Interceptor* interceptor) = 0;
-
- // TODO(shalev): Consolidate MaybeCreateJobWithInterceptor and
- // MaybeCreateJobWithProtocolHandler into a single method.
- virtual URLRequestJob* MaybeCreateJobWithInterceptor(
- URLRequest* request, NetworkDelegate* network_delegate) const = 0;
-
virtual URLRequestJob* MaybeCreateJobWithProtocolHandler(
const std::string& scheme,
URLRequest* request,
NetworkDelegate* network_delegate) const = 0;
- virtual URLRequestJob* MaybeInterceptRedirect(
- const GURL& location,
- URLRequest* request,
- NetworkDelegate* network_delegate) const = 0;
-
- virtual URLRequestJob* MaybeInterceptResponse(
- URLRequest* request, NetworkDelegate* network_delegate) const = 0;
-
virtual bool IsHandledProtocol(const std::string& scheme) const = 0;
virtual bool IsHandledURL(const GURL& url) const = 0;
diff --git a/net/url_request/url_request_job_factory_impl.cc b/net/url_request/url_request_job_factory_impl.cc
index aaeed79..f4c1d01 100644
--- a/net/url_request/url_request_job_factory_impl.cc
+++ b/net/url_request/url_request_job_factory_impl.cc
@@ -15,7 +15,6 @@ URLRequestJobFactoryImpl::URLRequestJobFactoryImpl() {}
URLRequestJobFactoryImpl::~URLRequestJobFactoryImpl() {
STLDeleteValues(&protocol_handler_map_);
- STLDeleteElements(&interceptors_);
}
bool URLRequestJobFactoryImpl::SetProtocolHandler(
@@ -39,29 +38,6 @@ bool URLRequestJobFactoryImpl::SetProtocolHandler(
return true;
}
-void URLRequestJobFactoryImpl::AddInterceptor(Interceptor* interceptor) {
- DCHECK(CalledOnValidThread());
- CHECK(interceptor);
-
- interceptors_.push_back(interceptor);
-}
-
-URLRequestJob* URLRequestJobFactoryImpl::MaybeCreateJobWithInterceptor(
- URLRequest* request, NetworkDelegate* network_delegate) const {
- DCHECK(CalledOnValidThread());
- URLRequestJob* job = NULL;
-
- if (!(request->load_flags() & LOAD_DISABLE_INTERCEPT)) {
- InterceptorList::const_iterator i;
- for (i = interceptors_.begin(); i != interceptors_.end(); ++i) {
- job = (*i)->MaybeIntercept(request, network_delegate);
- if (job)
- return job;
- }
- }
- return NULL;
-}
-
URLRequestJob* URLRequestJobFactoryImpl::MaybeCreateJobWithProtocolHandler(
const std::string& scheme,
URLRequest* request,
@@ -73,48 +49,9 @@ URLRequestJob* URLRequestJobFactoryImpl::MaybeCreateJobWithProtocolHandler(
return it->second->MaybeCreateJob(request, network_delegate);
}
-URLRequestJob* URLRequestJobFactoryImpl::MaybeInterceptRedirect(
- const GURL& location,
- URLRequest* request,
- NetworkDelegate* network_delegate) const {
- DCHECK(CalledOnValidThread());
- URLRequestJob* job = NULL;
-
- if (!(request->load_flags() & LOAD_DISABLE_INTERCEPT)) {
- InterceptorList::const_iterator i;
- for (i = interceptors_.begin(); i != interceptors_.end(); ++i) {
- job = (*i)->MaybeInterceptRedirect(location, request, network_delegate);
- if (job)
- return job;
- }
- }
- return NULL;
-}
-
-URLRequestJob* URLRequestJobFactoryImpl::MaybeInterceptResponse(
- URLRequest* request, NetworkDelegate* network_delegate) const {
- DCHECK(CalledOnValidThread());
- URLRequestJob* job = NULL;
-
- if (!(request->load_flags() & LOAD_DISABLE_INTERCEPT)) {
- InterceptorList::const_iterator i;
- for (i = interceptors_.begin(); i != interceptors_.end(); ++i) {
- job = (*i)->MaybeInterceptResponse(request, network_delegate);
- if (job)
- return job;
- }
- }
- return NULL;
-}
-
bool URLRequestJobFactoryImpl::IsHandledProtocol(
const std::string& scheme) const {
DCHECK(CalledOnValidThread());
- InterceptorList::const_iterator i;
- for (i = interceptors_.begin(); i != interceptors_.end(); ++i) {
- if ((*i)->WillHandleProtocol(scheme))
- return true;
- }
return ContainsKey(protocol_handler_map_, scheme) ||
URLRequestJobManager::GetInstance()->SupportsScheme(scheme);
}
diff --git a/net/url_request/url_request_job_factory_impl.h b/net/url_request/url_request_job_factory_impl.h
index ff27185..8f394e2 100644
--- a/net/url_request/url_request_job_factory_impl.h
+++ b/net/url_request/url_request_job_factory_impl.h
@@ -7,7 +7,9 @@
#include <map>
#include <vector>
+
#include "base/basictypes.h"
+#include "base/compiler_specific.h"
#include "net/base/net_export.h"
#include "net/url_request/url_request_job_factory.h"
@@ -18,31 +20,24 @@ class NET_EXPORT URLRequestJobFactoryImpl : public URLRequestJobFactory {
URLRequestJobFactoryImpl();
virtual ~URLRequestJobFactoryImpl();
+ // Sets the ProtocolHandler for a scheme. Returns true on success, false on
+ // failure (a ProtocolHandler already exists for |scheme|). On success,
+ // URLRequestJobFactory takes ownership of |protocol_handler|.
+ bool SetProtocolHandler(const std::string& scheme,
+ ProtocolHandler* protocol_handler);
+
// URLRequestJobFactory implementation
- virtual bool SetProtocolHandler(const std::string& scheme,
- ProtocolHandler* protocol_handler) OVERRIDE;
- virtual void AddInterceptor(Interceptor* interceptor) OVERRIDE;
- virtual URLRequestJob* MaybeCreateJobWithInterceptor(
- URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE;
virtual URLRequestJob* MaybeCreateJobWithProtocolHandler(
const std::string& scheme,
URLRequest* request,
NetworkDelegate* network_delegate) const OVERRIDE;
- virtual URLRequestJob* MaybeInterceptRedirect(
- const GURL& location,
- URLRequest* request,
- NetworkDelegate* network_delegate) const OVERRIDE;
- virtual URLRequestJob* MaybeInterceptResponse(
- URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE;
virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE;
virtual bool IsHandledURL(const GURL& url) const OVERRIDE;
private:
typedef std::map<std::string, ProtocolHandler*> ProtocolHandlerMap;
- typedef std::vector<Interceptor*> InterceptorList;
ProtocolHandlerMap protocol_handler_map_;
- InterceptorList interceptors_;
DISALLOW_COPY_AND_ASSIGN(URLRequestJobFactoryImpl);
};
diff --git a/net/url_request/url_request_job_factory_impl_unittest.cc b/net/url_request/url_request_job_factory_impl_unittest.cc
index 232b21a..5f0e16c 100644
--- a/net/url_request/url_request_job_factory_impl_unittest.cc
+++ b/net/url_request/url_request_job_factory_impl_unittest.cc
@@ -57,44 +57,6 @@ class DummyProtocolHandler : public URLRequestJobFactory::ProtocolHandler {
}
};
-class DummyInterceptor : public URLRequestJobFactory::Interceptor {
- public:
- DummyInterceptor()
- : did_intercept_(false),
- handle_all_protocols_(false) {
- }
-
- virtual URLRequestJob* MaybeIntercept(
- URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE {
- did_intercept_ = true;
- return new MockURLRequestJob(
- request,
- network_delegate,
- URLRequestStatus(URLRequestStatus::FAILED, ERR_FAILED));
- }
-
- virtual URLRequestJob* MaybeInterceptRedirect(
- const GURL& /* location */,
- URLRequest* /* request */,
- NetworkDelegate* network_delegate /* network delegate */) const OVERRIDE {
- return NULL;
- }
-
- virtual URLRequestJob* MaybeInterceptResponse(
- URLRequest* /* request */,
- NetworkDelegate* network_delegate /* network delegate */) const OVERRIDE {
- return NULL;
- }
-
- virtual bool WillHandleProtocol(
- const std::string& /* protocol */) const OVERRIDE {
- return handle_all_protocols_;
- }
-
- mutable bool did_intercept_;
- mutable bool handle_all_protocols_;
-};
-
TEST(URLRequestJobFactoryTest, NoProtocolHandler) {
TestDelegate delegate;
TestURLRequestContext request_context;
@@ -128,91 +90,6 @@ TEST(URLRequestJobFactoryTest, DeleteProtocolHandler) {
job_factory.SetProtocolHandler("foo", NULL);
}
-TEST(URLRequestJobFactoryTest, BasicInterceptor) {
- TestDelegate delegate;
- URLRequestJobFactoryImpl job_factory;
- TestURLRequestContext request_context;
- request_context.set_job_factory(&job_factory);
- job_factory.AddInterceptor(new DummyInterceptor);
- TestURLRequest request(GURL("http://bar"), &delegate, &request_context);
- request.Start();
-
- MessageLoop::current()->Run();
- EXPECT_EQ(URLRequestStatus::FAILED, request.status().status());
- EXPECT_EQ(ERR_FAILED, request.status().error());
-}
-
-TEST(URLRequestJobFactoryTest, InterceptorNeedsValidSchemeStill) {
- TestDelegate delegate;
- URLRequestJobFactoryImpl job_factory;
- TestURLRequestContext request_context;
- request_context.set_job_factory(&job_factory);
- job_factory.AddInterceptor(new DummyInterceptor);
- TestURLRequest request(GURL("foo://bar"), &delegate, &request_context);
- request.Start();
-
- MessageLoop::current()->Run();
- EXPECT_EQ(URLRequestStatus::FAILED, request.status().status());
- EXPECT_EQ(ERR_UNKNOWN_URL_SCHEME, request.status().error());
-}
-
-TEST(URLRequestJobFactoryTest, InterceptorOverridesProtocolHandler) {
- TestDelegate delegate;
- URLRequestJobFactoryImpl job_factory;
- TestURLRequestContext request_context;
- request_context.set_job_factory(&job_factory);
- job_factory.SetProtocolHandler("foo", new DummyProtocolHandler);
- job_factory.AddInterceptor(new DummyInterceptor);
- TestURLRequest request(GURL("foo://bar"), &delegate, &request_context);
- request.Start();
-
- MessageLoop::current()->Run();
- EXPECT_EQ(URLRequestStatus::FAILED, request.status().status());
- EXPECT_EQ(ERR_FAILED, request.status().error());
-}
-
-TEST(URLRequestJobFactoryTest, InterceptorDoesntInterceptUnknownProtocols) {
- TestDelegate delegate;
- URLRequestJobFactoryImpl job_factory;
- TestURLRequestContext request_context;
- request_context.set_job_factory(&job_factory);
- DummyInterceptor* interceptor = new DummyInterceptor;
- job_factory.AddInterceptor(interceptor);
- TestURLRequest request(GURL("foo://bar"), &delegate, &request_context);
- request.Start();
-
- MessageLoop::current()->Run();
- EXPECT_FALSE(interceptor->did_intercept_);
-}
-
-TEST(URLRequestJobFactoryTest, InterceptorInterceptsHandledUnknownProtocols) {
- TestDelegate delegate;
- URLRequestJobFactoryImpl job_factory;
- TestURLRequestContext request_context;
- request_context.set_job_factory(&job_factory);
- DummyInterceptor* interceptor = new DummyInterceptor;
- interceptor->handle_all_protocols_ = true;
- job_factory.AddInterceptor(interceptor);
- TestURLRequest request(GURL("foo://bar"), &delegate, &request_context);
- request.Start();
-
- MessageLoop::current()->Run();
- EXPECT_TRUE(interceptor->did_intercept_);
- EXPECT_EQ(URLRequestStatus::FAILED, request.status().status());
- EXPECT_EQ(ERR_FAILED, request.status().error());
-}
-
-TEST(URLRequestJobFactoryTest, InterceptorAffectsIsHandledProtocol) {
- DummyInterceptor* interceptor = new DummyInterceptor;
- URLRequestJobFactoryImpl job_factory;
- job_factory.AddInterceptor(interceptor);
- EXPECT_FALSE(interceptor->WillHandleProtocol("anything"));
- EXPECT_FALSE(job_factory.IsHandledProtocol("anything"));
- interceptor->handle_all_protocols_ = true;
- EXPECT_TRUE(interceptor->WillHandleProtocol("anything"));
- EXPECT_TRUE(job_factory.IsHandledProtocol("anything"));
-}
-
} // namespace
} // namespace net
diff --git a/net/url_request/url_request_job_manager.cc b/net/url_request/url_request_job_manager.cc
index 14f9f5d..283ee0d 100644
--- a/net/url_request/url_request_job_manager.cc
+++ b/net/url_request/url_request_job_manager.cc
@@ -79,14 +79,8 @@ URLRequestJob* URLRequestJobManager::CreateJob(
// See if the request should be intercepted.
//
- if (job_factory) {
- URLRequestJob* job = job_factory->MaybeCreateJobWithInterceptor(
- request, network_delegate);
- if (job)
- return job;
- }
-
- // TODO(willchan): Remove this in favor of URLRequestJobFactory::Interceptor.
+ // TODO(pauljensen): Remove this when AppCacheInterceptor is a
+ // ProtocolHandler, see crbug.com/161547.
if (!(request->load_flags() & LOAD_DISABLE_INTERCEPT)) {
InterceptorList::const_iterator i;
for (i = interceptors_.begin(); i != interceptors_.end(); ++i) {
@@ -155,16 +149,11 @@ URLRequestJob* URLRequestJobManager::MaybeInterceptRedirect(
return NULL;
}
- URLRequestJob* job = NULL;
- if (job_factory)
- job = job_factory->MaybeInterceptRedirect(
- location, request, network_delegate);
- if (job)
- return job;
-
InterceptorList::const_iterator i;
for (i = interceptors_.begin(); i != interceptors_.end(); ++i) {
- job = (*i)->MaybeInterceptRedirect(request, network_delegate, location);
+ URLRequestJob* job = (*i)->MaybeInterceptRedirect(request,
+ network_delegate,
+ location);
if (job)
return job;
}
@@ -192,15 +181,10 @@ URLRequestJob* URLRequestJobManager::MaybeInterceptResponse(
return NULL;
}
- URLRequestJob* job = NULL;
- if (job_factory)
- job = job_factory->MaybeInterceptResponse(request, network_delegate);
- if (job)
- return job;
-
InterceptorList::const_iterator i;
for (i = interceptors_.begin(); i != interceptors_.end(); ++i) {
- job = (*i)->MaybeInterceptResponse(request, network_delegate);
+ URLRequestJob* job = (*i)->MaybeInterceptResponse(request,
+ network_delegate);
if (job)
return job;
}