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

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

Issue 11360233: Ensure that favicons always have 1x representation regardless of whether the platform supports it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | « chrome/browser/favicon/favicon_util.h ('k') | ui/base/layout.cc » ('j') | 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 83a9fa9e728188bd6abb1ddd6aa6e71abe07e009..62b82ea9c40af99018abfbbb0a740e9673b406b7 100644
--- a/chrome/browser/favicon/favicon_util.cc
+++ b/chrome/browser/favicon/favicon_util.cc
@@ -13,6 +13,24 @@
#include "ui/gfx/image/image_skia.h"
// static
+std::vector<ui::ScaleFactor> FaviconUtil::GetFaviconScaleFactors() {
+ static std::vector<ui::ScaleFactor>* favicon_scale_factors =
sky 2012/11/15 18:14:54 Is it really worth caching this? If we do, it mean
+ new std::vector<ui::ScaleFactor>();
+ if (favicon_scale_factors->empty()) {
+ favicon_scale_factors->push_back(ui::SCALE_FACTOR_100P);
+
+ std::vector<ui::ScaleFactor> supported_scale_factors =
+ ui::GetSupportedScaleFactors();
+ for (size_t i = 0; i < supported_scale_factors.size(); ++i) {
+ ui::ScaleFactor scale_factor = supported_scale_factors[i];
+ if (scale_factor != ui::SCALE_FACTOR_100P)
+ favicon_scale_factors->push_back(scale_factor);
+ }
+ }
+ return *favicon_scale_factors;
+}
+
+// static
int FaviconUtil::DownloadFavicon(content::RenderViewHost* rvh,
const GURL& url,
int image_size) {
@@ -43,6 +61,6 @@ gfx::Image FaviconUtil::SelectFaviconFramesFromPNGs(
return gfx::Image();
gfx::ImageSkia resized_image_skia = SelectFaviconFrames(bitmaps,
- ui::GetSupportedScaleFactors(), favicon_size, NULL);
+ scale_factors, favicon_size, NULL);
return gfx::Image(resized_image_skia);
}
« no previous file with comments | « chrome/browser/favicon/favicon_util.h ('k') | ui/base/layout.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698