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

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

Issue 10828127: Use hi-resolution favicon variants if available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: grrrrr Created 8 years, 4 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/favicon/favicon_tab_helper.h ('k') | chrome/browser/ui/views/ash/balloon_view_ash.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/favicon/favicon_tab_helper.cc
diff --git a/chrome/browser/favicon/favicon_tab_helper.cc b/chrome/browser/favicon/favicon_tab_helper.cc
index a0e833a3357e28b7b9a1b4c9689039343d6a0e00..649527224d2320742a7ed224d7447cb3d0478778 100644
--- a/chrome/browser/favicon/favicon_tab_helper.cc
+++ b/chrome/browser/favicon/favicon_tab_helper.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/favicon/favicon_handler.h"
#include "chrome/browser/favicon/favicon_util.h"
+#include "chrome/browser/favicon/select_favicon_frames.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/profiles/profile.h"
@@ -24,6 +25,8 @@
#include "content/public/browser/web_ui.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/image/image.h"
+#include "ui/gfx/image/image_skia.h"
+#include "ui/gfx/image/image_skia_rep.h"
using content::FaviconStatus;
using content::NavigationController;
@@ -186,11 +189,22 @@ bool FaviconTabHelper::OnMessageReceived(const IPC::Message& message) {
return message_handled;
}
-void FaviconTabHelper::OnDidDownloadFavicon(int id,
- const GURL& image_url,
- bool errored,
- const SkBitmap& image) {
- gfx::Image favicon(image);
+void FaviconTabHelper::OnDidDownloadFavicon(
+ int id,
+ const GURL& image_url,
+ bool errored,
+ int requested_size,
+ const std::vector<SkBitmap>& bitmaps) {
+ // TODO: Possibly do bitmap selection in FaviconHandler, so that it can score
+ // favicons better.
+ std::vector<ui::ScaleFactor> scale_factors;
+#if defined(OS_MACOSX)
+ scale_factors = ui::GetSupportedScaleFactors();
+#else
+ scale_factors.push_back(ui::SCALE_FACTOR_100P); // TODO: Aura?
+#endif
+ gfx::Image favicon(
+ SelectFaviconFrames(bitmaps, scale_factors, requested_size));
favicon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon);
if (touch_icon_handler_.get())
touch_icon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon);
« no previous file with comments | « chrome/browser/favicon/favicon_tab_helper.h ('k') | chrome/browser/ui/views/ash/balloon_view_ash.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698