| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "chrome/browser/about_flags.h" | 15 #include "chrome/browser/about_flags.h" |
| 16 #include "chrome/browser/devtools/devtools_ui_bindings.h" | 16 #include "chrome/browser/devtools/devtools_ui_bindings.h" |
| 17 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" | 17 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" |
| 18 #include "chrome/browser/engagement/site_engagement_service.h" | 18 #include "chrome/browser/engagement/site_engagement_service.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
| 21 #include "chrome/browser/search/suggestions/suggestions_ui.h" | 21 #include "chrome/browser/search/suggestions/suggestions_ui.h" |
| 22 #include "chrome/browser/ui/history_ui.h" |
| 22 #include "chrome/browser/ui/webui/about_ui.h" | 23 #include "chrome/browser/ui/webui/about_ui.h" |
| 23 #include "chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.h" | 24 #include "chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.h" |
| 24 #include "chrome/browser/ui/webui/bookmarks_ui.h" | 25 #include "chrome/browser/ui/webui/bookmarks_ui.h" |
| 25 #include "chrome/browser/ui/webui/components_ui.h" | 26 #include "chrome/browser/ui/webui/components_ui.h" |
| 26 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" | 27 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" |
| 27 #include "chrome/browser/ui/webui/crashes_ui.h" | 28 #include "chrome/browser/ui/webui/crashes_ui.h" |
| 28 #include "chrome/browser/ui/webui/device_log_ui.h" | 29 #include "chrome/browser/ui/webui/device_log_ui.h" |
| 29 #include "chrome/browser/ui/webui/domain_reliability_internals_ui.h" | 30 #include "chrome/browser/ui/webui/domain_reliability_internals_ui.h" |
| 30 #include "chrome/browser/ui/webui/engagement/site_engagement_ui.h" | 31 #include "chrome/browser/ui/webui/engagement/site_engagement_ui.h" |
| 31 #include "chrome/browser/ui/webui/flags_ui.h" | 32 #include "chrome/browser/ui/webui/flags_ui.h" |
| 32 #include "chrome/browser/ui/webui/flash_ui.h" | 33 #include "chrome/browser/ui/webui/flash_ui.h" |
| 33 #include "chrome/browser/ui/webui/gcm_internals_ui.h" | 34 #include "chrome/browser/ui/webui/gcm_internals_ui.h" |
| 34 #include "chrome/browser/ui/webui/help/help_ui.h" | 35 #include "chrome/browser/ui/webui/help/help_ui.h" |
| 35 #include "chrome/browser/ui/webui/history_ui.h" | |
| 36 #include "chrome/browser/ui/webui/identity_internals_ui.h" | 36 #include "chrome/browser/ui/webui/identity_internals_ui.h" |
| 37 #include "chrome/browser/ui/webui/instant_ui.h" | 37 #include "chrome/browser/ui/webui/instant_ui.h" |
| 38 #include "chrome/browser/ui/webui/interstitials/interstitial_ui.h" | 38 #include "chrome/browser/ui/webui/interstitials/interstitial_ui.h" |
| 39 #include "chrome/browser/ui/webui/invalidations_ui.h" | 39 #include "chrome/browser/ui/webui/invalidations_ui.h" |
| 40 #include "chrome/browser/ui/webui/local_state/local_state_ui.h" | 40 #include "chrome/browser/ui/webui/local_state/local_state_ui.h" |
| 41 #include "chrome/browser/ui/webui/log_web_ui_url.h" | 41 #include "chrome/browser/ui/webui/log_web_ui_url.h" |
| 42 #include "chrome/browser/ui/webui/net_export_ui.h" | 42 #include "chrome/browser/ui/webui/net_export_ui.h" |
| 43 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" | 43 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" |
| 44 #include "chrome/browser/ui/webui/ntp_tiles_internals_ui.h" | 44 #include "chrome/browser/ui/webui/ntp_tiles_internals_ui.h" |
| 45 #include "chrome/browser/ui/webui/omnibox/omnibox_ui.h" | 45 #include "chrome/browser/ui/webui/omnibox/omnibox_ui.h" |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 if (url.host_piece() == chrome::kChromeUICrashesHost) | 333 if (url.host_piece() == chrome::kChromeUICrashesHost) |
| 334 return &NewWebUI<CrashesUI>; | 334 return &NewWebUI<CrashesUI>; |
| 335 if (url.host_piece() == chrome::kChromeUIDeviceLogHost) | 335 if (url.host_piece() == chrome::kChromeUIDeviceLogHost) |
| 336 return &NewWebUI<chromeos::DeviceLogUI>; | 336 return &NewWebUI<chromeos::DeviceLogUI>; |
| 337 if (url.host_piece() == chrome::kChromeUIDomainReliabilityInternalsHost) | 337 if (url.host_piece() == chrome::kChromeUIDomainReliabilityInternalsHost) |
| 338 return &NewWebUI<DomainReliabilityInternalsUI>; | 338 return &NewWebUI<DomainReliabilityInternalsUI>; |
| 339 if (url.host_piece() == chrome::kChromeUIFlagsHost) | 339 if (url.host_piece() == chrome::kChromeUIFlagsHost) |
| 340 return &NewWebUI<FlagsUI>; | 340 return &NewWebUI<FlagsUI>; |
| 341 if (url.host_piece() == chrome::kChromeUIGCMInternalsHost) | 341 if (url.host_piece() == chrome::kChromeUIGCMInternalsHost) |
| 342 return &NewWebUI<GCMInternalsUI>; | 342 return &NewWebUI<GCMInternalsUI>; |
| 343 if (url.host_piece() == chrome::kChromeUIHistoryFrameHost) | |
| 344 return &NewWebUI<HistoryUI>; | |
| 345 if (url.host_piece() == chrome::kChromeUIInstantHost) | 343 if (url.host_piece() == chrome::kChromeUIInstantHost) |
| 346 return &NewWebUI<InstantUI>; | 344 return &NewWebUI<InstantUI>; |
| 347 if (url.host_piece() == chrome::kChromeUIInterstitialHost) | 345 if (url.host_piece() == chrome::kChromeUIInterstitialHost) |
| 348 return &NewWebUI<InterstitialUI>; | 346 return &NewWebUI<InterstitialUI>; |
| 349 if (url.host_piece() == chrome::kChromeUIInvalidationsHost) | 347 if (url.host_piece() == chrome::kChromeUIInvalidationsHost) |
| 350 return &NewWebUI<InvalidationsUI>; | 348 return &NewWebUI<InvalidationsUI>; |
| 351 if (url.host_piece() == chrome::kChromeUILocalStateHost) | 349 if (url.host_piece() == chrome::kChromeUILocalStateHost) |
| 352 return &NewWebUI<LocalStateUI>; | 350 return &NewWebUI<LocalStateUI>; |
| 353 if (url.host_piece() == chrome::kChromeUINetExportHost) | 351 if (url.host_piece() == chrome::kChromeUINetExportHost) |
| 354 return &NewWebUI<NetExportUI>; | 352 return &NewWebUI<NetExportUI>; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 if (url.host_piece() == chrome::kChromeUINewTabHost) | 424 if (url.host_piece() == chrome::kChromeUINewTabHost) |
| 427 return &NewWebUI<NewTabUI>; | 425 return &NewWebUI<NewTabUI>; |
| 428 if (url.host_piece() == chrome::kChromeUIMdSettingsHost) | 426 if (url.host_piece() == chrome::kChromeUIMdSettingsHost) |
| 429 return &NewWebUI<settings::MdSettingsUI>; | 427 return &NewWebUI<settings::MdSettingsUI>; |
| 430 // If the material design extensions page is enabled, it gets its own host. | 428 // If the material design extensions page is enabled, it gets its own host. |
| 431 // Otherwise, it's handled by the uber settings page. | 429 // Otherwise, it's handled by the uber settings page. |
| 432 if (url.host_piece() == chrome::kChromeUIExtensionsHost && | 430 if (url.host_piece() == chrome::kChromeUIExtensionsHost && |
| 433 base::FeatureList::IsEnabled(features::kMaterialDesignExtensions)) { | 431 base::FeatureList::IsEnabled(features::kMaterialDesignExtensions)) { |
| 434 return &NewWebUI<extensions::ExtensionsUI>; | 432 return &NewWebUI<extensions::ExtensionsUI>; |
| 435 } | 433 } |
| 436 // Material Design history is on its own host, rather than on an Uber page. | 434 if (url.host_piece() == chrome::kChromeUIHistoryHost) |
| 437 if (base::FeatureList::IsEnabled(features::kMaterialDesignHistory) && | |
| 438 url.host_piece() == chrome::kChromeUIHistoryHost) { | |
| 439 return &NewWebUI<MdHistoryUI>; | 435 return &NewWebUI<MdHistoryUI>; |
| 440 } | |
| 441 // Material Design Settings gets its own host, if enabled. | 436 // Material Design Settings gets its own host, if enabled. |
| 442 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings) && | 437 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings) && |
| 443 url.host_piece() == chrome::kChromeUISettingsHost) { | 438 url.host_piece() == chrome::kChromeUISettingsHost) { |
| 444 return &NewWebUI<settings::MdSettingsUI>; | 439 return &NewWebUI<settings::MdSettingsUI>; |
| 445 } | 440 } |
| 446 // Settings are implemented with native UI elements on Android. | 441 // Settings are implemented with native UI elements on Android. |
| 447 // Handle chrome://settings if settings in a window is enabled. | 442 // Handle chrome://settings if settings in a window is enabled. |
| 448 if (url.host_piece() == chrome::kChromeUISettingsFrameHost || | 443 if (url.host_piece() == chrome::kChromeUISettingsFrameHost || |
| 449 (url.host_piece() == chrome::kChromeUISettingsHost && | 444 (url.host_piece() == chrome::kChromeUISettingsHost && |
| 450 ::switches::SettingsWindowEnabled())) { | 445 ::switches::SettingsWindowEnabled())) { |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 if (page_url.host_piece() == chrome::kChromeUIConflictsHost) | 785 if (page_url.host_piece() == chrome::kChromeUIConflictsHost) |
| 791 return ConflictsUI::GetFaviconResourceBytes(scale_factor); | 786 return ConflictsUI::GetFaviconResourceBytes(scale_factor); |
| 792 #endif | 787 #endif |
| 793 | 788 |
| 794 if (page_url.host_piece() == chrome::kChromeUICrashesHost) | 789 if (page_url.host_piece() == chrome::kChromeUICrashesHost) |
| 795 return CrashesUI::GetFaviconResourceBytes(scale_factor); | 790 return CrashesUI::GetFaviconResourceBytes(scale_factor); |
| 796 | 791 |
| 797 if (page_url.host_piece() == chrome::kChromeUIFlagsHost) | 792 if (page_url.host_piece() == chrome::kChromeUIFlagsHost) |
| 798 return FlagsUI::GetFaviconResourceBytes(scale_factor); | 793 return FlagsUI::GetFaviconResourceBytes(scale_factor); |
| 799 | 794 |
| 795 // TODO(dbeam): does this actually need to exist on all platforms? |
| 800 if (page_url.host_piece() == chrome::kChromeUIHistoryHost) | 796 if (page_url.host_piece() == chrome::kChromeUIHistoryHost) |
| 801 return HistoryUI::GetFaviconResourceBytes(scale_factor); | 797 return history_ui::GetFaviconResourceBytes(scale_factor); |
| 802 | 798 |
| 803 #if !defined(OS_ANDROID) | 799 #if !defined(OS_ANDROID) |
| 804 #if !defined(OS_CHROMEOS) | 800 #if !defined(OS_CHROMEOS) |
| 805 // The Apps launcher page is not available on android or ChromeOS. | 801 // The Apps launcher page is not available on android or ChromeOS. |
| 806 if (page_url.host_piece() == chrome::kChromeUIAppLauncherPageHost) | 802 if (page_url.host_piece() == chrome::kChromeUIAppLauncherPageHost) |
| 807 return AppLauncherPageUI::GetFaviconResourceBytes(scale_factor); | 803 return AppLauncherPageUI::GetFaviconResourceBytes(scale_factor); |
| 808 #endif // !defined(OS_CHROMEOS) | 804 #endif // !defined(OS_CHROMEOS) |
| 809 | 805 |
| 810 // Flash is not available on android. | 806 // Flash is not available on android. |
| 811 if (page_url.host_piece() == chrome::kChromeUIFlashHost) | 807 if (page_url.host_piece() == chrome::kChromeUIFlashHost) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 823 | 819 |
| 824 #if BUILDFLAG(ENABLE_EXTENSIONS) | 820 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 825 if (page_url.host_piece() == chrome::kChromeUIExtensionsHost || | 821 if (page_url.host_piece() == chrome::kChromeUIExtensionsHost || |
| 826 page_url.host_piece() == chrome::kChromeUIExtensionsFrameHost) | 822 page_url.host_piece() == chrome::kChromeUIExtensionsFrameHost) |
| 827 return extensions::ExtensionsUI::GetFaviconResourceBytes(scale_factor); | 823 return extensions::ExtensionsUI::GetFaviconResourceBytes(scale_factor); |
| 828 #endif // BUILDFLAG(ENABLE_EXTENSIONS) | 824 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
| 829 #endif // !defined(OS_ANDROID) | 825 #endif // !defined(OS_ANDROID) |
| 830 | 826 |
| 831 return NULL; | 827 return NULL; |
| 832 } | 828 } |
| OLD | NEW |