| 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/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/location.h" | 13 #include "base/location.h" |
| 14 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "chrome/browser/about_flags.h" | 16 #include "chrome/browser/about_flags.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/ui/webui/about_ui.h" | 21 #include "chrome/browser/ui/webui/about_ui.h" |
| 22 #include "chrome/browser/ui/webui/bookmarks_ui.h" | 22 #include "chrome/browser/ui/webui/bookmarks_ui.h" |
| 23 #include "chrome/browser/ui/webui/components_ui.h" | 23 #include "chrome/browser/ui/webui/components_ui.h" |
| 24 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" | 24 #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" |
| 25 #include "chrome/browser/ui/webui/crashes_ui.h" | 25 #include "chrome/browser/ui/webui/crashes_ui.h" |
| 26 #include "chrome/browser/ui/webui/device_log_ui.h" | 26 #include "chrome/browser/ui/webui/device_log_ui.h" |
| 27 #include "chrome/browser/ui/webui/domain_reliability_internals_ui.h" | 27 #include "chrome/browser/ui/webui/domain_reliability_internals_ui.h" |
| 28 #include "chrome/browser/ui/webui/engagement/site_engagement_ui.h" |
| 28 #include "chrome/browser/ui/webui/flags_ui.h" | 29 #include "chrome/browser/ui/webui/flags_ui.h" |
| 29 #include "chrome/browser/ui/webui/flash_ui.h" | 30 #include "chrome/browser/ui/webui/flash_ui.h" |
| 30 #include "chrome/browser/ui/webui/gcm_internals_ui.h" | 31 #include "chrome/browser/ui/webui/gcm_internals_ui.h" |
| 31 #include "chrome/browser/ui/webui/help/help_ui.h" | 32 #include "chrome/browser/ui/webui/help/help_ui.h" |
| 32 #include "chrome/browser/ui/webui/history_ui.h" | 33 #include "chrome/browser/ui/webui/history_ui.h" |
| 33 #include "chrome/browser/ui/webui/identity_internals_ui.h" | 34 #include "chrome/browser/ui/webui/identity_internals_ui.h" |
| 34 #include "chrome/browser/ui/webui/instant_ui.h" | 35 #include "chrome/browser/ui/webui/instant_ui.h" |
| 35 #include "chrome/browser/ui/webui/interstitials/interstitial_ui.h" | 36 #include "chrome/browser/ui/webui/interstitials/interstitial_ui.h" |
| 36 #include "chrome/browser/ui/webui/invalidations_ui.h" | 37 #include "chrome/browser/ui/webui/invalidations_ui.h" |
| 37 #include "chrome/browser/ui/webui/local_state/local_state_ui.h" | 38 #include "chrome/browser/ui/webui/local_state/local_state_ui.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 #endif | 99 #endif |
| 99 | 100 |
| 100 #if defined(OS_ANDROID) | 101 #if defined(OS_ANDROID) |
| 101 #include "chrome/browser/ui/webui/net_export_ui.h" | 102 #include "chrome/browser/ui/webui/net_export_ui.h" |
| 102 #include "chrome/browser/ui/webui/popular_sites_internals_ui.h" | 103 #include "chrome/browser/ui/webui/popular_sites_internals_ui.h" |
| 103 #else | 104 #else |
| 104 #include "chrome/browser/signin/easy_unlock_service.h" | 105 #include "chrome/browser/signin/easy_unlock_service.h" |
| 105 #include "chrome/browser/signin/easy_unlock_service_factory.h" | 106 #include "chrome/browser/signin/easy_unlock_service_factory.h" |
| 106 #include "chrome/browser/ui/webui/copresence_ui.h" | 107 #include "chrome/browser/ui/webui/copresence_ui.h" |
| 107 #include "chrome/browser/ui/webui/devtools_ui.h" | 108 #include "chrome/browser/ui/webui/devtools_ui.h" |
| 108 #include "chrome/browser/ui/webui/engagement/site_engagement_ui.h" | |
| 109 #include "chrome/browser/ui/webui/inspect_ui.h" | 109 #include "chrome/browser/ui/webui/inspect_ui.h" |
| 110 #include "chrome/browser/ui/webui/md_downloads/md_downloads_ui.h" | 110 #include "chrome/browser/ui/webui/md_downloads/md_downloads_ui.h" |
| 111 #include "chrome/browser/ui/webui/md_history_ui.h" | 111 #include "chrome/browser/ui/webui/md_history_ui.h" |
| 112 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 112 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 113 #include "chrome/browser/ui/webui/quota_internals/quota_internals_ui.h" | 113 #include "chrome/browser/ui/webui/quota_internals/quota_internals_ui.h" |
| 114 #include "chrome/browser/ui/webui/sync_file_system_internals/sync_file_system_in
ternals_ui.h" | 114 #include "chrome/browser/ui/webui/sync_file_system_internals/sync_file_system_in
ternals_ui.h" |
| 115 #include "chrome/browser/ui/webui/system_info_ui.h" | 115 #include "chrome/browser/ui/webui/system_info_ui.h" |
| 116 #include "chrome/browser/ui/webui/uber/uber_ui.h" | 116 #include "chrome/browser/ui/webui/uber/uber_ui.h" |
| 117 #endif | 117 #endif |
| 118 | 118 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 if (url.host() == chrome::kChromeUIQuotaInternalsHost) | 411 if (url.host() == chrome::kChromeUIQuotaInternalsHost) |
| 412 return &NewWebUI<QuotaInternalsUI>; | 412 return &NewWebUI<QuotaInternalsUI>; |
| 413 // Settings are implemented with native UI elements on Android. | 413 // Settings are implemented with native UI elements on Android. |
| 414 // Handle chrome://settings if settings in a window and about in settings | 414 // Handle chrome://settings if settings in a window and about in settings |
| 415 // are enabled. | 415 // are enabled. |
| 416 if (url.host() == chrome::kChromeUISettingsFrameHost || | 416 if (url.host() == chrome::kChromeUISettingsFrameHost || |
| 417 (url.host() == chrome::kChromeUISettingsHost && | 417 (url.host() == chrome::kChromeUISettingsHost && |
| 418 ::switches::AboutInSettingsEnabled())) { | 418 ::switches::AboutInSettingsEnabled())) { |
| 419 return &NewWebUI<options::OptionsUI>; | 419 return &NewWebUI<options::OptionsUI>; |
| 420 } | 420 } |
| 421 if (SiteEngagementService::IsEnabled() && | |
| 422 url.host() == chrome::kChromeUISiteEngagementHost) { | |
| 423 return &NewWebUI<SiteEngagementUI>; | |
| 424 } | |
| 425 if (url.host() == chrome::kChromeUISyncFileSystemInternalsHost) | 421 if (url.host() == chrome::kChromeUISyncFileSystemInternalsHost) |
| 426 return &NewWebUI<SyncFileSystemInternalsUI>; | 422 return &NewWebUI<SyncFileSystemInternalsUI>; |
| 427 if (url.host() == chrome::kChromeUISystemInfoHost) | 423 if (url.host() == chrome::kChromeUISystemInfoHost) |
| 428 return &NewWebUI<SystemInfoUI>; | 424 return &NewWebUI<SystemInfoUI>; |
| 429 // Uber frame is not used on Android. | 425 // Uber frame is not used on Android. |
| 430 if (url.host() == chrome::kChromeUIUberFrameHost) | 426 if (url.host() == chrome::kChromeUIUberFrameHost) |
| 431 return &NewWebUI<UberFrameUI>; | 427 return &NewWebUI<UberFrameUI>; |
| 432 // Uber page is not used on Android. | 428 // Uber page is not used on Android. |
| 433 if (url.host() == chrome::kChromeUIUberHost) | 429 if (url.host() == chrome::kChromeUIUberHost) |
| 434 return &NewWebUI<UberUI>; | 430 return &NewWebUI<UberUI>; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 } | 575 } |
| 580 #endif | 576 #endif |
| 581 if (IsAboutUI(url)) | 577 if (IsAboutUI(url)) |
| 582 return &NewWebUI<AboutUI>; | 578 return &NewWebUI<AboutUI>; |
| 583 | 579 |
| 584 if (dom_distiller::IsEnableDomDistillerSet() && | 580 if (dom_distiller::IsEnableDomDistillerSet() && |
| 585 url.host() == dom_distiller::kChromeUIDomDistillerHost) { | 581 url.host() == dom_distiller::kChromeUIDomDistillerHost) { |
| 586 return &NewWebUI<dom_distiller::DomDistillerUi>; | 582 return &NewWebUI<dom_distiller::DomDistillerUi>; |
| 587 } | 583 } |
| 588 | 584 |
| 585 if (SiteEngagementService::IsEnabled() && |
| 586 url.host() == chrome::kChromeUISiteEngagementHost) { |
| 587 return &NewWebUI<SiteEngagementUI>; |
| 588 } |
| 589 |
| 589 return NULL; | 590 return NULL; |
| 590 } | 591 } |
| 591 | 592 |
| 592 void RunFaviconCallbackAsync( | 593 void RunFaviconCallbackAsync( |
| 593 const favicon_base::FaviconResultsCallback& callback, | 594 const favicon_base::FaviconResultsCallback& callback, |
| 594 const std::vector<favicon_base::FaviconRawBitmapResult>* results) { | 595 const std::vector<favicon_base::FaviconRawBitmapResult>* results) { |
| 595 base::ThreadTaskRunnerHandle::Get()->PostTask( | 596 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 596 FROM_HERE, | 597 FROM_HERE, |
| 597 base::Bind(&favicon::FaviconService::FaviconResultsCallbackRunner, | 598 base::Bind(&favicon::FaviconService::FaviconResultsCallbackRunner, |
| 598 callback, base::Owned(results))); | 599 callback, base::Owned(results))); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 #endif | 775 #endif |
| 775 | 776 |
| 776 // Android doesn't use the plugins pages. | 777 // Android doesn't use the plugins pages. |
| 777 if (page_url.host() == chrome::kChromeUIPluginsHost) | 778 if (page_url.host() == chrome::kChromeUIPluginsHost) |
| 778 return PluginsUI::GetFaviconResourceBytes(scale_factor); | 779 return PluginsUI::GetFaviconResourceBytes(scale_factor); |
| 779 | 780 |
| 780 #endif | 781 #endif |
| 781 | 782 |
| 782 return NULL; | 783 return NULL; |
| 783 } | 784 } |
| OLD | NEW |