diff options
author | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-08 18:12:09 +0000 |
---|---|---|
committer | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-08 18:12:09 +0000 |
commit | af561035f6bd3f19318d0500e936d9259a71ffe1 (patch) | |
tree | 72977304f6459adb091047978396fcd27c698771 /chrome/browser | |
parent | 6777a5795196c21e69169695685191e2df0eb5dd (diff) | |
download | chromium_src-af561035f6bd3f19318d0500e936d9259a71ffe1.zip chromium_src-af561035f6bd3f19318d0500e936d9259a71ffe1.tar.gz chromium_src-af561035f6bd3f19318d0500e936d9259a71ffe1.tar.bz2 |
Support chrome://blob-internals to inspect the blob storage.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3516019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61982 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser_about_handler.cc | 3 | ||||
-rw-r--r-- | chrome/browser/dom_ui/chrome_url_data_manager.cc | 5 | ||||
-rw-r--r-- | chrome/browser/net/view_blob_internals_job_factory.cc | 28 | ||||
-rw-r--r-- | chrome/browser/net/view_blob_internals_job_factory.h | 20 |
4 files changed, 56 insertions, 0 deletions
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index ad6b091..1b14c1e 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -96,6 +96,7 @@ namespace { // The (alphabetized) paths used for the about pages. // Note: Keep these in sync with url_constants.h const char kAppCacheInternalsPath[] = "appcache-internals"; +const char kBlobInternalsPath[] = "blob-internals"; const char kCreditsPath[] = "credits"; const char kCachePath[] = "view-http-cache"; const char kDnsPath[] = "dns"; @@ -128,6 +129,7 @@ const char kOSCreditsPath[] = "os-credits"; // Add path here to be included in about:about const char *kAllAboutPaths[] = { kAppCacheInternalsPath, + kBlobInternalsPath, kCachePath, kCreditsPath, kDnsPath, @@ -259,6 +261,7 @@ std::string AboutAbout() { if (kAllAboutPaths[i] == kLabsPath && !about_labs::IsEnabled()) continue; if (kAllAboutPaths[i] == kAppCacheInternalsPath || + kAllAboutPaths[i] == kBlobInternalsPath || kAllAboutPaths[i] == kCachePath || kAllAboutPaths[i] == kLabsPath || kAllAboutPaths[i] == kNetInternalsPath || diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.cc b/chrome/browser/dom_ui/chrome_url_data_manager.cc index e25bea9..26eba27 100644 --- a/chrome/browser/dom_ui/chrome_url_data_manager.cc +++ b/chrome/browser/dom_ui/chrome_url_data_manager.cc @@ -22,6 +22,7 @@ #include "chrome/browser/chrome_thread.h" #include "chrome/browser/dom_ui/shared_resources_data_source.h" #include "chrome/browser/net/chrome_url_request_context.h" +#include "chrome/browser/net/view_blob_internals_job_factory.h" #include "chrome/browser/net/view_http_cache_job_factory.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/ref_counted_util.h" @@ -329,6 +330,10 @@ URLRequestJob* ChromeURLDataManager::Factory(URLRequest* request, if (ViewAppCacheInternalsJobFactory::IsSupportedURL(request->url())) return ViewAppCacheInternalsJobFactory::CreateJobForRequest(request); + // Next check for chrome://blob-internals/, which uses its own job type. + if (ViewBlobInternalsJobFactory::IsSupportedURL(request->url())) + return ViewBlobInternalsJobFactory::CreateJobForRequest(request); + // Fall back to using a custom handler return new URLRequestChromeJob(request); } diff --git a/chrome/browser/net/view_blob_internals_job_factory.cc b/chrome/browser/net/view_blob_internals_job_factory.cc new file mode 100644 index 0000000..25832a0 --- /dev/null +++ b/chrome/browser/net/view_blob_internals_job_factory.cc @@ -0,0 +1,28 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/net/view_blob_internals_job_factory.h" + +#include "chrome/browser/net/chrome_url_request_context.h" +#include "chrome/browser/chrome_blob_storage_context.h" +#include "chrome/common/url_constants.h" +#include "webkit/blob/view_blob_internals_job.h" + +// static. +bool ViewBlobInternalsJobFactory::IsSupportedURL(const GURL& url) { + return StartsWithASCII(url.spec(), + chrome::kBlobViewInternalsURL, + true /*case_sensitive*/); +} + +// static. +URLRequestJob* ViewBlobInternalsJobFactory::CreateJobForRequest( + URLRequest* request) { + webkit_blob::BlobStorageController* blob_storage_controller = + static_cast<ChromeURLRequestContext*>(request->context())-> + blob_storage_context()->controller(); + return new webkit_blob::ViewBlobInternalsJob( + request, blob_storage_controller); +} + diff --git a/chrome/browser/net/view_blob_internals_job_factory.h b/chrome/browser/net/view_blob_internals_job_factory.h new file mode 100644 index 0000000..874e2bd --- /dev/null +++ b/chrome/browser/net/view_blob_internals_job_factory.h @@ -0,0 +1,20 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_NET_VIEW_BLOB_INTERNALS_JOB_FACTORY_H_ +#define CHROME_BROWSER_NET_VIEW_BLOB_INTERNALS_JOB_FACTORY_H_ +#pragma once + +class GURL; +class URLRequest; +class URLRequestJob; + +class ViewBlobInternalsJobFactory { + public: + static bool IsSupportedURL(const GURL& url); + static URLRequestJob* CreateJobForRequest(URLRequest* request); +}; + +#endif // CHROME_BROWSER_NET_VIEW_BLOB_INTERNALS_JOB_FACTORY_H_ + |