diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-14 06:17:07 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-14 06:17:07 +0000 |
commit | a8c1e745a571a498a6727858d81631c903672d31 (patch) | |
tree | aba124f89b8d9a2765bfcca677c3d4482f15f710 /net/base/network_delegate.h | |
parent | 1332c24d517e472758aae7e25301752561da6bc5 (diff) | |
download | chromium_src-a8c1e745a571a498a6727858d81631c903672d31.zip chromium_src-a8c1e745a571a498a6727858d81631c903672d31.tar.gz chromium_src-a8c1e745a571a498a6727858d81631c903672d31.tar.bz2 |
Create a URLRequestJobFactory to replace the URLRequest globals.
URLRequest::Interceptor and URLRequest::ProtocolFactory are globally registered. This causes a variety of problems. This provides a method for replacing them.
It used to be the case that we used net::URLRequest::IsHandledProtocol()/net::URLRequest::IsHandledURL() to see if the request would be handled by Chrome, or deferred to an external protocol handler. This required that URLRequest be aware of all protocol handlers.
We instead provide ProfileIOData::IsHandledProtocol(), which checks to see if there are any Chrome registered protocol handlers, and if not, checks the default ones in net::URLRequest.
Note this doesn't work for custom handlers (registerProtocolHandler) because they are dynamic and profile-specific. We would have to add a member function to ProfileIOData and not use a global. This is problematic since we check ProfileIOData::IsHandledProtocol in the RenderViewContextMenu, which runs on the UI thread, whereas ProfileIOData lives on the IO thread. RenderViewContextMenu is using also using it synchronously, which makes it a pain to support.
So, we don't support custom handlers in ProfileIOData::IsHandledProtocol(). This means that "save as" won't work for custom handlers. Seems ok for now.
This also fixes the multiprofile/incognito bugs where if a profile registers a custom handler, and then a different profile / an incognito profile registers the same custom handler and then unregisters it, which globally unregisters it, so the original profile is now broken. By removing the use of the globals, we fix this.
Also fixes a bunch of style guide violations in the ProtocolHandler/ProtocolHandlerRegistry code.
This changelist replaces two existing URLRequest::ProtocolFactory uses: chrome-extension/user-script and custom handlers.
Also improve the tests in ResourceDispatcherHost so we don't have to do as many NULL checks. Change the MockResourceContext to create a TestURLRequestContext.
BUG=81979
TEST=none
Review URL: http://codereview.chromium.org/6960006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85376 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/network_delegate.h')
-rw-r--r-- | net/base/network_delegate.h | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/net/base/network_delegate.h b/net/base/network_delegate.h index ce913e9..977df2f 100644 --- a/net/base/network_delegate.h +++ b/net/base/network_delegate.h @@ -52,15 +52,6 @@ class NetworkDelegate : public base::NonThreadSafe { void NotifyCompleted(URLRequest* request); void NotifyURLRequestDestroyed(URLRequest* request); void NotifyHttpTransactionDestroyed(uint64 request_id); - - // Returns a URLRequestJob that will be used to handle the request if - // non-null. - // TODO(koz): Currently this is called inside registered ProtocolFactories, - // so that we can perform Delegate-dependent request handling from the static - // factories, but ultimately it should be called directly from - // URLRequestJobManager::CreateJob() as a general override mechanism. - URLRequestJob* MaybeCreateURLRequestJob(URLRequest* request); - void NotifyPACScriptError(int line_number, const string16& error); private: @@ -110,10 +101,6 @@ class NetworkDelegate : public base::NonThreadSafe { // destroyed. virtual void OnHttpTransactionDestroyed(uint64 request_id) = 0; - // Called before a request is sent and before a URLRequestJob is created to - // handle the request. - virtual URLRequestJob* OnMaybeCreateURLRequestJob(URLRequest* request) = 0; - // Corresponds to ProxyResolverJSBindings::OnError. virtual void OnPACScriptError(int line_number, const string16& error) = 0; }; |