| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" | 5 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/about_flags.h" | 8 #include "chrome/browser/about_flags.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_web_ui.h" | 10 #include "chrome/browser/extensions/extension_web_ui.h" |
| 11 #include "chrome/browser/extensions/extensions_ui.h" | 11 #include "chrome/browser/extensions/extensions_ui.h" |
| 12 #include "chrome/browser/history/history_types.h" | 12 #include "chrome/browser/history/history_types.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "chrome/browser/ui/webui/bookmarks_ui.h" | 15 #include "chrome/browser/ui/webui/bookmarks_ui.h" |
| 16 #include "chrome/browser/ui/webui/bug_report_ui.h" | 16 #include "chrome/browser/ui/webui/bug_report_ui.h" |
| 17 #include "chrome/browser/ui/webui/constrained_html_ui.h" | 17 #include "chrome/browser/ui/webui/constrained_html_ui.h" |
| 18 #include "chrome/browser/ui/webui/crashes_ui.h" | 18 #include "chrome/browser/ui/webui/crashes_ui.h" |
| 19 #include "chrome/browser/ui/webui/devtools_ui.h" | 19 #include "chrome/browser/ui/webui/devtools_ui.h" |
| 20 #include "chrome/browser/ui/webui/downloads_ui.h" | 20 #include "chrome/browser/ui/webui/downloads_ui.h" |
| 21 #include "chrome/browser/ui/webui/task_manager_ui.h" | 21 #include "chrome/browser/ui/webui/task_manager_ui.h" |
| 22 #include "chrome/browser/ui/webui/flags_ui.h" | 22 #include "chrome/browser/ui/webui/flags_ui.h" |
| 23 #include "chrome/browser/ui/webui/flash_ui.h" | 23 #include "chrome/browser/ui/webui/flash_ui.h" |
| 24 #include "chrome/browser/ui/webui/gpu_internals_ui.h" | 24 #include "chrome/browser/ui/webui/gpu_internals_ui.h" |
| 25 #include "chrome/browser/ui/webui/history2_ui.h" | 25 #include "chrome/browser/ui/webui/history2_ui.h" |
| 26 #include "chrome/browser/ui/webui/history_ui.h" | 26 #include "chrome/browser/ui/webui/history_ui.h" |
| 27 #include "chrome/browser/ui/webui/html_dialog_ui.h" | 27 #include "chrome/browser/ui/webui/html_dialog_ui.h" |
| 28 #include "chrome/browser/ui/webui/hung_renderer_dialog_ui.h" | |
| 29 #include "chrome/browser/ui/webui/media/media_internals_ui.h" | 28 #include "chrome/browser/ui/webui/media/media_internals_ui.h" |
| 30 #include "chrome/browser/ui/webui/net_internals_ui.h" | 29 #include "chrome/browser/ui/webui/net_internals_ui.h" |
| 31 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 30 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 32 #include "chrome/browser/ui/webui/options/options_ui.h" | 31 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 33 #include "chrome/browser/ui/webui/plugins_ui.h" | 32 #include "chrome/browser/ui/webui/plugins_ui.h" |
| 34 #include "chrome/browser/ui/webui/policy_ui.h" | 33 #include "chrome/browser/ui/webui/policy_ui.h" |
| 35 #include "chrome/browser/ui/webui/print_preview_ui.h" | 34 #include "chrome/browser/ui/webui/print_preview_ui.h" |
| 36 #include "chrome/browser/ui/webui/quota_internals_ui.h" | 35 #include "chrome/browser/ui/webui/quota_internals_ui.h" |
| 37 #include "chrome/browser/ui/webui/sessions_ui.h" | 36 #include "chrome/browser/ui/webui/sessions_ui.h" |
| 38 #include "chrome/browser/ui/webui/sync_internals_ui.h" | 37 #include "chrome/browser/ui/webui/sync_internals_ui.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 63 #endif | 62 #endif |
| 64 | 63 |
| 65 #if defined(TOUCH_UI) | 64 #if defined(TOUCH_UI) |
| 66 #include "chrome/browser/ui/webui/keyboard_ui.h" | 65 #include "chrome/browser/ui/webui/keyboard_ui.h" |
| 67 #endif | 66 #endif |
| 68 | 67 |
| 69 #if defined(OS_WIN) | 68 #if defined(OS_WIN) |
| 70 #include "chrome/browser/ui/webui/conflicts_ui.h" | 69 #include "chrome/browser/ui/webui/conflicts_ui.h" |
| 71 #endif | 70 #endif |
| 72 | 71 |
| 73 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 72 #if defined(WEBUI_DIALOGS) && defined(OS_POSIX) && !defined(OS_MACOSX) |
| 74 #include "chrome/browser/ui/webui/certificate_viewer_ui.h" | 73 #include "chrome/browser/ui/webui/certificate_viewer_ui.h" |
| 75 #endif | 74 #endif |
| 76 | 75 |
| 76 #if defined(WEBUI_DIALOGS) |
| 77 #include "chrome/browser/ui/webui/hung_renderer_dialog_ui.h" |
| 78 #endif |
| 79 |
| 77 namespace { | 80 namespace { |
| 78 | 81 |
| 79 // A function for creating a new WebUI. The caller owns the return value, which | 82 // A function for creating a new WebUI. The caller owns the return value, which |
| 80 // may be NULL (for example, if the URL refers to an non-existent extension). | 83 // may be NULL (for example, if the URL refers to an non-existent extension). |
| 81 typedef ChromeWebUI* (*WebUIFactoryFunction)(TabContents* tab_contents, | 84 typedef ChromeWebUI* (*WebUIFactoryFunction)(TabContents* tab_contents, |
| 82 const GURL& url); | 85 const GURL& url); |
| 83 | 86 |
| 84 // Template for defining WebUIFactoryFunction. | 87 // Template for defining WebUIFactoryFunction. |
| 85 template<class T> | 88 template<class T> |
| 86 ChromeWebUI* NewWebUI(TabContents* contents, const GURL& url) { | 89 ChromeWebUI* NewWebUI(TabContents* contents, const GURL& url) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 if (url.host() == chrome::kChromeUIAboutHost || | 144 if (url.host() == chrome::kChromeUIAboutHost || |
| 142 url.host() == chrome::kChromeUIChromeURLsHost) | 145 url.host() == chrome::kChromeUIChromeURLsHost) |
| 143 return &NewWebUI<ChromeWebUI>; | 146 return &NewWebUI<ChromeWebUI>; |
| 144 | 147 |
| 145 // We must compare hosts only since some of the Web UIs append extra stuff | 148 // We must compare hosts only since some of the Web UIs append extra stuff |
| 146 // after the host name. | 149 // after the host name. |
| 147 if (url.host() == chrome::kChromeUIBookmarksHost) | 150 if (url.host() == chrome::kChromeUIBookmarksHost) |
| 148 return &NewWebUI<BookmarksUI>; | 151 return &NewWebUI<BookmarksUI>; |
| 149 if (url.host() == chrome::kChromeUIBugReportHost) | 152 if (url.host() == chrome::kChromeUIBugReportHost) |
| 150 return &NewWebUI<BugReportUI>; | 153 return &NewWebUI<BugReportUI>; |
| 151 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 154 #if defined(WEBUI_DIALOGS) && defined(OS_POSIX) && !defined(OS_MACOSX) |
| 152 if (url.host() == chrome::kChromeUICertificateViewerHost) | 155 if (url.host() == chrome::kChromeUICertificateViewerHost) |
| 153 return &NewWebUI<CertificateViewerUI>; | 156 return &NewWebUI<CertificateViewerUI>; |
| 154 #endif | 157 #endif |
| 158 #if defined(WEBUI_DIALOGS) |
| 155 if (url.host() == chrome::kChromeUIHungRendererDialogHost) { | 159 if (url.host() == chrome::kChromeUIHungRendererDialogHost) { |
| 156 return &NewWebUI<HungRendererDialogUI>; | 160 return &NewWebUI<HungRendererDialogUI>; |
| 157 } | 161 } |
| 162 #endif |
| 158 if (url.host() == chrome::kChromeUICrashesHost) | 163 if (url.host() == chrome::kChromeUICrashesHost) |
| 159 return &NewWebUI<CrashesUI>; | 164 return &NewWebUI<CrashesUI>; |
| 160 if (url.host() == chrome::kChromeUIDevToolsHost) | 165 if (url.host() == chrome::kChromeUIDevToolsHost) |
| 161 return &NewWebUI<DevToolsUI>; | 166 return &NewWebUI<DevToolsUI>; |
| 162 #if defined(OS_WIN) | 167 #if defined(OS_WIN) |
| 163 if (url.host() == chrome::kChromeUIConflictsHost) | 168 if (url.host() == chrome::kChromeUIConflictsHost) |
| 164 return &NewWebUI<ConflictsUI>; | 169 return &NewWebUI<ConflictsUI>; |
| 165 #endif | 170 #endif |
| 166 if (url.host() == chrome::kChromeUIDownloadsHost) | 171 if (url.host() == chrome::kChromeUIDownloadsHost) |
| 167 return &NewWebUI<DownloadsUI>; | 172 return &NewWebUI<DownloadsUI>; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 return FlashUI::GetFaviconResourceBytes(); | 398 return FlashUI::GetFaviconResourceBytes(); |
| 394 | 399 |
| 395 if (page_url.host() == chrome::kChromeUISettingsHost) | 400 if (page_url.host() == chrome::kChromeUISettingsHost) |
| 396 return OptionsUI::GetFaviconResourceBytes(); | 401 return OptionsUI::GetFaviconResourceBytes(); |
| 397 | 402 |
| 398 if (page_url.host() == chrome::kChromeUIPluginsHost) | 403 if (page_url.host() == chrome::kChromeUIPluginsHost) |
| 399 return PluginsUI::GetFaviconResourceBytes(); | 404 return PluginsUI::GetFaviconResourceBytes(); |
| 400 | 405 |
| 401 return NULL; | 406 return NULL; |
| 402 } | 407 } |
| OLD | NEW |