Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1204)

Unified Diff: chrome/browser/browser_url_handler.cc

Issue 174277: override chrome:// URLs via extensions. (Closed)
Patch Set: fix linux errors Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/browser_url_handler.h ('k') | chrome/browser/extensions/extension_apitest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser_url_handler.cc
diff --git a/chrome/browser/browser_url_handler.cc b/chrome/browser/browser_url_handler.cc
index e42e34eb9aa1bac5a1842c5fb04b821314ecc837..506ccfd469a314bdf2d6bf4f86e7a0d4691ded09 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;
}
}
« no previous file with comments | « chrome/browser/browser_url_handler.h ('k') | chrome/browser/extensions/extension_apitest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698