diff options
author | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-28 20:26:05 +0000 |
---|---|---|
committer | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-28 20:26:05 +0000 |
commit | 86c008e8a7da9c00c5a676eb201ba5d0c976748e (patch) | |
tree | 8e58aeeab8564a396ccf67807d5bddfcdaa05807 /chrome/browser/browser_url_handler.cc | |
parent | 5ec8d59c7e79d1a7aae4137051ffc184ec51096c (diff) | |
download | chromium_src-86c008e8a7da9c00c5a676eb201ba5d0c976748e.zip chromium_src-86c008e8a7da9c00c5a676eb201ba5d0c976748e.tar.gz chromium_src-86c008e8a7da9c00c5a676eb201ba5d0c976748e.tar.bz2 |
override chrome:// URLs via extensions.
Overrides are declared in an extension's manifest. The last one installed
wins. However, we keep a list of those installed per page so that priority
is preserved and so that uninstall will revert to a previous state.
Review URL: http://codereview.chromium.org/174277
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24791 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_url_handler.cc')
-rw-r--r-- | chrome/browser/browser_url_handler.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/chrome/browser/browser_url_handler.cc b/chrome/browser/browser_url_handler.cc index e42e34e..506ccfd 100644 --- a/chrome/browser/browser_url_handler.cc +++ b/chrome/browser/browser_url_handler.cc @@ -7,11 +7,13 @@ #include "base/string_util.h" #include "chrome/browser/browser_about_handler.h" #include "chrome/browser/dom_ui/dom_ui_factory.h" +#include "chrome/browser/extensions/extension_dom_ui.h" +#include "chrome/browser/profile.h" #include "chrome/common/url_constants.h" #include "googleurl/src/gurl.h" // Handles rewriting view-source URLs for what we'll actually load. -static bool HandleViewSource(GURL* url) { +static bool HandleViewSource(GURL* url, Profile* profile) { if (url->SchemeIs(chrome::kViewSourceScheme)) { // Load the inner URL instead. *url = GURL(url->path()); @@ -21,7 +23,7 @@ static bool HandleViewSource(GURL* url) { } // Handles URLs for DOM UI. These URLs need no rewriting. -static bool HandleDOMUI(GURL* url) { +static bool HandleDOMUI(GURL* url, Profile* profile) { if (!DOMUIFactory::UseDOMUIForURL(*url)) return false; return true; @@ -35,17 +37,18 @@ void BrowserURLHandler::InitURLHandlers() { return; // Add the default URL handlers. + url_handlers_.push_back(&ExtensionDOMUI::HandleChromeURLOverride); url_handlers_.push_back(&WillHandleBrowserAboutURL); // about: url_handlers_.push_back(&HandleDOMUI); // chrome: & friends. url_handlers_.push_back(&HandleViewSource); // view-source: } // static -void BrowserURLHandler::RewriteURLIfNecessary(GURL* url) { +void BrowserURLHandler::RewriteURLIfNecessary(GURL* url, Profile* profile) { if (url_handlers_.empty()) InitURLHandlers(); for (size_t i = 0; i < url_handlers_.size(); ++i) { - if ((*url_handlers_[i])(url)) + if ((*url_handlers_[i])(url, profile)) return; } } |