| 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/dom_distiller/dom_distiller_service_factory.h" | 16 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" |
| 17 #include "chrome/browser/engagement/site_engagement_service.h" | 17 #include "chrome/browser/engagement/site_engagement_service.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 20 #include "chrome/browser/search/suggestions/suggestions_ui.h" | 20 #include "chrome/browser/search/suggestions/suggestions_ui.h" |
| 21 #include "chrome/browser/ui/chrome_pages.h" |
| 21 #include "chrome/browser/ui/webui/about_ui.h" | 22 #include "chrome/browser/ui/webui/about_ui.h" |
| 22 #include "chrome/browser/ui/webui/bookmarks_ui.h" | 23 #include "chrome/browser/ui/webui/bookmarks_ui.h" |
| 23 #include "chrome/browser/ui/webui/components_ui.h" | 24 #include "chrome/browser/ui/webui/components_ui.h" |
| 24 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" | 25 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" |
| 25 #include "chrome/browser/ui/webui/crashes_ui.h" | 26 #include "chrome/browser/ui/webui/crashes_ui.h" |
| 26 #include "chrome/browser/ui/webui/device_log_ui.h" | 27 #include "chrome/browser/ui/webui/device_log_ui.h" |
| 27 #include "chrome/browser/ui/webui/domain_reliability_internals_ui.h" | 28 #include "chrome/browser/ui/webui/domain_reliability_internals_ui.h" |
| 28 #include "chrome/browser/ui/webui/engagement/site_engagement_ui.h" | 29 #include "chrome/browser/ui/webui/engagement/site_engagement_ui.h" |
| 29 #include "chrome/browser/ui/webui/flags_ui.h" | 30 #include "chrome/browser/ui/webui/flags_ui.h" |
| 30 #include "chrome/browser/ui/webui/flash_ui.h" | 31 #include "chrome/browser/ui/webui/flash_ui.h" |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 if (url.host() == chrome::kChromeUIDownloadsHost) | 391 if (url.host() == chrome::kChromeUIDownloadsHost) |
| 391 return &NewWebUI<MdDownloadsUI>; | 392 return &NewWebUI<MdDownloadsUI>; |
| 392 // Help is implemented with native UI elements on Android. | 393 // Help is implemented with native UI elements on Android. |
| 393 if (url.host() == chrome::kChromeUIHelpFrameHost) | 394 if (url.host() == chrome::kChromeUIHelpFrameHost) |
| 394 return &NewWebUI<HelpUI>; | 395 return &NewWebUI<HelpUI>; |
| 395 // Identity API is not available on Android. | 396 // Identity API is not available on Android. |
| 396 if (url.host() == chrome::kChromeUIIdentityInternalsHost) | 397 if (url.host() == chrome::kChromeUIIdentityInternalsHost) |
| 397 return &NewWebUI<IdentityInternalsUI>; | 398 return &NewWebUI<IdentityInternalsUI>; |
| 398 if (url.host() == chrome::kChromeUINewTabHost) | 399 if (url.host() == chrome::kChromeUINewTabHost) |
| 399 return &NewWebUI<NewTabUI>; | 400 return &NewWebUI<NewTabUI>; |
| 400 if (url.host() == chrome::kChromeUIMdSettingsHost) | 401 if (url.host() == chrome::GetMdSettingsHost()) |
| 401 return &NewWebUI<settings::MdSettingsUI>; | 402 return &NewWebUI<settings::MdSettingsUI>; |
| 402 // If the material design extensions page is enabled, it gets its own host. | 403 // If the material design extensions page is enabled, it gets its own host. |
| 403 // Otherwise, it's handled by the uber settings page. | 404 // Otherwise, it's handled by the uber settings page. |
| 404 if (url.host() == chrome::kChromeUIExtensionsHost && | 405 if (url.host() == chrome::kChromeUIExtensionsHost && |
| 405 ::switches::MdExtensionsEnabled()) { | 406 ::switches::MdExtensionsEnabled()) { |
| 406 return &NewWebUI<extensions::ExtensionsUI>; | 407 return &NewWebUI<extensions::ExtensionsUI>; |
| 407 } | 408 } |
| 408 // Material Design history is on its own host, rather than on an Uber page. | 409 // Material Design history is on its own host, rather than on an Uber page. |
| 409 if (base::FeatureList::IsEnabled(features::kMaterialDesignHistoryFeature) && | 410 if (base::FeatureList::IsEnabled(features::kMaterialDesignHistoryFeature) && |
| 410 url.host() == chrome::kChromeUIHistoryHost) { | 411 url.host() == chrome::kChromeUIHistoryHost) { |
| 411 return &NewWebUI<MdHistoryUI>; | 412 return &NewWebUI<MdHistoryUI>; |
| 412 } | 413 } |
| 413 if (url.host() == chrome::kChromeUIQuotaInternalsHost) | 414 if (url.host() == chrome::kChromeUIQuotaInternalsHost) |
| 414 return &NewWebUI<QuotaInternalsUI>; | 415 return &NewWebUI<QuotaInternalsUI>; |
| 415 // Settings are implemented with native UI elements on Android. | 416 // Settings are implemented with native UI elements on Android. |
| 416 // Handle chrome://settings if settings in a window and about in settings | 417 // Handle chrome://settings if settings in a window and about in settings |
| 417 // are enabled. | 418 // are enabled. |
| 418 if (url.host() == chrome::kChromeUISettingsFrameHost || | 419 if (url.host() == chrome::kChromeUISettingsFrameHost || |
| 419 (url.host() == chrome::kChromeUISettingsHost && | 420 (url.host() == chrome::GetLegacySettingsHost() && |
| 420 ::switches::AboutInSettingsEnabled())) { | 421 ::switches::AboutInSettingsEnabled())) { |
| 421 return &NewWebUI<options::OptionsUI>; | 422 return &NewWebUI<options::OptionsUI>; |
| 422 } | 423 } |
| 423 if (url.host() == chrome::kChromeUISyncFileSystemInternalsHost) | 424 if (url.host() == chrome::kChromeUISyncFileSystemInternalsHost) |
| 424 return &NewWebUI<SyncFileSystemInternalsUI>; | 425 return &NewWebUI<SyncFileSystemInternalsUI>; |
| 425 if (url.host() == chrome::kChromeUISystemInfoHost) | 426 if (url.host() == chrome::kChromeUISystemInfoHost) |
| 426 return &NewWebUI<SystemInfoUI>; | 427 return &NewWebUI<SystemInfoUI>; |
| 427 // Uber frame is not used on Android. | 428 // Uber frame is not used on Android. |
| 428 if (url.host() == chrome::kChromeUIUberFrameHost) | 429 if (url.host() == chrome::kChromeUIUberFrameHost) |
| 429 return &NewWebUI<UberFrameUI>; | 430 return &NewWebUI<UberFrameUI>; |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 | 770 |
| 770 // Flash is not available on android. | 771 // Flash is not available on android. |
| 771 if (page_url.host() == chrome::kChromeUIFlashHost) | 772 if (page_url.host() == chrome::kChromeUIFlashHost) |
| 772 return FlashUI::GetFaviconResourceBytes(scale_factor); | 773 return FlashUI::GetFaviconResourceBytes(scale_factor); |
| 773 | 774 |
| 774 // Android uses the native download manager. | 775 // Android uses the native download manager. |
| 775 if (page_url.host() == chrome::kChromeUIDownloadsHost) | 776 if (page_url.host() == chrome::kChromeUIDownloadsHost) |
| 776 return MdDownloadsUI::GetFaviconResourceBytes(scale_factor); | 777 return MdDownloadsUI::GetFaviconResourceBytes(scale_factor); |
| 777 | 778 |
| 778 // Android doesn't use the Options/Settings pages. | 779 // Android doesn't use the Options/Settings pages. |
| 779 if (page_url.host() == chrome::kChromeUISettingsHost || | 780 if (page_url.host() == chrome::GetLegacySettingsHost() || |
| 780 page_url.host() == chrome::kChromeUISettingsFrameHost || | 781 page_url.host() == chrome::kChromeUISettingsFrameHost || |
| 781 page_url.host() == chrome::kChromeUIMdSettingsHost) | 782 page_url.host() == chrome::GetMdSettingsHost()) |
| 782 return settings_utils::GetFaviconResourceBytes(scale_factor); | 783 return settings_utils::GetFaviconResourceBytes(scale_factor); |
| 783 | 784 |
| 784 #if defined(ENABLE_EXTENSIONS) | 785 #if defined(ENABLE_EXTENSIONS) |
| 785 if (page_url.host() == chrome::kChromeUIExtensionsHost || | 786 if (page_url.host() == chrome::kChromeUIExtensionsHost || |
| 786 page_url.host() == chrome::kChromeUIExtensionsFrameHost) | 787 page_url.host() == chrome::kChromeUIExtensionsFrameHost) |
| 787 return extensions::ExtensionsUI::GetFaviconResourceBytes(scale_factor); | 788 return extensions::ExtensionsUI::GetFaviconResourceBytes(scale_factor); |
| 788 #endif | 789 #endif |
| 789 | 790 |
| 790 // Android doesn't use the plugins pages. | 791 // Android doesn't use the plugins pages. |
| 791 if (page_url.host() == chrome::kChromeUIPluginsHost) | 792 if (page_url.host() == chrome::kChromeUIPluginsHost) |
| 792 return PluginsUI::GetFaviconResourceBytes(scale_factor); | 793 return PluginsUI::GetFaviconResourceBytes(scale_factor); |
| 793 | 794 |
| 794 #endif | 795 #endif |
| 795 | 796 |
| 796 return NULL; | 797 return NULL; |
| 797 } | 798 } |
| OLD | NEW |