Index: chrome/browser/ui/webui/ntp_tiles_internals_ui.cc |
diff --git a/chrome/browser/ui/webui/ntp_tiles_internals_ui.cc b/chrome/browser/ui/webui/ntp_tiles_internals_ui.cc |
index cfaf58055ecde3d8cdc8b524ef2d5790a14cd261..6f705979b20d9278f3988bafb3819b7747c2334b 100644 |
--- a/chrome/browser/ui/webui/ntp_tiles_internals_ui.cc |
+++ b/chrome/browser/ui/webui/ntp_tiles_internals_ui.cc |
@@ -8,6 +8,8 @@ |
#include "base/memory/ptr_util.h" |
#include "chrome/browser/favicon/favicon_service_factory.h" |
#include "chrome/browser/history/top_sites_factory.h" |
+#include "chrome/browser/ntp_tiles/chrome_most_visited_sites_factory.h" |
+#include "chrome/browser/ntp_tiles/chrome_popular_sites_factory.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/search/suggestions/image_decoder_impl.h" |
#include "chrome/browser/search/suggestions/suggestions_service_factory.h" |
@@ -26,10 +28,6 @@ |
#include "content/public/browser/web_ui_data_source.h" |
#include "content/public/browser/web_ui_message_handler.h" |
-#if defined(OS_ANDROID) |
-#include "chrome/browser/android/ntp/popular_sites.h" |
-#endif |
- |
namespace { |
// The implementation for the chrome://ntp-tiles-internals page. |
@@ -69,16 +67,12 @@ bool ChromeNTPTilesInternalsMessageHandlerClient::DoesSourceExist( |
switch (source) { |
case ntp_tiles::NTPTileSource::TOP_SITES: |
case ntp_tiles::NTPTileSource::SUGGESTIONS_SERVICE: |
+ case ntp_tiles::NTPTileSource::WHITELIST: |
return true; |
+ case ntp_tiles::NTPTileSource::POPULAR: |
#if defined(OS_ANDROID) |
- case ntp_tiles::NTPTileSource::POPULAR: |
- case ntp_tiles::NTPTileSource::WHITELIST: |
return true; |
#else |
- case ntp_tiles::NTPTileSource::POPULAR: |
- return false; |
- case ntp_tiles::NTPTileSource::WHITELIST: |
- // TODO(sfiera): support WHITELIST. |
return false; |
#endif |
} |
@@ -88,25 +82,14 @@ bool ChromeNTPTilesInternalsMessageHandlerClient::DoesSourceExist( |
std::unique_ptr<ntp_tiles::MostVisitedSites> |
ChromeNTPTilesInternalsMessageHandlerClient::MakeMostVisitedSites() { |
- // TODO(sfiera): share with Android and Instant in a factory. |
- auto* profile = Profile::FromWebUI(web_ui()); |
- return base::MakeUnique<ntp_tiles::MostVisitedSites>( |
- GetPrefs(), TopSitesFactory::GetForProfile(profile), |
- suggestions::SuggestionsServiceFactory::GetForProfile(profile), |
- MakePopularSites(), |
- base::MakeUnique<ntp_tiles::IconCacher>( |
- FaviconServiceFactory::GetForProfile( |
- profile, ServiceAccessType::IMPLICIT_ACCESS), |
- base::MakeUnique<image_fetcher::ImageFetcherImpl>( |
- base::MakeUnique<suggestions::ImageDecoderImpl>(), |
- profile->GetRequestContext())), |
- /*supervisor=*/nullptr); |
+ return ChromeMostVisitedSitesFactory::NewForProfile( |
+ Profile::FromWebUI(web_ui())); |
} |
std::unique_ptr<ntp_tiles::PopularSites> |
ChromeNTPTilesInternalsMessageHandlerClient::MakePopularSites() { |
#if defined(OS_ANDROID) |
- return ChromePopularSites::NewForProfile(Profile::FromWebUI(web_ui())); |
+ return ChromePopularSitesFactory::NewForProfile(Profile::FromWebUI(web_ui())); |
#else |
return nullptr; |
#endif |