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

Unified Diff: components/history/core/browser/history_backend.cc

Issue 1180403005: Use URL without fragment when query recent redirect list for favicons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased and answered nit. Created 5 years, 6 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 1110993c583f546d0b84c1d245aedc01a06cab74..c668ba7e84059585c27e18da0e99138ca7911bd1 100644
--- a/components/history/core/browser/history_backend.cc
+++ b/components/history/core/browser/history_backend.cc
@@ -2085,12 +2085,28 @@ bool HistoryBackend::SetFaviconMappingsForPageAndRedirects(
// all the pages in the redirect chain if it redirected.
RedirectList redirects;
GetCachedRecentRedirects(page_url, &redirects);
+ bool mappings_changed = SetFaviconMappingsForPages(redirects, icon_type,
+ icon_ids);
+ if (page_url.has_ref()) {
+ // Refs often gets added by Javascript, but the redirect chain is keyed to
+ // the URL without a ref.
+ GURL::Replacements replacements;
+ replacements.ClearRef();
+ GURL page_url_without_ref = page_url.ReplaceComponents(replacements);
+ GetCachedRecentRedirects(page_url_without_ref, &redirects);
+ mappings_changed |= SetFaviconMappingsForPages(redirects, icon_type,
+ icon_ids);
+ }
- bool mappings_changed = false;
+ return mappings_changed;
+}
- // Save page <-> favicon associations.
- for (RedirectList::const_iterator i(redirects.begin()); i != redirects.end();
- ++i) {
+bool HistoryBackend::SetFaviconMappingsForPages(
+ const std::vector<GURL>& page_urls,
+ favicon_base::IconType icon_type,
+ const std::vector<favicon_base::FaviconID>& icon_ids) {
+ bool mappings_changed = false;
+ for (auto i(page_urls.begin()); i != page_urls.end(); ++i) {
mappings_changed |= SetFaviconMappingsForPage(*i, icon_type, icon_ids);
}
return mappings_changed;
« no previous file with comments | « components/history/core/browser/history_backend.h ('k') | components/history/core/browser/history_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698