Index: content/browser/resource_context_impl.cc |
diff --git a/content/browser/resource_context_impl.cc b/content/browser/resource_context_impl.cc |
index c4074d31f09372ec5c4d46b86c03ef6949147af6..1ebcbcea287d16c3eea9301b217e923fd2967624 100644 |
--- a/content/browser/resource_context_impl.cc |
+++ b/content/browser/resource_context_impl.cc |
@@ -54,134 +54,6 @@ class NonOwningZoomData : public base::SupportsUserData::Data { |
HostZoomMap* host_zoom_map_; |
}; |
-class BlobProtocolHandler : public webkit_blob::BlobProtocolHandler { |
- public: |
- BlobProtocolHandler( |
- webkit_blob::BlobStorageController* blob_storage_controller, |
- base::MessageLoopProxy* loop_proxy) |
- : webkit_blob::BlobProtocolHandler(blob_storage_controller, |
- loop_proxy) {} |
- |
- virtual ~BlobProtocolHandler() {} |
- |
- private: |
- virtual scoped_refptr<webkit_blob::BlobData> |
- LookupBlobData(net::URLRequest* request) const { |
- const ResourceRequestInfoImpl* info = |
- ResourceRequestInfoImpl::ForRequest(request); |
- if (!info) |
- return NULL; |
- return info->requested_blob_data(); |
- } |
- |
- DISALLOW_COPY_AND_ASSIGN(BlobProtocolHandler); |
-}; |
- |
-// Adds a bunch of debugging urls. We use an interceptor instead of a protocol |
-// handler because we want to reuse the chrome://scheme (everyone is familiar |
-// with it, and no need to expose the content/chrome separation through our UI). |
-class DeveloperProtocolHandler |
- : public net::URLRequestJobFactory::Interceptor { |
- public: |
- DeveloperProtocolHandler( |
- AppCacheService* appcache_service, |
- BlobStorageController* blob_storage_controller) |
- : appcache_service_(appcache_service), |
- blob_storage_controller_(blob_storage_controller) {} |
- virtual ~DeveloperProtocolHandler() {} |
- |
- virtual net::URLRequestJob* MaybeIntercept( |
- net::URLRequest* request, |
- net::NetworkDelegate* network_delegate) const OVERRIDE { |
- // Check for chrome://view-http-cache/*, which uses its own job type. |
- if (ViewHttpCacheJobFactory::IsSupportedURL(request->url())) |
- return ViewHttpCacheJobFactory::CreateJobForRequest(request, |
- network_delegate); |
- |
- // Next check for chrome://appcache-internals/, which uses its own job type. |
- if (request->url().SchemeIs(chrome::kChromeUIScheme) && |
- request->url().host() == chrome::kChromeUIAppCacheInternalsHost) { |
- return appcache::ViewAppCacheInternalsJobFactory::CreateJobForRequest( |
- request, network_delegate, appcache_service_); |
- } |
- |
- // Next check for chrome://blob-internals/, which uses its own job type. |
- if (ViewBlobInternalsJobFactory::IsSupportedURL(request->url())) { |
- return ViewBlobInternalsJobFactory::CreateJobForRequest( |
- request, network_delegate, blob_storage_controller_); |
- } |
- |
-#if defined(USE_TCMALLOC) |
- // Next check for chrome://tcmalloc/, which uses its own job type. |
- if (request->url().SchemeIs(chrome::kChromeUIScheme) && |
- request->url().host() == chrome::kChromeUITcmallocHost) { |
- return new TcmallocInternalsRequestJob(request, network_delegate); |
- } |
-#endif |
- |
- // Next check for chrome://histograms/, which uses its own job type. |
- if (request->url().SchemeIs(chrome::kChromeUIScheme) && |
- request->url().host() == chrome::kChromeUIHistogramHost) { |
- return new HistogramInternalsRequestJob(request, network_delegate); |
- } |
- |
- return NULL; |
- } |
- |
- virtual net::URLRequestJob* MaybeInterceptRedirect( |
- const GURL& location, |
- net::URLRequest* request, |
- net::NetworkDelegate* network_delegate) const OVERRIDE { |
- return NULL; |
- } |
- |
- virtual net::URLRequestJob* MaybeInterceptResponse( |
- net::URLRequest* request, |
- net::NetworkDelegate* network_delegate) const OVERRIDE { |
- return NULL; |
- } |
- |
- virtual bool WillHandleProtocol(const std::string& protocol) const { |
- return protocol == chrome::kChromeUIScheme; |
- } |
- |
- private: |
- AppCacheService* appcache_service_; |
- BlobStorageController* blob_storage_controller_; |
-}; |
- |
-void InitializeRequestContext( |
- scoped_refptr<net::URLRequestContextGetter> context_getter, |
- AppCacheService* appcache_service, |
- FileSystemContext* file_system_context, |
- ChromeBlobStorageContext* blob_storage_context) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
- if (!context_getter) |
- return; // tests. |
- net::URLRequestContext* context = context_getter->GetURLRequestContext(); |
- net::URLRequestJobFactory* job_factory = |
- const_cast<net::URLRequestJobFactory*>(context->job_factory()); |
- if (job_factory->IsHandledProtocol(chrome::kBlobScheme)) |
- return; // Already initialized this RequestContext. |
- |
- bool set_protocol = job_factory->SetProtocolHandler( |
- chrome::kBlobScheme, |
- new BlobProtocolHandler( |
- blob_storage_context->controller(), |
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE))); |
- DCHECK(set_protocol); |
- set_protocol = job_factory->SetProtocolHandler( |
- chrome::kFileSystemScheme, |
- CreateFileSystemProtocolHandler(file_system_context)); |
- DCHECK(set_protocol); |
- |
- job_factory->AddInterceptor( |
- new DeveloperProtocolHandler(appcache_service, |
- blob_storage_context->controller())); |
- |
- // TODO(jam): Add the ProtocolHandlerRegistryIntercepter here! |
-} |
- |
} // namespace |
@@ -227,45 +99,6 @@ void InitializeResourceContext(BrowserContext* browser_context) { |
new NonOwningZoomData( |
HostZoomMap::GetForBrowserContext(browser_context))); |
resource_context->DetachUserDataThread(); |
- |
- StoragePartition* storage_partition = |
- BrowserContext::GetDefaultStoragePartition(browser_context); |
- |
- // Add content's URLRequestContext's hooks. |
- // Check first to avoid memory leak in unittests. |
- // TODO(creis): Do equivalent initializations for isolated app and isolated |
- // media request contexts. |
- if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { |
- // TODO(ajwong): Move this whole block into |
- // StoragePartitionImplMap::PostCreateInitialization after we're certain |
- // this is safe to happen before InitializeResourceContext, and after we've |
- // found the right URLRequestContext for a storage partition. Otherwise, |
- // our isolated URLRequestContext getters will do the wrong thing for blobs, |
- // and FileSystemContext. |
- // |
- // http://crbug.com/85121 |
- |
- BrowserThread::PostTask( |
- BrowserThread::IO, FROM_HERE, |
- base::Bind( |
- &InitializeRequestContext, |
- make_scoped_refptr(browser_context->GetRequestContext()), |
- storage_partition->GetAppCacheService(), |
- make_scoped_refptr( |
- storage_partition->GetFileSystemContext()), |
- make_scoped_refptr( |
- ChromeBlobStorageContext::GetFor(browser_context)))); |
- BrowserThread::PostTask( |
- BrowserThread::IO, FROM_HERE, |
- base::Bind( |
- &InitializeRequestContext, |
- make_scoped_refptr(browser_context->GetMediaRequestContext()), |
- storage_partition->GetAppCacheService(), |
- make_scoped_refptr( |
- storage_partition->GetFileSystemContext()), |
- make_scoped_refptr( |
- ChromeBlobStorageContext::GetFor(browser_context)))); |
- } |
} |
} // namespace content |