| 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;
|
| }
|
| -
|
|
|