Index: chrome/browser/ui/webui/chrome_web_ui_factory.cc |
=================================================================== |
--- chrome/browser/ui/webui/chrome_web_ui_factory.cc (revision 110966) |
+++ chrome/browser/ui/webui/chrome_web_ui_factory.cc (working copy) |
@@ -11,6 +11,7 @@ |
#include "chrome/browser/history/history_types.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/profiles/profile_manager.h" |
+#include "chrome/browser/ui/webui/about_ui.h" |
#include "chrome/browser/ui/webui/bookmarks_ui.h" |
#include "chrome/browser/ui/webui/bug_report_ui.h" |
#include "chrome/browser/ui/webui/constrained_html_ui.h" |
@@ -103,12 +104,18 @@ |
return NULL; |
} |
+// Special case for older about: handlers. |
+template<> |
+ChromeWebUI* NewWebUI<AboutUI>(TabContents* contents, const GURL& url) { |
+ return new AboutUI(contents, url.host()); |
+} |
+ |
// Returns a function that can be used to create the right type of WebUI for a |
// tab, based on its URL. Returns NULL if the URL doesn't have WebUI associated |
// with it. Even if the factory function is valid, it may yield a NULL WebUI |
// when invoked for a particular tab - see NewWebUI<ExtensionWebUI>. |
-static WebUIFactoryFunction GetWebUIFactoryFunction(Profile* profile, |
- const GURL& url) { |
+WebUIFactoryFunction GetWebUIFactoryFunction(Profile* profile, |
+ const GURL& url) { |
if (url.host() == chrome::kChromeUIDialogHost) |
return &NewWebUI<ConstrainedHtmlUI>; |
@@ -141,11 +148,6 @@ |
url.SchemeIs(chrome::kChromeInternalScheme)) |
return &NewWebUI<NewTabUI>; |
- // Return a generic Web UI so chrome:chrome-urls can navigate to Web UI pages. |
- if (url.host() == chrome::kChromeUIAboutHost || |
- url.host() == chrome::kChromeUIChromeURLsHost) |
- return &NewWebUI<ChromeWebUI>; |
- |
// We must compare hosts only since some of the Web UIs append extra stuff |
// after the host name. |
if (url.host() == chrome::kChromeUIBookmarksHost) |
@@ -269,6 +271,41 @@ |
return &NewWebUI<NewTabUI>; |
} |
#endif |
+ |
+ if (url.host() == chrome::kChromeUIChromeURLsHost || |
+ url.host() == chrome::kChromeUICreditsHost || |
+ url.host() == chrome::kChromeUIDNSHost || |
+ url.host() == chrome::kChromeUIHistogramsHost || |
+ url.host() == chrome::kChromeUIMemoryHost || |
+ url.host() == chrome::kChromeUIMemoryRedirectHost || |
+ url.host() == chrome::kChromeUIStatsHost || |
+ url.host() == chrome::kChromeUITaskManagerHost || |
+ url.host() == chrome::kChromeUITermsHost || |
+ url.host() == chrome::kChromeUIVersionHost) { |
+ return &NewWebUI<AboutUI>; |
+ } |
+ |
+#if defined(USE_TCMALLOC) |
+ if (url.host() == chrome::kChromeUITCMallocHost) |
Evan Stade
2011/11/22 02:27:44
nit: I would place these macro-guarded checks in t
Tom Sepez
2011/11/22 18:34:01
Will do. My personal preference has always been t
|
+ return &NewWebUI<AboutUI>; |
+#endif |
+ |
+#if defined(OS_LINUX) || defined(OS_OPENBSD) |
+ if (url.host() == chrome::kChromeUILinuxProxyConfigHost || |
+ url.host() == chrome::kChromeUISandboxHost) { |
+ return &NewWebUI<AboutUI>; |
+ } |
+#endif |
+ |
+#if defined(OS_CHROMEOS) |
+ if (url.host() == chrome::kChromeUICryptohomeHost || |
+ url.host() == chrome::kChromeUIDiscardsHost || |
+ url.host() == chrome::kChromeUINetworkHost || |
+ url.host() == chrome::kChromeUIOSCreditsHost) { |
+ return &NewWebUI<AboutUI>; |
+ } |
+#endif |
+ |
DLOG(WARNING) << "Unknown WebUI:" << url; |
return NULL; |
} |