Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Unified Diff: chrome/browser/ui/webui/ntp_tiles_internals_ui.cc

Issue 2572533002: Add ChromeMostVisitedSitesFactory (Closed)
Patch Set: Use factory for webui Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/search/instant_service.cc ('k') | chrome/browser/ui/webui/popular_sites_internals_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome/browser/search/instant_service.cc ('k') | chrome/browser/ui/webui/popular_sites_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698