diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-04 23:55:06 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-04 23:55:06 +0000 |
commit | cd3d789910d9bbd81c2a08eee26bffc4ae10ab52 (patch) | |
tree | 2d640336dd883be4f375540ea6573ede6fd3e732 /chrome/browser/browser_url_handler.cc | |
parent | 90f6e2e8b787268630fcecddd7542e1bfb587ab3 (diff) | |
download | chromium_src-cd3d789910d9bbd81c2a08eee26bffc4ae10ab52.zip chromium_src-cd3d789910d9bbd81c2a08eee26bffc4ae10ab52.tar.gz chromium_src-cd3d789910d9bbd81c2a08eee26bffc4ae10ab52.tar.bz2 |
Clean up the browser about URL handler to not derive from WebContents. It is
instead integrated in the BrowserURLHandler for special schemes. This solves
a number of problems and cleans things up nicely.
Most of the functions were not necessary to have in the header file of the
browser about handler, so I made them local to the .cc file. I moved everything
around, but there was no change to any of the About...() functions.
This improves the about:memory page to not include the memory of the new tab
page it replaced. The entry for itself also has the proper title. This works
by using a meta refresh to the actual page, the the process transition no longer
happens at the same time as the about:memory page computation.
This also fixes problems with the about:network and about:ipc dialogs opening
blank pages and also re-opening the dialog when you close the browser.
Review URL: http://codereview.chromium.org/27238
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10941 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_url_handler.cc')
-rw-r--r-- | chrome/browser/browser_url_handler.cc | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/chrome/browser/browser_url_handler.cc b/chrome/browser/browser_url_handler.cc index 98bdaa0..88cb0e2 100644 --- a/chrome/browser/browser_url_handler.cc +++ b/chrome/browser/browser_url_handler.cc @@ -4,8 +4,21 @@ #include "chrome/browser/browser_url_handler.h" +#include "base/string_util.h" #include "chrome/browser/browser_about_handler.h" #include "chrome/browser/dom_ui/dom_ui_contents.h" +#include "chrome/common/url_constants.h" + +// Handles rewriting view-source URLs for what we'll actually load. +static bool HandleViewSource(GURL* url, TabContentsType* type) { + if (url->SchemeIs(chrome::kViewSourceScheme)) { + // Load the inner URL instead. + *url = GURL(url->path()); + *type = TAB_CONTENTS_WEB; + return true; + } + return false; +} std::vector<BrowserURLHandler::URLHandler> BrowserURLHandler::url_handlers_; @@ -14,11 +27,10 @@ void BrowserURLHandler::InitURLHandlers() { if (!url_handlers_.empty()) return; - // Here is where we initialize the global list of handlers for special URLs. - // about:* - url_handlers_.push_back(&BrowserAboutHandler::MaybeHandle); - // chrome-ui:* - url_handlers_.push_back(&DOMUIContentsCanHandleURL); + // Add the default URL handlers. + url_handlers_.push_back(&WillHandleBrowserAboutURL); // about: + url_handlers_.push_back(&DOMUIContentsCanHandleURL); // chrome-ui: + url_handlers_.push_back(&HandleViewSource); // view-source: } // static @@ -31,4 +43,3 @@ bool BrowserURLHandler::HandleBrowserURL(GURL* url, TabContentsType* type) { } return false; } - |