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

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

Issue 2876263003: Simplify FaviconHandler::OnFaviconDataForInitialURLFromFaviconService() (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/favicon/core/favicon_handler.cc
diff --git a/components/favicon/core/favicon_handler.cc b/components/favicon/core/favicon_handler.cc
index 1434eb5ec11d59fde4792447bb79c712f4ed7163..f811c350376f517a6888ab7222b2e98e9929e5cf 100644
--- a/components/favicon/core/favicon_handler.cc
+++ b/components/favicon/core/favicon_handler.cc
@@ -31,25 +31,6 @@ const int kNonTouchLargestIconSize = 192;
// the apple touch icon for iPad.
const int kTouchIconSize = 144;
-// Returns true if all of the icon URLs and icon types in |bitmap_results| are
-// identical and if they match |icon_url| and |icon_type|. Returns false if
-// |bitmap_results| is empty.
-bool DoUrlsAndIconsMatch(
- const GURL& icon_url,
- favicon_base::IconType icon_type,
- const std::vector<favicon_base::FaviconRawBitmapResult>& bitmap_results) {
- if (bitmap_results.empty())
- return false;
-
- for (const auto& bitmap_result : bitmap_results) {
- if (icon_url != bitmap_result.icon_url ||
- icon_type != bitmap_result.icon_type) {
- return false;
- }
- }
- return true;
-}
-
// Return true if |bitmap_result| is expired.
bool IsExpired(const favicon_base::FaviconRawBitmapResult& bitmap_result) {
return bitmap_result.expired;
@@ -482,14 +463,11 @@ void FaviconHandler::OnFaviconDataForInitialURLFromFaviconService(
redownload_icons_ = initial_history_result_expired_or_incomplete_ &&
!favicon_bitmap_results.empty();
- if (has_valid_result && (!current_candidate() ||
- DoUrlsAndIconsMatch(current_candidate()->icon_url,
- current_candidate()->icon_type,
- favicon_bitmap_results))) {
- // The db knows the favicon (although it may be out of date) and the entry
- // doesn't have an icon. Set the favicon now, and if the favicon turns out
- // to be expired (or the wrong url) we'll fetch later on. This way the
- // user doesn't see a flash of the default favicon.
+ if (has_valid_result) {
+ // The db knows the favicon (although it may be out of date). Set the
+ // favicon now, and if the favicon turns out to be expired (or the wrong
+ // url) we'll fetch later on. This way the user doesn't see a flash of the
+ // default favicon.
NotifyFaviconUpdated(favicon_bitmap_results);
}
« 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