| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_controller_factory.h" | 5 #include "chrome/browser/ui/webui/chrome_web_ui_controller_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/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| 11 #include "chrome/browser/extensions/extension_web_ui.h" | 11 #include "chrome/browser/extensions/extension_web_ui.h" |
| 12 #include "chrome/browser/history/history_types.h" | 12 #include "chrome/browser/history/history_types.h" |
| 13 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
| 16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 17 #include "chrome/browser/ui/webui/help/help_ui.h" | 17 #include "chrome/browser/ui/webui/help/help_ui.h" |
| 18 #include "chrome/browser/ui/webui/about_ui.h" | 18 #include "chrome/browser/ui/webui/about_ui.h" |
| 19 #include "chrome/browser/ui/webui/bookmarks_ui.h" | 19 #include "chrome/browser/ui/webui/bookmarks_ui.h" |
| 20 #include "chrome/browser/ui/webui/constrained_html_ui.h" | 20 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" |
| 21 #include "chrome/browser/ui/webui/crashes_ui.h" | 21 #include "chrome/browser/ui/webui/crashes_ui.h" |
| 22 #include "chrome/browser/ui/webui/devtools_ui.h" | 22 #include "chrome/browser/ui/webui/devtools_ui.h" |
| 23 #include "chrome/browser/ui/webui/downloads_ui.h" | 23 #include "chrome/browser/ui/webui/downloads_ui.h" |
| 24 #include "chrome/browser/ui/webui/extensions/extension_activity_ui.h" | 24 #include "chrome/browser/ui/webui/extensions/extension_activity_ui.h" |
| 25 #include "chrome/browser/ui/webui/extensions/extensions_ui.h" | 25 #include "chrome/browser/ui/webui/extensions/extensions_ui.h" |
| 26 #include "chrome/browser/ui/webui/feedback_ui.h" | 26 #include "chrome/browser/ui/webui/feedback_ui.h" |
| 27 #include "chrome/browser/ui/webui/task_manager/task_manager_ui.h" | 27 #include "chrome/browser/ui/webui/task_manager/task_manager_ui.h" |
| 28 #include "chrome/browser/ui/webui/flags_ui.h" | 28 #include "chrome/browser/ui/webui/flags_ui.h" |
| 29 #include "chrome/browser/ui/webui/flash_ui.h" | 29 #include "chrome/browser/ui/webui/flash_ui.h" |
| 30 #include "chrome/browser/ui/webui/generic_handler.h" | 30 #include "chrome/browser/ui/webui/generic_handler.h" |
| 31 #include "chrome/browser/ui/webui/gpu_internals_ui.h" | 31 #include "chrome/browser/ui/webui/gpu_internals_ui.h" |
| 32 #include "chrome/browser/ui/webui/history_ui.h" | 32 #include "chrome/browser/ui/webui/history_ui.h" |
| 33 #include "chrome/browser/ui/webui/html_dialog_ui.h" | 33 #include "chrome/browser/ui/webui/web_dialog_ui.h" |
| 34 #include "chrome/browser/ui/webui/inspect_ui.h" | 34 #include "chrome/browser/ui/webui/inspect_ui.h" |
| 35 #include "chrome/browser/ui/webui/media/media_internals_ui.h" | 35 #include "chrome/browser/ui/webui/media/media_internals_ui.h" |
| 36 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" | 36 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" |
| 37 #include "chrome/browser/ui/webui/network_action_predictor/network_action_predic
tor_ui.h" | 37 #include "chrome/browser/ui/webui/network_action_predictor/network_action_predic
tor_ui.h" |
| 38 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 38 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 39 #include "chrome/browser/ui/webui/omnibox/omnibox_ui.h" | 39 #include "chrome/browser/ui/webui/omnibox/omnibox_ui.h" |
| 40 #include "chrome/browser/ui/webui/options2/options_ui2.h" | 40 #include "chrome/browser/ui/webui/options2/options_ui2.h" |
| 41 #include "chrome/browser/ui/webui/plugins_ui.h" | 41 #include "chrome/browser/ui/webui/plugins_ui.h" |
| 42 #include "chrome/browser/ui/webui/policy_ui.h" | 42 #include "chrome/browser/ui/webui/policy_ui.h" |
| 43 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" | 43 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 * required, add it below in the appropriate section. | 160 * required, add it below in the appropriate section. |
| 161 ***************************************************************************/ | 161 ***************************************************************************/ |
| 162 // We must compare hosts only since some of the Web UIs append extra stuff | 162 // We must compare hosts only since some of the Web UIs append extra stuff |
| 163 // after the host name. | 163 // after the host name. |
| 164 if (url.host() == chrome::kChromeUIBookmarksHost) | 164 if (url.host() == chrome::kChromeUIBookmarksHost) |
| 165 return &NewWebUI<BookmarksUI>; | 165 return &NewWebUI<BookmarksUI>; |
| 166 // All platform builds of Chrome will need to have a cloud printing | 166 // All platform builds of Chrome will need to have a cloud printing |
| 167 // dialog as backup. It's just that on Chrome OS, it's the only | 167 // dialog as backup. It's just that on Chrome OS, it's the only |
| 168 // print dialog. | 168 // print dialog. |
| 169 if (url.host() == chrome::kChromeUICloudPrintResourcesHost) | 169 if (url.host() == chrome::kChromeUICloudPrintResourcesHost) |
| 170 return &NewWebUI<ExternalHtmlDialogUI>; | 170 return &NewWebUI<ExternalWebDialogUI>; |
| 171 if (url.host() == chrome::kChromeUICloudPrintSetupHost) | 171 if (url.host() == chrome::kChromeUICloudPrintSetupHost) |
| 172 return &NewWebUI<HtmlDialogUI>; | 172 return &NewWebUI<WebDialogUI>; |
| 173 if (url.spec() == chrome::kChromeUIConstrainedHTMLTestURL) | 173 if (url.spec() == chrome::kChromeUIConstrainedHTMLTestURL) |
| 174 return &NewWebUI<ConstrainedHtmlUI>; | 174 return &NewWebUI<ConstrainedWebDialogUI>; |
| 175 if (url.host() == chrome::kChromeUICrashesHost) | 175 if (url.host() == chrome::kChromeUICrashesHost) |
| 176 return &NewWebUI<CrashesUI>; | 176 return &NewWebUI<CrashesUI>; |
| 177 if (url.host() == chrome::kChromeUIDevToolsHost) | 177 if (url.host() == chrome::kChromeUIDevToolsHost) |
| 178 return &NewWebUI<DevToolsUI>; | 178 return &NewWebUI<DevToolsUI>; |
| 179 if (url.host() == chrome::kChromeUIDialogHost) | 179 if (url.host() == chrome::kChromeUIDialogHost) |
| 180 return &NewWebUI<ConstrainedHtmlUI>; | 180 return &NewWebUI<ConstrainedWebDialogUI>; |
| 181 if (url.host() == chrome::kChromeUIExtensionsFrameHost) | 181 if (url.host() == chrome::kChromeUIExtensionsFrameHost) |
| 182 return &NewWebUI<ExtensionsUI>; | 182 return &NewWebUI<ExtensionsUI>; |
| 183 if (url.host() == chrome::kChromeUIFlashHost) | 183 if (url.host() == chrome::kChromeUIFlashHost) |
| 184 return &NewWebUI<FlashUI>; | 184 return &NewWebUI<FlashUI>; |
| 185 if (url.host() == chrome::kChromeUIGpuInternalsHost) | 185 if (url.host() == chrome::kChromeUIGpuInternalsHost) |
| 186 return &NewWebUI<GpuInternalsUI>; | 186 return &NewWebUI<GpuInternalsUI>; |
| 187 if (url.host() == chrome::kChromeUIHistoryFrameHost) | 187 if (url.host() == chrome::kChromeUIHistoryFrameHost) |
| 188 return &NewWebUI<HistoryUI>; | 188 return &NewWebUI<HistoryUI>; |
| 189 if (url.host() == chrome::kChromeUIMediaInternalsHost) | 189 if (url.host() == chrome::kChromeUIMediaInternalsHost) |
| 190 return &NewWebUI<MediaInternalsUI>; | 190 return &NewWebUI<MediaInternalsUI>; |
| 191 if (url.host() == chrome::kChromeUINetInternalsHost) | 191 if (url.host() == chrome::kChromeUINetInternalsHost) |
| 192 return &NewWebUI<NetInternalsUI>; | 192 return &NewWebUI<NetInternalsUI>; |
| 193 if (url.host() == chrome::kChromeUINetworkActionPredictorHost) | 193 if (url.host() == chrome::kChromeUINetworkActionPredictorHost) |
| 194 return &NewWebUI<NetworkActionPredictorUI>; | 194 return &NewWebUI<NetworkActionPredictorUI>; |
| 195 if (url.host() == chrome::kChromeUIOmniboxHost) | 195 if (url.host() == chrome::kChromeUIOmniboxHost) |
| 196 return &NewWebUI<OmniboxUI>; | 196 return &NewWebUI<OmniboxUI>; |
| 197 if (url.host() == chrome::kChromeUIProfilerHost) | 197 if (url.host() == chrome::kChromeUIProfilerHost) |
| 198 return &NewWebUI<ProfilerUI>; | 198 return &NewWebUI<ProfilerUI>; |
| 199 if (url.host() == chrome::kChromeUIQuotaInternalsHost) | 199 if (url.host() == chrome::kChromeUIQuotaInternalsHost) |
| 200 return &NewWebUI<QuotaInternalsUI>; | 200 return &NewWebUI<QuotaInternalsUI>; |
| 201 if (url.host() == chrome::kChromeUISessionsHost) | 201 if (url.host() == chrome::kChromeUISessionsHost) |
| 202 return &NewWebUI<SessionsUI>; | 202 return &NewWebUI<SessionsUI>; |
| 203 if (url.host() == chrome::kChromeUISyncInternalsHost) | 203 if (url.host() == chrome::kChromeUISyncInternalsHost) |
| 204 return &NewWebUI<SyncInternalsUI>; | 204 return &NewWebUI<SyncInternalsUI>; |
| 205 if (url.host() == chrome::kChromeUISyncResourcesHost) | 205 if (url.host() == chrome::kChromeUISyncResourcesHost) |
| 206 return &NewWebUI<HtmlDialogUI>; | 206 return &NewWebUI<WebDialogUI>; |
| 207 if (url.host() == chrome::kChromeUITracingHost) | 207 if (url.host() == chrome::kChromeUITracingHost) |
| 208 return &NewWebUI<TracingUI>; | 208 return &NewWebUI<TracingUI>; |
| 209 if (url.host() == chrome::kChromeUIUberFrameHost) | 209 if (url.host() == chrome::kChromeUIUberFrameHost) |
| 210 return &NewWebUI<UberFrameUI>; | 210 return &NewWebUI<UberFrameUI>; |
| 211 if (url.host() == chrome::kChromeUIUberHost) | 211 if (url.host() == chrome::kChromeUIUberHost) |
| 212 return &NewWebUI<UberUI>; | 212 return &NewWebUI<UberUI>; |
| 213 | 213 |
| 214 /**************************************************************************** | 214 /**************************************************************************** |
| 215 * OS Specific #defines | 215 * OS Specific #defines |
| 216 ***************************************************************************/ | 216 ***************************************************************************/ |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 #endif // defined(ENABLE_TASK_MANAGER) | 284 #endif // defined(ENABLE_TASK_MANAGER) |
| 285 #if defined(USE_VIRTUAL_KEYBOARD) | 285 #if defined(USE_VIRTUAL_KEYBOARD) |
| 286 if (url.host() == chrome::kChromeUIKeyboardHost) | 286 if (url.host() == chrome::kChromeUIKeyboardHost) |
| 287 return &NewWebUI<KeyboardUI>; | 287 return &NewWebUI<KeyboardUI>; |
| 288 #endif | 288 #endif |
| 289 | 289 |
| 290 #if (defined(OS_LINUX) && defined(TOOLKIT_VIEWS)) || defined(USE_AURA) | 290 #if (defined(OS_LINUX) && defined(TOOLKIT_VIEWS)) || defined(USE_AURA) |
| 291 if (url.host() == chrome::kChromeUICollectedCookiesHost || | 291 if (url.host() == chrome::kChromeUICollectedCookiesHost || |
| 292 url.host() == chrome::kChromeUIHttpAuthHost || | 292 url.host() == chrome::kChromeUIHttpAuthHost || |
| 293 url.host() == chrome::kChromeUITabModalConfirmDialogHost) { | 293 url.host() == chrome::kChromeUITabModalConfirmDialogHost) { |
| 294 return &NewWebUI<ConstrainedHtmlUI>; | 294 return &NewWebUI<ConstrainedWebDialogUI>; |
| 295 } | 295 } |
| 296 #endif | 296 #endif |
| 297 | 297 |
| 298 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) | 298 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) |
| 299 if (url.host() == chrome::kChromeUISyncPromoHost) { | 299 if (url.host() == chrome::kChromeUISyncPromoHost) { |
| 300 // If the sync promo page is enabled then use the sync promo WebUI otherwise | 300 // If the sync promo page is enabled then use the sync promo WebUI otherwise |
| 301 // use the NTP WebUI. We don't want to return NULL if the sync promo page | 301 // use the NTP WebUI. We don't want to return NULL if the sync promo page |
| 302 // is disabled because the page can be disabled mid-flight (for example, | 302 // is disabled because the page can be disabled mid-flight (for example, |
| 303 // if sync login finishes). | 303 // if sync login finishes). |
| 304 if (SyncPromoUI::ShouldShowSyncPromo(profile)) | 304 if (SyncPromoUI::ShouldShowSyncPromo(profile)) |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 if (page_url.host() == chrome::kChromeUISettingsFrameHost) | 502 if (page_url.host() == chrome::kChromeUISettingsFrameHost) |
| 503 return options2::OptionsUI::GetFaviconResourceBytes(); | 503 return options2::OptionsUI::GetFaviconResourceBytes(); |
| 504 | 504 |
| 505 // Android doesn't use the plugins pages. | 505 // Android doesn't use the plugins pages. |
| 506 if (page_url.host() == chrome::kChromeUIPluginsHost) | 506 if (page_url.host() == chrome::kChromeUIPluginsHost) |
| 507 return PluginsUI::GetFaviconResourceBytes(); | 507 return PluginsUI::GetFaviconResourceBytes(); |
| 508 #endif | 508 #endif |
| 509 | 509 |
| 510 return NULL; | 510 return NULL; |
| 511 } | 511 } |
| OLD | NEW |