Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(823)

Unified Diff: content/browser/storage_partition_impl_map.cc

Issue 11896113: Add chrome-search: access from Instant overlay (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Yet another rebase Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/base/testing_profile.cc ('k') | content/browser/webui/url_data_manager_backend.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/storage_partition_impl_map.cc
diff --git a/content/browser/storage_partition_impl_map.cc b/content/browser/storage_partition_impl_map.cc
index 4d947e15139fe22dbcd208650bc345d2b185008b..78c1188f6fcc5d955bb90059607d58c1c92ee9b0 100644
--- a/content/browser/storage_partition_impl_map.cc
+++ b/content/browser/storage_partition_impl_map.cc
@@ -16,13 +16,9 @@
#include "content/browser/appcache/chrome_appcache_service.h"
#include "content/browser/fileapi/browser_file_system_helper.h"
#include "content/browser/fileapi/chrome_blob_storage_context.h"
-#include "content/browser/histogram_internals_request_job.h"
#include "content/browser/loader/resource_request_info_impl.h"
-#include "content/browser/net/view_blob_internals_job_factory.h"
-#include "content/browser/net/view_http_cache_job_factory.h"
#include "content/browser/resource_context_impl.h"
#include "content/browser/storage_partition_impl.h"
-#include "content/browser/tcmalloc_internals_request_job.h"
#include "content/browser/webui/url_data_manager_backend.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
@@ -33,7 +29,6 @@
#include "crypto/sha2.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
-#include "webkit/appcache/view_appcache_internals_job.h"
#include "webkit/blob/blob_data.h"
#include "webkit/blob/blob_url_request_job_factory.h"
#include "webkit/fileapi/file_system_url_request_job_factory.h"
@@ -107,62 +102,6 @@ class BlobProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler {
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::ProtocolHandler {
- public:
- DeveloperProtocolHandler(
- AppCacheService* appcache_service,
- ChromeBlobStorageContext* blob_storage_context)
- : appcache_service_(appcache_service),
- blob_storage_context_(blob_storage_context) {}
- virtual ~DeveloperProtocolHandler() {}
-
- virtual net::URLRequestJob* MaybeCreateJob(
- 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_context_->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;
- }
-
- private:
- AppCacheService* appcache_service_;
- ChromeBlobStorageContext* blob_storage_context_;
-};
-
// These constants are used to create the directory structure under the profile
// where renderers with a non-default storage partition keep their persistent
// state. This will contain a set of directories that partially mirror the
@@ -447,40 +386,51 @@ StoragePartitionImpl* StoragePartitionImplMap::Get(
ChromeBlobStorageContext* blob_storage_context =
ChromeBlobStorageContext::GetFor(browser_context_);
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> blob_protocol_handler(
- new BlobProtocolHandler(blob_storage_context,
- partition->GetFileSystemContext()));
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler(
- CreateFileSystemProtocolHandler(partition->GetFileSystemContext()));
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- developer_protocol_handler(
- new DeveloperProtocolHandler(partition->GetAppCacheService(),
- blob_storage_context));
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler(
+ ProtocolHandlerMap protocol_handlers;
+ protocol_handlers[chrome::kBlobScheme] =
+ linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
+ new BlobProtocolHandler(blob_storage_context,
+ partition->GetFileSystemContext()));
+ protocol_handlers[chrome::kFileSystemScheme] =
+ linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
+ CreateFileSystemProtocolHandler(partition->GetFileSystemContext()));
+ protocol_handlers[chrome::kChromeUIScheme] =
+ linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
URLDataManagerBackend::CreateProtocolHandler(
browser_context_->GetResourceContext(),
- browser_context_->IsOffTheRecord()));
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler(
+ browser_context_->IsOffTheRecord(),
+ partition->GetAppCacheService(),
+ blob_storage_context));
+ std::vector<std::string> additional_webui_schemes =
+ GetContentClient()->browser()->GetAdditionalWebUISchemes();
+ for (std::vector<std::string>::const_iterator it =
+ additional_webui_schemes.begin();
+ it != additional_webui_schemes.end();
+ ++it) {
+ protocol_handlers[*it] =
+ linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
+ URLDataManagerBackend::CreateProtocolHandler(
+ browser_context_->GetResourceContext(),
+ browser_context_->IsOffTheRecord(),
+ partition->GetAppCacheService(),
+ blob_storage_context));
+ }
+ protocol_handlers[chrome::kChromeDevToolsScheme] =
+ linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
CreateDevToolsProtocolHandler(browser_context_->GetResourceContext(),
browser_context_->IsOffTheRecord()));
// These calls must happen after StoragePartitionImpl::Create().
if (partition_domain.empty()) {
partition->SetURLRequestContext(
- GetContentClient()->browser()->CreateRequestContext(browser_context_,
- blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(),
- developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(),
- chrome_devtools_protocol_handler.Pass()));
+ GetContentClient()->browser()->CreateRequestContext(
+ browser_context_,
+ &protocol_handlers));
} else {
partition->SetURLRequestContext(
GetContentClient()->browser()->CreateRequestContextForStoragePartition(
browser_context_, partition->GetPath(), in_memory,
- blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(),
- developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(),
- chrome_devtools_protocol_handler.Pass()));
+ &protocol_handlers));
}
partition->SetMediaURLRequestContext(
partition_domain.empty() ?
« no previous file with comments | « chrome/test/base/testing_profile.cc ('k') | content/browser/webui/url_data_manager_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698