| 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" |
| 28 #include "chrome/browser/ui/webui/media/media_internals_ui.h" | 29 #include "chrome/browser/ui/webui/media/media_internals_ui.h" |
| 29 #include "chrome/browser/ui/webui/net_internals_ui.h" | 30 #include "chrome/browser/ui/webui/net_internals_ui.h" |
| 30 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 31 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 31 #include "chrome/browser/ui/webui/options/options_ui.h" | 32 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 32 #include "chrome/browser/ui/webui/plugins_ui.h" | 33 #include "chrome/browser/ui/webui/plugins_ui.h" |
| 33 #include "chrome/browser/ui/webui/policy_ui.h" | 34 #include "chrome/browser/ui/webui/policy_ui.h" |
| 34 #include "chrome/browser/ui/webui/print_preview_ui.h" | 35 #include "chrome/browser/ui/webui/print_preview_ui.h" |
| 35 #include "chrome/browser/ui/webui/quota_internals_ui.h" | 36 #include "chrome/browser/ui/webui/quota_internals_ui.h" |
| 36 #include "chrome/browser/ui/webui/sessions_ui.h" | 37 #include "chrome/browser/ui/webui/sessions_ui.h" |
| 37 #include "chrome/browser/ui/webui/sync_internals_ui.h" | 38 #include "chrome/browser/ui/webui/sync_internals_ui.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 62 #endif | 63 #endif |
| 63 | 64 |
| 64 #if defined(TOUCH_UI) | 65 #if defined(TOUCH_UI) |
| 65 #include "chrome/browser/ui/webui/keyboard_ui.h" | 66 #include "chrome/browser/ui/webui/keyboard_ui.h" |
| 66 #endif | 67 #endif |
| 67 | 68 |
| 68 #if defined(OS_WIN) | 69 #if defined(OS_WIN) |
| 69 #include "chrome/browser/ui/webui/conflicts_ui.h" | 70 #include "chrome/browser/ui/webui/conflicts_ui.h" |
| 70 #endif | 71 #endif |
| 71 | 72 |
| 72 #if defined(WEBUI_DIALOGS) && defined(OS_POSIX) && !defined(OS_MACOSX) | 73 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 73 #include "chrome/browser/ui/webui/certificate_viewer_ui.h" | 74 #include "chrome/browser/ui/webui/certificate_viewer_ui.h" |
| 74 #endif | 75 #endif |
| 75 | 76 |
| 76 #if defined(WEBUI_DIALOGS) | |
| 77 #include "chrome/browser/ui/webui/hung_renderer_dialog_ui.h" | |
| 78 #endif | |
| 79 | |
| 80 namespace { | 77 namespace { |
| 81 | 78 |
| 82 // A function for creating a new WebUI. The caller owns the return value, which | 79 // A function for creating a new WebUI. The caller owns the return value, which |
| 83 // may be NULL (for example, if the URL refers to an non-existent extension). | 80 // may be NULL (for example, if the URL refers to an non-existent extension). |
| 84 typedef ChromeWebUI* (*WebUIFactoryFunction)(TabContents* tab_contents, | 81 typedef ChromeWebUI* (*WebUIFactoryFunction)(TabContents* tab_contents, |
| 85 const GURL& url); | 82 const GURL& url); |
| 86 | 83 |
| 87 // Template for defining WebUIFactoryFunction. | 84 // Template for defining WebUIFactoryFunction. |
| 88 template<class T> | 85 template<class T> |
| 89 ChromeWebUI* NewWebUI(TabContents* contents, const GURL& url) { | 86 ChromeWebUI* NewWebUI(TabContents* contents, const GURL& url) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 if (url.host() == chrome::kChromeUIAboutHost || | 141 if (url.host() == chrome::kChromeUIAboutHost || |
| 145 url.host() == chrome::kChromeUIChromeURLsHost) | 142 url.host() == chrome::kChromeUIChromeURLsHost) |
| 146 return &NewWebUI<ChromeWebUI>; | 143 return &NewWebUI<ChromeWebUI>; |
| 147 | 144 |
| 148 // We must compare hosts only since some of the Web UIs append extra stuff | 145 // We must compare hosts only since some of the Web UIs append extra stuff |
| 149 // after the host name. | 146 // after the host name. |
| 150 if (url.host() == chrome::kChromeUIBookmarksHost) | 147 if (url.host() == chrome::kChromeUIBookmarksHost) |
| 151 return &NewWebUI<BookmarksUI>; | 148 return &NewWebUI<BookmarksUI>; |
| 152 if (url.host() == chrome::kChromeUIBugReportHost) | 149 if (url.host() == chrome::kChromeUIBugReportHost) |
| 153 return &NewWebUI<BugReportUI>; | 150 return &NewWebUI<BugReportUI>; |
| 154 #if defined(WEBUI_DIALOGS) && defined(OS_POSIX) && !defined(OS_MACOSX) | 151 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 155 if (url.host() == chrome::kChromeUICertificateViewerHost) | 152 if (url.host() == chrome::kChromeUICertificateViewerHost) |
| 156 return &NewWebUI<CertificateViewerUI>; | 153 return &NewWebUI<CertificateViewerUI>; |
| 157 #endif | 154 #endif |
| 158 #if defined(WEBUI_DIALOGS) | |
| 159 if (url.host() == chrome::kChromeUIHungRendererDialogHost) { | 155 if (url.host() == chrome::kChromeUIHungRendererDialogHost) { |
| 160 return &NewWebUI<HungRendererDialogUI>; | 156 return &NewWebUI<HungRendererDialogUI>; |
| 161 } | 157 } |
| 162 #endif | |
| 163 if (url.host() == chrome::kChromeUICrashesHost) | 158 if (url.host() == chrome::kChromeUICrashesHost) |
| 164 return &NewWebUI<CrashesUI>; | 159 return &NewWebUI<CrashesUI>; |
| 165 if (url.host() == chrome::kChromeUIDevToolsHost) | 160 if (url.host() == chrome::kChromeUIDevToolsHost) |
| 166 return &NewWebUI<DevToolsUI>; | 161 return &NewWebUI<DevToolsUI>; |
| 167 #if defined(OS_WIN) | 162 #if defined(OS_WIN) |
| 168 if (url.host() == chrome::kChromeUIConflictsHost) | 163 if (url.host() == chrome::kChromeUIConflictsHost) |
| 169 return &NewWebUI<ConflictsUI>; | 164 return &NewWebUI<ConflictsUI>; |
| 170 #endif | 165 #endif |
| 171 if (url.host() == chrome::kChromeUIDownloadsHost) | 166 if (url.host() == chrome::kChromeUIDownloadsHost) |
| 172 return &NewWebUI<DownloadsUI>; | 167 return &NewWebUI<DownloadsUI>; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 return FlashUI::GetFaviconResourceBytes(); | 393 return FlashUI::GetFaviconResourceBytes(); |
| 399 | 394 |
| 400 if (page_url.host() == chrome::kChromeUISettingsHost) | 395 if (page_url.host() == chrome::kChromeUISettingsHost) |
| 401 return OptionsUI::GetFaviconResourceBytes(); | 396 return OptionsUI::GetFaviconResourceBytes(); |
| 402 | 397 |
| 403 if (page_url.host() == chrome::kChromeUIPluginsHost) | 398 if (page_url.host() == chrome::kChromeUIPluginsHost) |
| 404 return PluginsUI::GetFaviconResourceBytes(); | 399 return PluginsUI::GetFaviconResourceBytes(); |
| 405 | 400 |
| 406 return NULL; | 401 return NULL; |
| 407 } | 402 } |
| OLD | NEW |