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

Unified Diff: components/history/core/browser/history_backend.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/history/core/browser/history_backend.cc
diff --git a/components/history/core/browser/history_backend.cc b/components/history/core/browser/history_backend.cc
index 62187120cff3ae3d97a93a60b1fdcd8759dff2e5..2db1a7696a81eb9e1cb4748047ca290b2188c854 100644
--- a/components/history/core/browser/history_backend.cc
+++ b/components/history/core/browser/history_backend.cc
@@ -1699,12 +1699,13 @@ void HistoryBackend::MergeFavicon(
ScheduleCommit();
}
-void HistoryBackend::SetFavicons(const GURL& page_url,
- favicon_base::IconType icon_type,
- const GURL& icon_url,
- const std::vector<SkBitmap>& bitmaps) {
+favicon_base::FaviconID HistoryBackend::SetFavicons(
+ const GURL& page_url,
+ favicon_base::IconType icon_type,
+ const GURL& icon_url,
+ const std::vector<SkBitmap>& bitmaps) {
if (!thumbnail_db_ || !db_)
- return;
+ return favicon_base::FaviconID(0);
DCHECK_GE(kMaxFaviconBitmapsPerIconURL, bitmaps.size());
@@ -1735,6 +1736,23 @@ void HistoryBackend::SetFavicons(const GURL& page_url,
SendFaviconChangedNotificationForIconURL(icon_url);
}
ScheduleCommit();
+ return icon_id;
+}
+
+void HistoryBackend::SetExpiredFaviconsIfNoneKnown(
+ const GURL& page_url,
+ favicon_base::IconType icon_type,
+ const GURL& icon_url,
+ const std::vector<SkBitmap>& bitmaps) {
+ if (!thumbnail_db_ || !db_)
+ return;
+
+ if (!thumbnail_db_->GetIconMappingsForPageURL(page_url,
+ /*mapping_data*/ nullptr)) {
+ favicon_base::FaviconID icon_id =
+ SetFavicons(page_url, icon_type, icon_url, bitmaps);
+ thumbnail_db_->SetFaviconOutOfDate(icon_id);
+ }
}
void HistoryBackend::SetFaviconsOutOfDateForPage(const GURL& page_url) {

Powered by Google App Engine
This is Rietveld 408576698