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

Unified Diff: components/ntp_tiles/icon_cacher_impl.h

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 side-by-side diff with in-line comments
Download patch
Index: components/ntp_tiles/icon_cacher_impl.h
diff --git a/components/ntp_tiles/icon_cacher_impl.h b/components/ntp_tiles/icon_cacher_impl.h
index 1028f72b29b7153cdd64706eaa4bc3623de11b41..f882e946770bdf6d5ba3df014ba12ee7f038f002 100644
--- a/components/ntp_tiles/icon_cacher_impl.h
+++ b/components/ntp_tiles/icon_cacher_impl.h
@@ -5,6 +5,7 @@
#ifndef COMPONENTS_NTP_TILES_ICON_CACHER_IMPL_H_
#define COMPONENTS_NTP_TILES_ICON_CACHER_IMPL_H_
+#include <map>
#include <memory>
#include <string>
@@ -40,8 +41,12 @@ class IconCacherImpl : public IconCacher {
void StartFetch(PopularSites::Site site,
const base::Callback<void(bool)>& done) override;
+ void AddDefaultImage(const PopularSites::Site& site,
+ int image_resource_id) override;
private:
+ struct DefaultIcon;
+
void OnGetFaviconImageForPageURLFinished(
PopularSites::Site site,
const base::Callback<void(bool)>& done,
@@ -52,9 +57,13 @@ class IconCacherImpl : public IconCacher {
const std::string& id,
const gfx::Image& fetched_image);
+ bool ProvideDefaultIcon(const PopularSites::Site& site);
+ void SaveIconForSite(const PopularSites::Site& site, const gfx::Image image);
+
base::CancelableTaskTracker tracker_;
favicon::FaviconService* const favicon_service_;
std::unique_ptr<image_fetcher::ImageFetcher> const image_fetcher_;
+ std::map<const std::string, DefaultIcon> default_icons_;
sfiera 2017/02/16 11:14:22 Instead of having a map here, could PopularSites::
fhorschig 2017/02/16 17:06:41 Yes. It has now and the default resource ID is -1.
DISALLOW_COPY_AND_ASSIGN(IconCacherImpl);
};

Powered by Google App Engine
This is Rietveld 408576698