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

Unified Diff: chrome/browser/win/jumplist.cc

Issue 2665623002: Fix Jumplist favicons to have high resolution in HDPI Windows displays (Closed)
Patch Set: Get bitmap of suitable size. Created 3 years, 10 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/win/jumplist.cc
diff --git a/chrome/browser/win/jumplist.cc b/chrome/browser/win/jumplist.cc
index 508093dfa290fa460552fa29d95bdf17c8b071eb..5822b8cb50674d418cf092ddc28ce5f6af6b8aeb 100644
--- a/chrome/browser/win/jumplist.cc
+++ b/chrome/browser/win/jumplist.cc
@@ -41,10 +41,13 @@
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_source.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/display/display.h"
+#include "ui/display/screen.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/favicon_size.h"
#include "ui/gfx/icon_util.h"
#include "ui/gfx/image/image_family.h"
+#include "ui/gfx/image/image_skia.h"
#include "url/gurl.h"
using content::BrowserThread;
@@ -541,10 +544,24 @@ void JumpList::OnFaviconDataAvailable(
base::AutoLock auto_lock(data->list_lock_);
// Attach the received data to the ShellLinkItem object.
// This data will be decoded by the RunUpdateOnFileThread method.
- if (!image_result.image.IsEmpty()) {
- if (!data->icon_urls_.empty() && data->icon_urls_.front().second.get())
- data->icon_urls_.front().second->set_icon_data(
- image_result.image.AsBitmap());
+ if (!image_result.image.IsEmpty() && !data->icon_urls_.empty() &&
+ data->icon_urls_.front().second.get()) {
+ const gfx::ImageSkia* imageskia = image_result.image.ToImageSkia();
sky 2017/02/04 00:01:59 The check you want is if (!image_result.image.IsEm
chengx 2017/02/04 00:18:59 This check is already used in Line 547 above. Or d
sky 2017/02/06 16:50:46 Because of the IsEmpty() check you shouldn't need
+ if (imageskia) {
+ float scale = 1.0;
+ display::Screen* screen = display::Screen::GetScreen();
+ if (screen) {
+ const std::vector<display::Display> displays(
+ screen->GetAllDisplays());
+ for (auto& display : displays)
+ scale = std::max(scale, display.device_scale_factor());
+ }
+ gfx::ImageSkiaRep imageSkiaRep = imageskia->GetRepresentation(scale);
+ if (!imageSkiaRep.is_null()) {
+ data->icon_urls_.front().second->set_icon_data(
+ imageSkiaRep.sk_bitmap());
+ }
+ }
}
if (!data->icon_urls_.empty())
« 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