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

Unified Diff: chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc

Issue 10918186: Expire favicons which were added with default favicon sizes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « chrome/browser/ui/webui/chrome_web_ui_controller_factory.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
index a30e9d2e903062dc465e02b1682576c320b133f0..4f6171754a8d1b76f544d33372dca5fa7aff33f5 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -60,6 +60,7 @@
#include "content/public/browser/web_ui.h"
#include "content/public/common/content_client.h"
#include "googleurl/src/gurl.h"
+#include "ui/gfx/favicon_size.h"
#include "ui/web_dialogs/constrained_web_dialog_ui.h"
#include "ui/web_dialogs/web_dialog_ui.h"
@@ -488,12 +489,33 @@ void ChromeWebUIControllerFactory::GetFaviconForURL(
if (bitmap.get() && bitmap->size()) {
history::FaviconBitmapResult bitmap_result;
bitmap_result.bitmap_data = bitmap;
+ // Leave |bitmap_result|'s icon URL as the default of GURL().
bitmap_result.icon_type = history::FAVICON;
favicon_bitmap_results.push_back(bitmap_result);
+
+ // Assume that |bitmap| is |gfx::kFaviconSize| x |gfx::kFaviconSize|
+ // DIP.
+ float scale = ui::GetScaleFactorScale(scale_factors[i]);
+ int edge_pixel_size =
+ static_cast<int>(gfx::kFaviconSize * scale + 0.5f);
+ bitmap_result.pixel_size = gfx::Size(edge_pixel_size, edge_pixel_size);
}
}
+
+ // Populate IconURLSizesMap such that the requirement that all the icon URLs
+ // in |favicon_bitmap_results| be present in |icon_url_sizes| holds.
+ // Populate the favicon sizes with the pixel sizes of the bitmaps available
+ // for |url|.
+ history::IconURLSizesMap icon_url_sizes;
+ for (size_t i = 0; i < favicon_bitmap_results.size(); ++i) {
+ const history::FaviconBitmapResult& bitmap_result =
+ favicon_bitmap_results[i];
+ const GURL& icon_url = bitmap_result.icon_url;
+ icon_url_sizes[icon_url].push_back(bitmap_result.pixel_size);
+ }
+
request->ForwardResultAsync(request->handle(), favicon_bitmap_results,
- history::IconURLSizesMap());
+ icon_url_sizes);
}
}
« no previous file with comments | « chrome/browser/ui/webui/chrome_web_ui_controller_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698