Chromium Code Reviews| 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/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/tab_contents/tab_contents_wrapper.h" | 15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 16 #include "chrome/browser/ui/webui/help/help_ui.h" | 16 #include "chrome/browser/ui/webui/help/help_ui.h" |
| 17 #include "chrome/browser/ui/webui/about_ui.h" | 17 #include "chrome/browser/ui/webui/about_ui.h" |
| 18 #include "chrome/browser/ui/webui/bookmarks_ui.h" | 18 #include "chrome/browser/ui/webui/bookmarks_ui.h" |
| 19 #include "chrome/browser/ui/webui/constrained_html_ui.h" | 19 #include "chrome/browser/ui/webui/constrained_html_ui.h" |
| 20 #include "chrome/browser/ui/webui/crashes_ui.h" | 20 #include "chrome/browser/ui/webui/crashes_ui.h" |
| 21 #include "chrome/browser/ui/webui/devtools_ui.h" | 21 #include "chrome/browser/ui/webui/devtools_ui.h" |
| 22 #include "chrome/browser/ui/webui/downloads_ui.h" | 22 #include "chrome/browser/ui/webui/downloads_ui.h" |
| 23 #include "chrome/browser/ui/webui/extensions/extension_activity_ui.h" | 23 #include "chrome/browser/ui/webui/extensions/extension_activity_ui.h" |
| 24 #include "chrome/browser/ui/webui/extensions/extensions_ui.h" | 24 #include "chrome/browser/ui/webui/extensions/extensions_ui.h" |
| 25 #include "chrome/browser/ui/webui/feedback_ui.h" | 25 #include "chrome/browser/ui/webui/feedback_ui.h" |
| 26 #include "chrome/browser/ui/webui/task_manager/task_manager_ui.h" | |
| 27 #include "chrome/browser/ui/webui/flags_ui.h" | 26 #include "chrome/browser/ui/webui/flags_ui.h" |
| 28 #include "chrome/browser/ui/webui/flash_ui.h" | 27 #include "chrome/browser/ui/webui/flash_ui.h" |
| 29 #include "chrome/browser/ui/webui/generic_handler.h" | 28 #include "chrome/browser/ui/webui/generic_handler.h" |
| 30 #include "chrome/browser/ui/webui/gpu_internals_ui.h" | 29 #include "chrome/browser/ui/webui/gpu_internals_ui.h" |
| 31 #include "chrome/browser/ui/webui/history_ui.h" | 30 #include "chrome/browser/ui/webui/history_ui.h" |
| 32 #include "chrome/browser/ui/webui/html_dialog_ui.h" | 31 #include "chrome/browser/ui/webui/html_dialog_ui.h" |
| 33 #include "chrome/browser/ui/webui/inspect_ui.h" | 32 #include "chrome/browser/ui/webui/inspect_ui.h" |
| 34 #include "chrome/browser/ui/webui/media/media_internals_ui.h" | 33 #include "chrome/browser/ui/webui/media/media_internals_ui.h" |
| 35 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" | 34 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" |
| 36 #include "chrome/browser/ui/webui/network_action_predictor/network_action_predic tor_ui.h" | 35 #include "chrome/browser/ui/webui/network_action_predictor/network_action_predic tor_ui.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 #endif | 79 #endif |
| 81 | 80 |
| 82 #if defined(OS_WIN) | 81 #if defined(OS_WIN) |
| 83 #include "chrome/browser/ui/webui/conflicts_ui.h" | 82 #include "chrome/browser/ui/webui/conflicts_ui.h" |
| 84 #endif | 83 #endif |
| 85 | 84 |
| 86 #if (defined(USE_NSS) || defined(USE_OPENSSL)) && defined(USE_AURA) | 85 #if (defined(USE_NSS) || defined(USE_OPENSSL)) && defined(USE_AURA) |
| 87 #include "chrome/browser/ui/webui/certificate_viewer_ui.h" | 86 #include "chrome/browser/ui/webui/certificate_viewer_ui.h" |
| 88 #endif | 87 #endif |
| 89 | 88 |
| 89 #if defined(ENABLE_TASK_MANAGER) | |
|
jam
2012/04/02 15:49:28
ditto
| |
| 90 #include "chrome/browser/ui/webui/task_manager/task_manager_ui.h" | |
| 91 #endif // defined(ENABLE_TASK_MANAGER) | |
| 92 | |
| 90 using content::WebContents; | 93 using content::WebContents; |
| 91 using content::WebUI; | 94 using content::WebUI; |
| 92 using content::WebUIController; | 95 using content::WebUIController; |
| 93 | 96 |
| 94 namespace { | 97 namespace { |
| 95 | 98 |
| 96 // A function for creating a new WebUI. The caller owns the return value, which | 99 // A function for creating a new WebUI. The caller owns the return value, which |
| 97 // may be NULL (for example, if the URL refers to an non-existent extension). | 100 // may be NULL (for example, if the URL refers to an non-existent extension). |
| 98 typedef WebUIController* (*WebUIFactoryFunction)(content::WebUI* web_ui, | 101 typedef WebUIController* (*WebUIFactoryFunction)(content::WebUI* web_ui, |
| 99 const GURL& url); | 102 const GURL& url); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 if (url.host() == chrome::kChromeUIProfilerHost) | 205 if (url.host() == chrome::kChromeUIProfilerHost) |
| 203 return &NewWebUI<ProfilerUI>; | 206 return &NewWebUI<ProfilerUI>; |
| 204 if (url.host() == chrome::kChromeUIQuotaInternalsHost) | 207 if (url.host() == chrome::kChromeUIQuotaInternalsHost) |
| 205 return &NewWebUI<QuotaInternalsUI>; | 208 return &NewWebUI<QuotaInternalsUI>; |
| 206 if (url.host() == chrome::kChromeUISessionsHost) | 209 if (url.host() == chrome::kChromeUISessionsHost) |
| 207 return &NewWebUI<SessionsUI>; | 210 return &NewWebUI<SessionsUI>; |
| 208 if (url.host() == chrome::kChromeUISyncInternalsHost) | 211 if (url.host() == chrome::kChromeUISyncInternalsHost) |
| 209 return &NewWebUI<SyncInternalsUI>; | 212 return &NewWebUI<SyncInternalsUI>; |
| 210 if (url.host() == chrome::kChromeUISyncResourcesHost) | 213 if (url.host() == chrome::kChromeUISyncResourcesHost) |
| 211 return &NewWebUI<HtmlDialogUI>; | 214 return &NewWebUI<HtmlDialogUI>; |
| 212 if (url.host() == chrome::kChromeUITaskManagerHost) | |
| 213 return &NewWebUI<TaskManagerUI>; | |
| 214 if (url.host() == chrome::kChromeUITracingHost) | 215 if (url.host() == chrome::kChromeUITracingHost) |
| 215 return &NewWebUI<TracingUI>; | 216 return &NewWebUI<TracingUI>; |
| 216 if (url.host() == chrome::kChromeUIUberFrameHost) | 217 if (url.host() == chrome::kChromeUIUberFrameHost) |
| 217 return &NewWebUI<UberFrameUI>; | 218 return &NewWebUI<UberFrameUI>; |
| 218 if (url.host() == chrome::kChromeUIUberHost) | 219 if (url.host() == chrome::kChromeUIUberHost) |
| 219 return &NewWebUI<UberUI>; | 220 return &NewWebUI<UberUI>; |
| 220 | 221 |
| 221 /**************************************************************************** | 222 /**************************************************************************** |
| 222 * OS Specific #defines | 223 * OS Specific #defines |
| 223 ***************************************************************************/ | 224 ***************************************************************************/ |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 return &NewWebUI<SystemInfoUI>; | 280 return &NewWebUI<SystemInfoUI>; |
| 280 #endif // defined(OS_CHROMEOS) | 281 #endif // defined(OS_CHROMEOS) |
| 281 | 282 |
| 282 /**************************************************************************** | 283 /**************************************************************************** |
| 283 * Other #defines and special logics. | 284 * Other #defines and special logics. |
| 284 ***************************************************************************/ | 285 ***************************************************************************/ |
| 285 #if defined(ENABLE_CONFIGURATION_POLICY) | 286 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 286 if (url.host() == chrome::kChromeUIPolicyHost) | 287 if (url.host() == chrome::kChromeUIPolicyHost) |
| 287 return &NewWebUI<PolicyUI>; | 288 return &NewWebUI<PolicyUI>; |
| 288 #endif | 289 #endif |
| 290 #if defined(ENABLE_TASK_MANAGER) | |
| 291 if (url.host() == chrome::kChromeUITaskManagerHost) | |
| 292 return &NewWebUI<TaskManagerUI>; | |
| 293 #endif // defined(ENABLE_TASK_MANAGER) | |
| 289 #if defined(USE_VIRTUAL_KEYBOARD) | 294 #if defined(USE_VIRTUAL_KEYBOARD) |
| 290 if (url.host() == chrome::kChromeUIKeyboardHost) | 295 if (url.host() == chrome::kChromeUIKeyboardHost) |
| 291 return &NewWebUI<KeyboardUI>; | 296 return &NewWebUI<KeyboardUI>; |
| 292 #endif | 297 #endif |
| 293 | 298 |
| 294 #if (defined(OS_LINUX) && defined(TOOLKIT_VIEWS)) || defined(USE_AURA) | 299 #if (defined(OS_LINUX) && defined(TOOLKIT_VIEWS)) || defined(USE_AURA) |
| 295 if (url.host() == chrome::kChromeUICollectedCookiesHost || | 300 if (url.host() == chrome::kChromeUICollectedCookiesHost || |
| 296 url.host() == chrome::kChromeUIHttpAuthHost || | 301 url.host() == chrome::kChromeUIHttpAuthHost || |
| 297 url.host() == chrome::kChromeUITabModalConfirmDialogHost) { | 302 url.host() == chrome::kChromeUITabModalConfirmDialogHost) { |
| 298 return &NewWebUI<ConstrainedHtmlUI>; | 303 return &NewWebUI<ConstrainedHtmlUI>; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 312 } | 317 } |
| 313 #endif | 318 #endif |
| 314 | 319 |
| 315 if (url.host() == chrome::kChromeUIChromeURLsHost || | 320 if (url.host() == chrome::kChromeUIChromeURLsHost || |
| 316 url.host() == chrome::kChromeUICreditsHost || | 321 url.host() == chrome::kChromeUICreditsHost || |
| 317 url.host() == chrome::kChromeUIDNSHost || | 322 url.host() == chrome::kChromeUIDNSHost || |
| 318 url.host() == chrome::kChromeUIHistogramsHost || | 323 url.host() == chrome::kChromeUIHistogramsHost || |
| 319 url.host() == chrome::kChromeUIMemoryHost || | 324 url.host() == chrome::kChromeUIMemoryHost || |
| 320 url.host() == chrome::kChromeUIMemoryRedirectHost || | 325 url.host() == chrome::kChromeUIMemoryRedirectHost || |
| 321 url.host() == chrome::kChromeUIStatsHost || | 326 url.host() == chrome::kChromeUIStatsHost || |
| 322 url.host() == chrome::kChromeUITaskManagerHost || | |
| 323 url.host() == chrome::kChromeUITermsHost || | 327 url.host() == chrome::kChromeUITermsHost || |
| 324 url.host() == chrome::kChromeUIVersionHost | 328 url.host() == chrome::kChromeUIVersionHost |
| 325 #if defined(USE_TCMALLOC) | 329 #if defined(USE_TCMALLOC) |
| 326 || url.host() == chrome::kChromeUITCMallocHost | 330 || url.host() == chrome::kChromeUITCMallocHost |
| 327 #endif | 331 #endif |
| 328 #if defined(OS_LINUX) || defined(OS_OPENBSD) | 332 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
| 329 || url.host() == chrome::kChromeUILinuxProxyConfigHost | 333 || url.host() == chrome::kChromeUILinuxProxyConfigHost |
| 330 || url.host() == chrome::kChromeUISandboxHost | 334 || url.host() == chrome::kChromeUISandboxHost |
| 331 #endif | 335 #endif |
| 332 #if defined(OS_CHROMEOS) | 336 #if defined(OS_CHROMEOS) |
| 333 || url.host() == chrome::kChromeUICryptohomeHost | 337 || url.host() == chrome::kChromeUICryptohomeHost |
| 334 || url.host() == chrome::kChromeUIDiscardsHost | 338 || url.host() == chrome::kChromeUIDiscardsHost |
| 335 || url.host() == chrome::kChromeUINetworkHost | 339 || url.host() == chrome::kChromeUINetworkHost |
| 336 || url.host() == chrome::kChromeUIOSCreditsHost | 340 || url.host() == chrome::kChromeUIOSCreditsHost |
| 337 || url.host() == chrome::kChromeUITransparencyHost | 341 || url.host() == chrome::kChromeUITransparencyHost |
| 338 #endif | 342 #endif |
| 343 #if defined(ENABLE_TASK_MANAGER) | |
| 344 || url.host() == chrome::kChromeUITaskManagerHost | |
| 345 #endif | |
| 339 ) { | 346 ) { |
| 340 return &NewWebUI<AboutUI>; | 347 return &NewWebUI<AboutUI>; |
| 341 } | 348 } |
| 342 | 349 |
| 343 if (url.host() == chrome::kChromeUIExtensionActivityHost && | 350 if (url.host() == chrome::kChromeUIExtensionActivityHost && |
| 344 CommandLine::ForCurrentProcess()->HasSwitch( | 351 CommandLine::ForCurrentProcess()->HasSwitch( |
| 345 switches::kEnableExtensionActivityUI)) { | 352 switches::kEnableExtensionActivityUI)) { |
| 346 return &NewWebUI<ExtensionActivityUI>; | 353 return &NewWebUI<ExtensionActivityUI>; |
| 347 } | 354 } |
| 348 | 355 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 495 // Android doesn't use the Options pages. | 502 // Android doesn't use the Options pages. |
| 496 if (page_url.host() == chrome::kChromeUISettingsFrameHost) | 503 if (page_url.host() == chrome::kChromeUISettingsFrameHost) |
| 497 return options2::OptionsUI::GetFaviconResourceBytes(); | 504 return options2::OptionsUI::GetFaviconResourceBytes(); |
| 498 #endif | 505 #endif |
| 499 | 506 |
| 500 if (page_url.host() == chrome::kChromeUIPluginsHost) | 507 if (page_url.host() == chrome::kChromeUIPluginsHost) |
| 501 return PluginsUI::GetFaviconResourceBytes(); | 508 return PluginsUI::GetFaviconResourceBytes(); |
| 502 | 509 |
| 503 return NULL; | 510 return NULL; |
| 504 } | 511 } |
| OLD | NEW |