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

Side by Side 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: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "components/history/core/browser/history_backend.h" 5 #include "components/history/core/browser/history_backend.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 2065 matching lines...) Expand 10 before | Expand all | Expand 10 after
2076 2076
2077 bool HistoryBackend::SetFaviconMappingsForPageAndRedirects( 2077 bool HistoryBackend::SetFaviconMappingsForPageAndRedirects(
2078 const GURL& page_url, 2078 const GURL& page_url,
2079 favicon_base::IconType icon_type, 2079 favicon_base::IconType icon_type,
2080 const std::vector<favicon_base::FaviconID>& icon_ids) { 2080 const std::vector<favicon_base::FaviconID>& icon_ids) {
2081 if (!thumbnail_db_) 2081 if (!thumbnail_db_)
2082 return false; 2082 return false;
2083 2083
2084 // Find all the pages whose favicons we should set, we want to set it for 2084 // Find all the pages whose favicons we should set, we want to set it for
2085 // all the pages in the redirect chain if it redirected. 2085 // all the pages in the redirect chain if it redirected.
2086 RedirectList redirects; 2086 RedirectList redirects, extra_redirects;
2087 GetCachedRecentRedirects(page_url, &redirects); 2087 GetCachedRecentRedirects(page_url, &redirects);
sky 2015/06/16 22:06:23 If the ref isn't useful when querying for redirect
beaudoin 2015/06/17 16:51:27 Acknowledged.
2088 if (page_url.has_ref()) {
2089 // Refs often gets added by Javascript, but the redirect chain is keyed to
2090 // the URL without a ref.
2091 GURL::Replacements replacements;
2092 replacements.ClearRef();
2093 GURL page_url_without_ref = page_url.ReplaceComponents(replacements);
2094 GetCachedRecentRedirects(page_url_without_ref, &extra_redirects);
2095 }
2088 2096
2089 bool mappings_changed = false; 2097 bool mappings_changed = false;
2090 2098
2091 // Save page <-> favicon associations. 2099 // Save page <-> favicon associations.
2092 for (RedirectList::const_iterator i(redirects.begin()); i != redirects.end(); 2100 for (RedirectList::const_iterator i(redirects.begin()); i != redirects.end();
2093 ++i) { 2101 ++i) {
2094 mappings_changed |= SetFaviconMappingsForPage(*i, icon_type, icon_ids); 2102 mappings_changed |= SetFaviconMappingsForPage(*i, icon_type, icon_ids);
2095 } 2103 }
2104 for (RedirectList::const_iterator i(extra_redirects.begin());
sky 2015/06/17 16:07:30 This is the part I dislike about the current patch
beaudoin 2015/06/17 16:51:27 Done.
2105 i != extra_redirects.end(); ++i) {
2106 mappings_changed |= SetFaviconMappingsForPage(*i, icon_type, icon_ids);
2107 }
2096 return mappings_changed; 2108 return mappings_changed;
2097 } 2109 }
2098 2110
2099 bool HistoryBackend::SetFaviconMappingsForPage( 2111 bool HistoryBackend::SetFaviconMappingsForPage(
2100 const GURL& page_url, 2112 const GURL& page_url,
2101 favicon_base::IconType icon_type, 2113 favicon_base::IconType icon_type,
2102 const std::vector<favicon_base::FaviconID>& icon_ids) { 2114 const std::vector<favicon_base::FaviconID>& icon_ids) {
2103 DCHECK_LE(icon_ids.size(), kMaxFaviconsPerPage); 2115 DCHECK_LE(icon_ids.size(), kMaxFaviconsPerPage);
2104 bool mappings_changed = false; 2116 bool mappings_changed = false;
2105 2117
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
2650 return true; 2662 return true;
2651 } 2663 }
2652 2664
2653 HistoryClient* HistoryBackend::GetHistoryClient() { 2665 HistoryClient* HistoryBackend::GetHistoryClient() {
2654 if (history_client_) 2666 if (history_client_)
2655 history_client_->BlockUntilBookmarksLoaded(); 2667 history_client_->BlockUntilBookmarksLoaded();
2656 return history_client_; 2668 return history_client_;
2657 } 2669 }
2658 2670
2659 } // namespace history 2671 } // namespace history
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698