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

Unified Diff: chrome/browser/browser_url_handler.cc

Issue 27238: Clean up some style and organization in the browser about handler. No code... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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_about_handler.cc ('k') | chrome/browser/memory_details.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser_url_handler.cc
===================================================================
--- chrome/browser/browser_url_handler.cc (revision 10892)
+++ chrome/browser/browser_url_handler.cc (working copy)
@@ -4,9 +4,22 @@
#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_;
// static
@@ -14,11 +27,10 @@
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 @@
}
return false;
}
-
« no previous file with comments | « chrome/browser/browser_about_handler.cc ('k') | chrome/browser/memory_details.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698