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

Side by Side Diff: chrome/browser/ntp_tiles/chrome_most_visited_sites_factory.cc

Issue 2695713004: Add baked-in favicons for default popular sites on NTP (Closed)
Patch Set: Have python script adhere to guidelines Created 3 years, 10 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/ntp_tiles/DEPS » ('j') | components/ntp_tiles/icon_cacher_impl.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ntp_tiles/chrome_most_visited_sites_factory.h" 5 #include "chrome/browser/ntp_tiles/chrome_most_visited_sites_factory.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "chrome/browser/favicon/favicon_service_factory.h" 13 #include "chrome/browser/favicon/favicon_service_factory.h"
14 #include "chrome/browser/history/top_sites_factory.h" 14 #include "chrome/browser/history/top_sites_factory.h"
15 #include "chrome/browser/ntp_tiles/chrome_popular_sites_factory.h" 15 #include "chrome/browser/ntp_tiles/chrome_popular_sites_factory.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/search/suggestions/image_decoder_impl.h" 17 #include "chrome/browser/search/suggestions/image_decoder_impl.h"
18 #include "chrome/browser/search/suggestions/suggestions_service_factory.h" 18 #include "chrome/browser/search/suggestions/suggestions_service_factory.h"
19 #include "chrome/browser/supervised_user/supervised_user_service.h" 19 #include "chrome/browser/supervised_user/supervised_user_service.h"
20 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" 20 #include "chrome/browser/supervised_user/supervised_user_service_factory.h"
21 #include "chrome/browser/supervised_user/supervised_user_service_observer.h" 21 #include "chrome/browser/supervised_user/supervised_user_service_observer.h"
22 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" 22 #include "chrome/browser/supervised_user/supervised_user_url_filter.h"
23 #include "chrome/browser/thumbnails/thumbnail_list_source.h" 23 #include "chrome/browser/thumbnails/thumbnail_list_source.h"
24 #include "components/history/core/browser/top_sites.h" 24 #include "components/history/core/browser/top_sites.h"
25 #include "components/image_fetcher/image_fetcher_impl.h" 25 #include "components/image_fetcher/image_fetcher_impl.h"
26 #include "components/ntp_tiles/icon_cacher_impl.h" 26 #include "components/ntp_tiles/icon_cacher_impl.h"
27 #include "components/ntp_tiles/metrics.h" 27 #include "components/ntp_tiles/metrics.h"
28 #include "components/ntp_tiles/most_visited_sites.h" 28 #include "components/ntp_tiles/most_visited_sites.h"
29 #include "components/ntp_tiles/popular_sites_impl.h"
29 30
30 using suggestions::SuggestionsServiceFactory; 31 using suggestions::SuggestionsServiceFactory;
31 32
32 namespace { 33 namespace {
33 34
34 class SupervisorBridge : public ntp_tiles::MostVisitedSitesSupervisor, 35 class SupervisorBridge : public ntp_tiles::MostVisitedSitesSupervisor,
35 public SupervisedUserServiceObserver { 36 public SupervisedUserServiceObserver {
36 public: 37 public:
37 explicit SupervisorBridge(Profile* profile); 38 explicit SupervisorBridge(Profile* profile);
38 ~SupervisorBridge() override; 39 ~SupervisorBridge() override;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } // namespace 107 } // namespace
107 108
108 // static 109 // static
109 std::unique_ptr<ntp_tiles::MostVisitedSites> 110 std::unique_ptr<ntp_tiles::MostVisitedSites>
110 ChromeMostVisitedSitesFactory::NewForProfile(Profile* profile) { 111 ChromeMostVisitedSitesFactory::NewForProfile(Profile* profile) {
111 // MostVisitedSites doesn't exist in incognito profiles. 112 // MostVisitedSites doesn't exist in incognito profiles.
112 if (profile->IsOffTheRecord()) { 113 if (profile->IsOffTheRecord()) {
113 return nullptr; 114 return nullptr;
114 } 115 }
115 116
116 return base::MakeUnique<ntp_tiles::MostVisitedSites>( 117 std::unique_ptr<ntp_tiles::IconCacher> icon_cacher =
117 profile->GetPrefs(), TopSitesFactory::GetForProfile(profile),
118 SuggestionsServiceFactory::GetForProfile(profile),
119 #if defined(OS_ANDROID)
120 ChromePopularSitesFactory::NewForProfile(profile),
121 #else
122 nullptr,
123 #endif
124 base::MakeUnique<ntp_tiles::IconCacherImpl>( 118 base::MakeUnique<ntp_tiles::IconCacherImpl>(
125 FaviconServiceFactory::GetForProfile( 119 FaviconServiceFactory::GetForProfile(
126 profile, ServiceAccessType::IMPLICIT_ACCESS), 120 profile, ServiceAccessType::IMPLICIT_ACCESS),
127 base::MakeUnique<image_fetcher::ImageFetcherImpl>( 121 base::MakeUnique<image_fetcher::ImageFetcherImpl>(
128 base::MakeUnique<suggestions::ImageDecoderImpl>(), 122 base::MakeUnique<suggestions::ImageDecoderImpl>(),
129 profile->GetRequestContext())), 123 profile->GetRequestContext()));
124
125 std::unique_ptr<ntp_tiles::PopularSites> popular_sites = nullptr;
126 #if defined(OS_ANDROID)
127 popular_sites = ChromePopularSitesFactory::NewForProfile(profile);
128 ntp_tiles::PopularSitesImpl::AddIconsForDefaultPagesToCacher(
129 *profile->GetPrefs(), icon_cacher.get());
130 #endif
131
132 return base::MakeUnique<ntp_tiles::MostVisitedSites>(
133 profile->GetPrefs(), TopSitesFactory::GetForProfile(profile),
134 SuggestionsServiceFactory::GetForProfile(profile),
135 std::move(popular_sites), std::move(icon_cacher),
130 base::MakeUnique<SupervisorBridge>(profile)); 136 base::MakeUnique<SupervisorBridge>(profile));
131 } 137 }
OLDNEW
« no previous file with comments | « no previous file | components/ntp_tiles/DEPS » ('j') | components/ntp_tiles/icon_cacher_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698