diff options
author | shalev@chromium.org <shalev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-24 01:06:58 +0000 |
---|---|---|
committer | shalev@chromium.org <shalev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-24 01:06:58 +0000 |
commit | 9f170464e1ab4f1f75802a391db76408bc8998f2 (patch) | |
tree | 50ecf1c9c893ab12c59ee653d57732572128b7ed /chrome/browser/custom_handlers | |
parent | 3dc4019ef862889073cf16e875050a512e93aa3a (diff) | |
download | chromium_src-9f170464e1ab4f1f75802a391db76408bc8998f2.zip chromium_src-9f170464e1ab4f1f75802a391db76408bc8998f2.tar.gz chromium_src-9f170464e1ab4f1f75802a391db76408bc8998f2.tar.bz2 |
Refactoring: ProtocolHandler::MaybeCreateJob and other functions take NetworkDelegate as argument
This change goes a long way to prepare for removing NetworkDelegate from URLRequestContext.
TBR=sky@chromium.org, michaeln@chromium.org, benjhayden@chromium.org, brettw@chromium.org, ben@chromium.org, davemoore@chromium.org, zelidrag@chromium.org, mnissler@chromium.org, thestig@chromium.org, asargent@chromium.org, jhawkins@chromium.org, bulach@chromium.org
BUG=crbug.com/142945
Review URL: https://chromiumcodereview.appspot.com/10855209
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153133 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/custom_handlers')
-rw-r--r-- | chrome/browser/custom_handlers/protocol_handler_registry.cc | 22 | ||||
-rw-r--r-- | chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc | 3 |
2 files changed, 16 insertions, 9 deletions
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.cc b/chrome/browser/custom_handlers/protocol_handler_registry.cc index 518be11..12ca2f2 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry.cc @@ -90,7 +90,8 @@ class ProtocolHandlerRegistry::Core // Creates a URL request job for the given request if there is a matching // protocol handler, returns NULL otherwise. - net::URLRequestJob* MaybeCreateJob(net::URLRequest* request) const; + net::URLRequestJob* MaybeCreateJob( + net::URLRequest* request, net::NetworkDelegate* network_delegate) const; // Indicate that the registry has been enabled in the IO thread's // copy of the data. @@ -137,7 +138,7 @@ void ProtocolHandlerRegistry::Core::SetDefault(const ProtocolHandler& handler) { // is registered and the associated handler is able to interpret // the url from |request|. net::URLRequestJob* ProtocolHandlerRegistry::Core::MaybeCreateJob( - net::URLRequest* request) const { + net::URLRequest* request, net::NetworkDelegate* network_delegate) const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); ProtocolHandler handler = LookupHandler(default_handlers_, @@ -149,7 +150,8 @@ net::URLRequestJob* ProtocolHandlerRegistry::Core::MaybeCreateJob( if (!translated_url.is_valid()) return NULL; - return new net::URLRequestRedirectJob(request, translated_url); + return new net::URLRequestRedirectJob( + request, network_delegate, translated_url); } // URLInterceptor ------------------------------------------------------------ @@ -165,17 +167,21 @@ class ProtocolHandlerRegistry::URLInterceptor virtual ~URLInterceptor(); virtual net::URLRequestJob* MaybeIntercept( - net::URLRequest* request) const OVERRIDE; + net::URLRequest* request, + net::NetworkDelegate* network_delegate) const OVERRIDE; virtual bool WillHandleProtocol(const std::string& protocol) const OVERRIDE; virtual net::URLRequestJob* MaybeInterceptRedirect( - const GURL& url, net::URLRequest* request) const OVERRIDE { + const GURL& url, + net::URLRequest* request, + net::NetworkDelegate* network_delegate) const OVERRIDE { return NULL; } virtual net::URLRequestJob* MaybeInterceptResponse( - net::URLRequest* request) const OVERRIDE { + net::URLRequest* request, + net::NetworkDelegate* network_delegate) const OVERRIDE { return NULL; } @@ -193,10 +199,10 @@ ProtocolHandlerRegistry::URLInterceptor::~URLInterceptor() { } net::URLRequestJob* ProtocolHandlerRegistry::URLInterceptor::MaybeIntercept( - net::URLRequest* request) const { + net::URLRequest* request, net::NetworkDelegate* network_delegate) const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - return core_->MaybeCreateJob(request); + return core_->MaybeCreateJob(request, network_delegate); } bool ProtocolHandlerRegistry::URLInterceptor::WillHandleProtocol( diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc index 784e134..26a2fb4 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc @@ -34,7 +34,8 @@ void AssertInterceptedIO( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); net::URLRequestContext context; net::URLRequest request(url, NULL, &context); - scoped_refptr<net::URLRequestJob> job = interceptor->MaybeIntercept(&request); + scoped_refptr<net::URLRequestJob> job = interceptor->MaybeIntercept( + &request, context.network_delegate()); ASSERT_TRUE(job.get() != NULL); } |