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

Unified Diff: chrome/browser/favicon/favicon_util.cc

Issue 23569008: Never decode the favicon in FaviconUtil::SelectFaviconFramesFromPNGs() when the desired size is 0 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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: chrome/browser/favicon/favicon_util.cc
diff --git a/chrome/browser/favicon/favicon_util.cc b/chrome/browser/favicon/favicon_util.cc
index 29c15297d880c8c9cb0a77cc1bf9706387b57dfe..4d7dff2414a967026b4d1aed19c95608f30f228d 100644
--- a/chrome/browser/favicon/favicon_util.cc
+++ b/chrome/browser/favicon/favicon_util.cc
@@ -32,7 +32,7 @@ std::vector<gfx::ImagePNGRep> SelectFaviconFramesFromPNGsWithoutResizing(
return png_reps;
// A |favicon_size| of 0 indicates that the largest frame is desired.
- if (favicon_size == 0 && scale_factors.size() == 1) {
+ if (favicon_size == 0) {
int maximum_area = 0;
scoped_refptr<base::RefCountedMemory> best_candidate;
for (size_t i = 0; i < png_data.size(); ++i) {
@@ -43,7 +43,7 @@ std::vector<gfx::ImagePNGRep> SelectFaviconFramesFromPNGsWithoutResizing(
}
}
png_reps.push_back(gfx::ImagePNGRep(best_candidate,
- scale_factors[0]));
+ ui::SCALE_FACTOR_100P));
return png_reps;
}
@@ -134,6 +134,11 @@ gfx::Image FaviconUtil::SelectFaviconFramesFromPNGs(
SelectFaviconFramesFromPNGsWithoutResizing(png_data, scale_factors,
favicon_size);
+ // SelectFaviconFramesFromPNGsWithoutResizing() should have selected the
+ // largest favicon if |favicon_size| == 0.
+ if (favicon_size == 0)
+ return gfx::Image(png_reps);
+
std::vector<ui::ScaleFactor> scale_factors_to_generate = scale_factors;
for (size_t i = 0; i < png_reps.size(); ++i) {
std::vector<ui::ScaleFactor>::iterator it = std::find(
« 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