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

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: Minor clean-up (2) 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 | « components/history/core/browser/history_backend.h ('k') | 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 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after
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;
2087 GetCachedRecentRedirects(page_url, &redirects); 2087 GetCachedRecentRedirects(page_url, &redirects);
2088 bool mappings_changed = SetFaviconMappingsForPages(redirects, icon_type,
2089 icon_ids);
2090 if (page_url.has_ref()) {
2091 // Refs often gets added by Javascript, but the redirect chain is keyed to
2092 // the URL without a ref.
2093 GURL::Replacements replacements;
2094 replacements.ClearRef();
2095 GURL page_url_without_ref = page_url.ReplaceComponents(replacements);
2096 mappings_changed = mappings_changed ||
sky 2015/06/17 17:39:27 Don't you need the |= here, otherwise if mappings_
beaudoin 2015/06/17 18:06:39 That's what I do but since ||= doesnt exist I do m
sky 2015/06/17 21:20:45 The way you have the code here SetFavicon... is no
beaudoin 2015/06/17 22:50:29 Ack.
2097 SetFaviconMappingsForPages(redirects, icon_type, icon_ids);
2098 }
2088 2099
2100 return mappings_changed;
2101 }
2102
2103 bool HistoryBackend::SetFaviconMappingsForPages(
2104 const std::vector<GURL>& page_urls,
2105 favicon_base::IconType icon_type,
2106 const std::vector<favicon_base::FaviconID>& icon_ids) {
2089 bool mappings_changed = false; 2107 bool mappings_changed = false;
2090 2108 for (std::vector<GURL>::const_iterator i(page_urls.begin());
sky 2015/06/17 17:39:27 I would use auto here, but this is ok.
beaudoin 2015/06/17 18:06:39 Done.
2091 // Save page <-> favicon associations. 2109 i != page_urls.end(); ++i) {
2092 for (RedirectList::const_iterator i(redirects.begin()); i != redirects.end();
2093 ++i) {
2094 mappings_changed |= SetFaviconMappingsForPage(*i, icon_type, icon_ids); 2110 mappings_changed |= SetFaviconMappingsForPage(*i, icon_type, icon_ids);
2095 } 2111 }
2096 return mappings_changed; 2112 return mappings_changed;
2097 } 2113 }
2098 2114
2099 bool HistoryBackend::SetFaviconMappingsForPage( 2115 bool HistoryBackend::SetFaviconMappingsForPage(
2100 const GURL& page_url, 2116 const GURL& page_url,
2101 favicon_base::IconType icon_type, 2117 favicon_base::IconType icon_type,
2102 const std::vector<favicon_base::FaviconID>& icon_ids) { 2118 const std::vector<favicon_base::FaviconID>& icon_ids) {
2103 DCHECK_LE(icon_ids.size(), kMaxFaviconsPerPage); 2119 DCHECK_LE(icon_ids.size(), kMaxFaviconsPerPage);
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
2650 return true; 2666 return true;
2651 } 2667 }
2652 2668
2653 HistoryClient* HistoryBackend::GetHistoryClient() { 2669 HistoryClient* HistoryBackend::GetHistoryClient() {
2654 if (history_client_) 2670 if (history_client_)
2655 history_client_->BlockUntilBookmarksLoaded(); 2671 history_client_->BlockUntilBookmarksLoaded();
2656 return history_client_; 2672 return history_client_;
2657 } 2673 }
2658 2674
2659 } // namespace history 2675 } // namespace history
OLDNEW
« no previous file with comments | « components/history/core/browser/history_backend.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698