summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-14 20:51:04 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-14 20:51:04 +0000
commit13c34d1395636e081be2318e8ae12bc8fa71ca57 (patch)
tree4a719a69338f1cc14fe23db88e061c513cf122db /chrome/browser/dom_ui
parent1364d8b89dd74afd35a5d9fe4bb4f3c66d09c3c4 (diff)
downloadchromium_src-13c34d1395636e081be2318e8ae12bc8fa71ca57.zip
chromium_src-13c34d1395636e081be2318e8ae12bc8fa71ca57.tar.gz
chromium_src-13c34d1395636e081be2318e8ae12bc8fa71ca57.tar.bz2
Change the URLs used to access "view-cache:" and "view-net-internals:".
"net-internal:*" ==> "chrome://net-internals/*" "view-cache:*" ==> "chrome://net-internals/view-cache/*" "view-cache:stats" ==> "chrome://net-internals/httpcache.stats" As before, there are also aliases from the "about:*" page: "about:net-internal[/*]" aliases "chrome://net-internals/*" "about:cache[/*]" aliases "chrome://net-internals/view-cache" BUG=http://crbug.com/21551 Review URL: http://codereview.chromium.org/202067 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26158 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r--chrome/browser/dom_ui/chrome_url_data_manager.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.cc b/chrome/browser/dom_ui/chrome_url_data_manager.cc
index c3ef325..fccb406 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 "net/url_request/url_request.h"
#include "net/url_request/url_request_file_job.h"
#include "net/url_request/url_request_job.h"
+#include "net/url_request/url_request_view_net_internals_job.h"
#include "grit/locale_settings.h"
@@ -296,6 +297,34 @@ void ChromeURLDataManager::DataSource::SetFontAndTextDirection(
L"rtl" : L"ltr");
}
+// This class describes how to form chrome://net-internals/DESCRIPTION
+// URLs, and conversely how to extract DESCRIPTION.
+//
+// This needs to be passed to URLRequestViewNetInternalsJob, which lives
+// in the network module and doesn't know anything about what URL protocol
+// it has been registered with.
+class NetInternalsURLFormat : public URLRequestViewNetInternalsJob::URLFormat {
+ public:
+ virtual std::string GetDetails(const GURL& url) {
+ DCHECK(IsSupportedURL(url));
+ size_t start = strlen(chrome::kNetworkViewInternalsURL);
+ if (start >= url.spec().size())
+ return std::string();
+ return url.spec().substr(start);
+ }
+
+ virtual GURL MakeURL(const std::string& details) {
+ return GURL(std::string(chrome::kNetworkViewInternalsURL) + details);
+ }
+
+ static bool IsSupportedURL(const GURL& url) {
+ // Note that kNetworkViewInternalsURL is terminated by a '/'.
+ return StartsWithASCII(url.spec(),
+ chrome::kNetworkViewInternalsURL,
+ true /*case_sensitive*/);
+ }
+};
+
URLRequestJob* ChromeURLDataManager::Factory(URLRequest* request,
const std::string& scheme) {
// Try first with a file handler
@@ -304,6 +333,12 @@ URLRequestJob* ChromeURLDataManager::Factory(URLRequest* request,
return new URLRequestChromeFileJob(request,
FilePath::FromWStringHack(path));
+ // Next check for chrome://net-internals/, which uses its own job type.
+ if (NetInternalsURLFormat::IsSupportedURL(request->url())) {
+ static NetInternalsURLFormat url_format;
+ return new URLRequestViewNetInternalsJob(request, &url_format);
+ }
+
// Fall back to using a custom handler
return new URLRequestChromeJob(request);
}