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

Unified Diff: components/favicon/core/favicon_service_impl.cc

Issue 2721363002: Extend LargeIconService to fetch missing favicons from a Google server (Closed)
Patch Set: Addressed comments. Created 3 years, 9 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/favicon/core/favicon_service_impl.cc
diff --git a/components/favicon/core/favicon_service_impl.cc b/components/favicon/core/favicon_service_impl.cc
index a57c99e9ce2f2f23032ad4049aa7653ccae49337..90e26015c11fc244bcadd06ed3e0f8f4ce0dcd83 100644
--- a/components/favicon/core/favicon_service_impl.cc
+++ b/components/favicon/core/favicon_service_impl.cc
@@ -231,6 +231,28 @@ void FaviconServiceImpl::SetFavicons(const GURL& page_url,
history_service_->SetFavicons(page_url, icon_type, icon_url, bitmaps);
}
+void FaviconServiceImpl::SetExpiredFaviconsIfNoneKnown(
+ const GURL& page_url,
+ const GURL& icon_url,
+ favicon_base::IconType icon_type,
+ const gfx::Image& image) {
+ gfx::ImageSkia image_skia = image.AsImageSkia();
+ image_skia.EnsureRepsForSupportedScales();
+ const std::vector<gfx::ImageSkiaRep>& image_reps = image_skia.image_reps();
+ std::vector<SkBitmap> bitmaps;
+ const std::vector<float> favicon_scales = favicon_base::GetFaviconScales();
+ for (size_t i = 0; i < image_reps.size(); ++i) {
+ // Don't save if the scale isn't one of supported favicon scales.
+ if (std::find(favicon_scales.begin(), favicon_scales.end(),
+ image_reps[i].scale()) == favicon_scales.end()) {
+ continue;
+ }
+ bitmaps.push_back(image_reps[i].sk_bitmap());
+ }
+ history_service_->SetExpiredFaviconsIfNoneKnown(page_url, icon_type, icon_url,
+ bitmaps);
+}
+
void FaviconServiceImpl::UnableToDownloadFavicon(const GURL& icon_url) {
MissingFaviconURLHash url_hash = base::Hash(icon_url.spec());
missing_favicon_urls_.insert(url_hash);

Powered by Google App Engine
This is Rietveld 408576698