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

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

Issue 2796343003: Remove preferences among favicon types when choosing large icons
Patch Set: Rebased. Created 3 years, 8 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 3c38c2de9ae0cd87bd409be258889e44b1e3fb1d..f00488a41ffa48405109a3e2d76cd5a3622e4b0e 100644
--- a/components/history/core/browser/history_backend.cc
+++ b/components/history/core/browser/history_backend.cc
@@ -1432,8 +1432,6 @@ void HistoryBackend::GetFavicons(
void HistoryBackend::GetLargestFaviconForURL(
const GURL& page_url,
- const std::vector<int>& icon_types,
- int minimum_size_in_pixels,
favicon_base::FaviconRawBitmapResult* favicon_bitmap_result) {
DCHECK(favicon_bitmap_result);
@@ -1447,57 +1445,27 @@ void HistoryBackend::GetLargestFaviconForURL(
icon_mappings.empty())
return;
- int required_icon_types = 0;
- for (std::vector<int>::const_iterator i = icon_types.begin();
- i != icon_types.end(); ++i) {
- required_icon_types |= *i;
- }
-
- // Find the largest bitmap for each IconType placing in
- // |largest_favicon_bitmaps|.
- std::map<favicon_base::IconType, FaviconBitmap> largest_favicon_bitmaps;
+ // Find the largest bitmap.
+ FaviconBitmap largest_icon;
for (std::vector<IconMapping>::const_iterator i = icon_mappings.begin();
i != icon_mappings.end(); ++i) {
- if (!(i->icon_type & required_icon_types))
- continue;
std::vector<FaviconBitmapIDSize> bitmap_id_sizes;
thumbnail_db_->GetFaviconBitmapIDSizes(i->icon_id, &bitmap_id_sizes);
- FaviconBitmap& largest = largest_favicon_bitmaps[i->icon_type];
for (std::vector<FaviconBitmapIDSize>::const_iterator j =
bitmap_id_sizes.begin();
j != bitmap_id_sizes.end(); ++j) {
- if (largest.bitmap_id == 0 ||
- (largest.pixel_size.width() < j->pixel_size.width() &&
- largest.pixel_size.height() < j->pixel_size.height())) {
- largest.icon_id = i->icon_id;
- largest.bitmap_id = j->bitmap_id;
- largest.pixel_size = j->pixel_size;
+ if (largest_icon.bitmap_id == 0 ||
+ (largest_icon.pixel_size.width() < j->pixel_size.width() &&
+ largest_icon.pixel_size.height() < j->pixel_size.height())) {
+ largest_icon.icon_id = i->icon_id;
+ largest_icon.bitmap_id = j->bitmap_id;
+ largest_icon.pixel_size = j->pixel_size;
}
}
}
- if (largest_favicon_bitmaps.empty())
+ if (largest_icon.bitmap_id == 0)
return;
- // Find an icon which is larger than minimum_size_in_pixels in the order of
- // icon_types.
- FaviconBitmap largest_icon;
- for (std::vector<int>::const_iterator t = icon_types.begin();
- t != icon_types.end(); ++t) {
- for (std::map<favicon_base::IconType, FaviconBitmap>::const_iterator f =
- largest_favicon_bitmaps.begin();
- f != largest_favicon_bitmaps.end(); ++f) {
- if (f->first & *t &&
- (largest_icon.bitmap_id == 0 ||
- (largest_icon.pixel_size.height() < f->second.pixel_size.height() &&
- largest_icon.pixel_size.width() < f->second.pixel_size.width()))) {
- largest_icon = f->second;
- }
- }
- if (largest_icon.pixel_size.width() > minimum_size_in_pixels &&
- largest_icon.pixel_size.height() > minimum_size_in_pixels)
- break;
- }
-
GURL icon_url;
favicon_base::IconType icon_type;
if (!thumbnail_db_->GetFaviconHeader(largest_icon.icon_id, &icon_url,
« 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