| Index: content/browser/webui/url_data_manager_backend.cc
|
| ===================================================================
|
| --- content/browser/webui/url_data_manager_backend.cc (revision 184663)
|
| +++ content/browser/webui/url_data_manager_backend.cc (working copy)
|
| @@ -18,7 +18,12 @@
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/message_loop.h"
|
| #include "base/string_util.h"
|
| +#include "content/browser/fileapi/chrome_blob_storage_context.h"
|
| +#include "content/browser/histogram_internals_request_job.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/tcmalloc_internals_request_job.h"
|
| #include "content/browser/webui/shared_resources_data_source.h"
|
| #include "content/browser/webui/url_data_source_impl.h"
|
| #include "content/public/browser/browser_thread.h"
|
| @@ -31,7 +36,10 @@
|
| #include "net/url_request/url_request_context.h"
|
| #include "net/url_request/url_request_job.h"
|
| #include "net/url_request/url_request_job_factory.h"
|
| +#include "webkit/appcache/view_appcache_internals_job.h"
|
|
|
| +using appcache::AppCacheService;
|
| +
|
| namespace content {
|
|
|
| namespace {
|
| @@ -334,40 +342,71 @@
|
| : public net::URLRequestJobFactory::ProtocolHandler {
|
| public:
|
| // |is_incognito| should be set for incognito profiles.
|
| - explicit ChromeProtocolHandler(content::ResourceContext* resource_context,
|
| - bool is_incognito);
|
| - virtual ~ChromeProtocolHandler();
|
| + ChromeProtocolHandler(ResourceContext* resource_context,
|
| + bool is_incognito,
|
| + AppCacheService* appcache_service,
|
| + ChromeBlobStorageContext* blob_storage_context)
|
| + : resource_context_(resource_context),
|
| + is_incognito_(is_incognito),
|
| + appcache_service_(appcache_service),
|
| + blob_storage_context_(blob_storage_context) {}
|
| + virtual ~ChromeProtocolHandler() {}
|
|
|
| virtual net::URLRequestJob* MaybeCreateJob(
|
| net::URLRequest* request,
|
| - net::NetworkDelegate* network_delegate) const OVERRIDE;
|
| + net::NetworkDelegate* network_delegate) const OVERRIDE {
|
| + DCHECK(request);
|
|
|
| + // 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);
|
| + }
|
| +
|
| + // Fall back to using a custom handler
|
| + return new URLRequestChromeJob(
|
| + request, network_delegate,
|
| + GetURLDataManagerForResourceContext(resource_context_), is_incognito_);
|
| + }
|
| +
|
| private:
|
| // These members are owned by ProfileIOData, which owns this ProtocolHandler.
|
| content::ResourceContext* const resource_context_;
|
|
|
| // True when generated from an incognito profile.
|
| const bool is_incognito_;
|
| + AppCacheService* appcache_service_;
|
| + ChromeBlobStorageContext* blob_storage_context_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ChromeProtocolHandler);
|
| };
|
|
|
| -ChromeProtocolHandler::ChromeProtocolHandler(
|
| - content::ResourceContext* resource_context, bool is_incognito)
|
| - : resource_context_(resource_context), is_incognito_(is_incognito) {}
|
| -
|
| -ChromeProtocolHandler::~ChromeProtocolHandler() {}
|
| -
|
| -net::URLRequestJob* ChromeProtocolHandler::MaybeCreateJob(
|
| - net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
|
| - DCHECK(request);
|
| -
|
| - // Fall back to using a custom handler
|
| - return new URLRequestChromeJob(
|
| - request, network_delegate,
|
| - GetURLDataManagerForResourceContext(resource_context_), is_incognito_);
|
| -}
|
| -
|
| } // namespace
|
|
|
| URLDataManagerBackend::URLDataManagerBackend()
|
| @@ -389,9 +428,13 @@
|
| // static
|
| net::URLRequestJobFactory::ProtocolHandler*
|
| URLDataManagerBackend::CreateProtocolHandler(
|
| - content::ResourceContext* resource_context, bool is_incognito) {
|
| + content::ResourceContext* resource_context,
|
| + bool is_incognito,
|
| + AppCacheService* appcache_service,
|
| + ChromeBlobStorageContext* blob_storage_context) {
|
| DCHECK(resource_context);
|
| - return new ChromeProtocolHandler(resource_context, is_incognito);
|
| + return new ChromeProtocolHandler(
|
| + resource_context, is_incognito, appcache_service, blob_storage_context);
|
| }
|
|
|
| void URLDataManagerBackend::AddDataSource(
|
|
|