| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 #endif | 100 #endif |
| 100 | 101 |
| 101 #if defined(OS_ANDROID) | 102 #if defined(OS_ANDROID) |
| 102 #include "chrome/browser/ui/webui/net_export_ui.h" | 103 #include "chrome/browser/ui/webui/net_export_ui.h" |
| 103 #include "chrome/browser/ui/webui/popular_sites_internals_ui.h" | 104 #include "chrome/browser/ui/webui/popular_sites_internals_ui.h" |
| 104 #else | 105 #else |
| 105 #include "chrome/browser/signin/easy_unlock_service.h" | 106 #include "chrome/browser/signin/easy_unlock_service.h" |
| 106 #include "chrome/browser/signin/easy_unlock_service_factory.h" | 107 #include "chrome/browser/signin/easy_unlock_service_factory.h" |
| 107 #include "chrome/browser/ui/webui/copresence_ui.h" | 108 #include "chrome/browser/ui/webui/copresence_ui.h" |
| 108 #include "chrome/browser/ui/webui/devtools_ui.h" | 109 #include "chrome/browser/ui/webui/devtools_ui.h" |
| 109 #include "chrome/browser/ui/webui/engagement/site_engagement_ui.h" | |
| 110 #include "chrome/browser/ui/webui/inspect_ui.h" | 110 #include "chrome/browser/ui/webui/inspect_ui.h" |
| 111 #include "chrome/browser/ui/webui/md_downloads/md_downloads_ui.h" | 111 #include "chrome/browser/ui/webui/md_downloads/md_downloads_ui.h" |
| 112 #include "chrome/browser/ui/webui/md_history_ui.h" | 112 #include "chrome/browser/ui/webui/md_history_ui.h" |
| 113 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 113 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 114 #include "chrome/browser/ui/webui/quota_internals/quota_internals_ui.h" | 114 #include "chrome/browser/ui/webui/quota_internals/quota_internals_ui.h" |
| 115 #include "chrome/browser/ui/webui/sync_file_system_internals/sync_file_system_in
ternals_ui.h" | 115 #include "chrome/browser/ui/webui/sync_file_system_internals/sync_file_system_in
ternals_ui.h" |
| 116 #include "chrome/browser/ui/webui/system_info_ui.h" | 116 #include "chrome/browser/ui/webui/system_info_ui.h" |
| 117 #include "chrome/browser/ui/webui/uber/uber_ui.h" | 117 #include "chrome/browser/ui/webui/uber/uber_ui.h" |
| 118 #endif | 118 #endif |
| 119 | 119 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 if (url.host() == chrome::kChromeUIQuotaInternalsHost) | 412 if (url.host() == chrome::kChromeUIQuotaInternalsHost) |
| 413 return &NewWebUI<QuotaInternalsUI>; | 413 return &NewWebUI<QuotaInternalsUI>; |
| 414 // Settings are implemented with native UI elements on Android. | 414 // Settings are implemented with native UI elements on Android. |
| 415 // Handle chrome://settings if settings in a window and about in settings | 415 // Handle chrome://settings if settings in a window and about in settings |
| 416 // are enabled. | 416 // are enabled. |
| 417 if (url.host() == chrome::kChromeUISettingsFrameHost || | 417 if (url.host() == chrome::kChromeUISettingsFrameHost || |
| 418 (url.host() == chrome::kChromeUISettingsHost && | 418 (url.host() == chrome::kChromeUISettingsHost && |
| 419 ::switches::AboutInSettingsEnabled())) { | 419 ::switches::AboutInSettingsEnabled())) { |
| 420 return &NewWebUI<options::OptionsUI>; | 420 return &NewWebUI<options::OptionsUI>; |
| 421 } | 421 } |
| 422 if (SiteEngagementService::IsEnabled() && | |
| 423 url.host() == chrome::kChromeUISiteEngagementHost) { | |
| 424 return &NewWebUI<SiteEngagementUI>; | |
| 425 } | |
| 426 if (url.host() == chrome::kChromeUISyncFileSystemInternalsHost) | 422 if (url.host() == chrome::kChromeUISyncFileSystemInternalsHost) |
| 427 return &NewWebUI<SyncFileSystemInternalsUI>; | 423 return &NewWebUI<SyncFileSystemInternalsUI>; |
| 428 if (url.host() == chrome::kChromeUISystemInfoHost) | 424 if (url.host() == chrome::kChromeUISystemInfoHost) |
| 429 return &NewWebUI<SystemInfoUI>; | 425 return &NewWebUI<SystemInfoUI>; |
| 430 // Uber frame is not used on Android. | 426 // Uber frame is not used on Android. |
| 431 if (url.host() == chrome::kChromeUIUberFrameHost) | 427 if (url.host() == chrome::kChromeUIUberFrameHost) |
| 432 return &NewWebUI<UberFrameUI>; | 428 return &NewWebUI<UberFrameUI>; |
| 433 // Uber page is not used on Android. | 429 // Uber page is not used on Android. |
| 434 if (url.host() == chrome::kChromeUIUberHost) | 430 if (url.host() == chrome::kChromeUIUberHost) |
| 435 return &NewWebUI<UberUI>; | 431 return &NewWebUI<UberUI>; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 } | 578 } |
| 583 #endif | 579 #endif |
| 584 if (IsAboutUI(url)) | 580 if (IsAboutUI(url)) |
| 585 return &NewWebUI<AboutUI>; | 581 return &NewWebUI<AboutUI>; |
| 586 | 582 |
| 587 if (dom_distiller::IsEnableDomDistillerSet() && | 583 if (dom_distiller::IsEnableDomDistillerSet() && |
| 588 url.host() == dom_distiller::kChromeUIDomDistillerHost) { | 584 url.host() == dom_distiller::kChromeUIDomDistillerHost) { |
| 589 return &NewWebUI<dom_distiller::DomDistillerUi>; | 585 return &NewWebUI<dom_distiller::DomDistillerUi>; |
| 590 } | 586 } |
| 591 | 587 |
| 588 if (SiteEngagementService::IsEnabled() && |
| 589 url.host() == chrome::kChromeUISiteEngagementHost) { |
| 590 return &NewWebUI<SiteEngagementUI>; |
| 591 } |
| 592 |
| 592 return NULL; | 593 return NULL; |
| 593 } | 594 } |
| 594 | 595 |
| 595 void RunFaviconCallbackAsync( | 596 void RunFaviconCallbackAsync( |
| 596 const favicon_base::FaviconResultsCallback& callback, | 597 const favicon_base::FaviconResultsCallback& callback, |
| 597 const std::vector<favicon_base::FaviconRawBitmapResult>* results) { | 598 const std::vector<favicon_base::FaviconRawBitmapResult>* results) { |
| 598 base::ThreadTaskRunnerHandle::Get()->PostTask( | 599 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 599 FROM_HERE, | 600 FROM_HERE, |
| 600 base::Bind(&favicon::FaviconService::FaviconResultsCallbackRunner, | 601 base::Bind(&favicon::FaviconService::FaviconResultsCallbackRunner, |
| 601 callback, base::Owned(results))); | 602 callback, base::Owned(results))); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 #endif | 778 #endif |
| 778 | 779 |
| 779 // Android doesn't use the plugins pages. | 780 // Android doesn't use the plugins pages. |
| 780 if (page_url.host() == chrome::kChromeUIPluginsHost) | 781 if (page_url.host() == chrome::kChromeUIPluginsHost) |
| 781 return PluginsUI::GetFaviconResourceBytes(scale_factor); | 782 return PluginsUI::GetFaviconResourceBytes(scale_factor); |
| 782 | 783 |
| 783 #endif | 784 #endif |
| 784 | 785 |
| 785 return NULL; | 786 return NULL; |
| 786 } | 787 } |
| OLD | NEW |