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

Side by Side Diff: chrome/browser/extensions/extension_icon_image.cc

Issue 297763004: Fix extension icons showing up with incorrect size on Chrome HiDPI Windows with scales of 150% and … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/api/extension_action/extension_action_api.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_icon_image.h" 5 #include "chrome/browser/extensions/extension_icon_image.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 IconImage::~IconImage() { 157 IconImage::~IconImage() {
158 source_->ResetHost(); 158 source_->ResetHost();
159 } 159 }
160 160
161 gfx::ImageSkiaRep IconImage::LoadImageForScaleFactor( 161 gfx::ImageSkiaRep IconImage::LoadImageForScaleFactor(
162 ui::ScaleFactor scale_factor) { 162 ui::ScaleFactor scale_factor) {
163 // Do nothing if extension is unloaded. 163 // Do nothing if extension is unloaded.
164 if (!extension_) 164 if (!extension_)
165 return gfx::ImageSkiaRep(); 165 return gfx::ImageSkiaRep();
166 166
167 const float scale = ui::GetImageScale(scale_factor); 167 const float scale = ui::GetScaleForScaleFactor(scale_factor);
168 const int resource_size_in_pixel = 168 const int resource_size_in_pixel =
169 static_cast<int>(resource_size_in_dip_ * scale); 169 static_cast<int>(resource_size_in_dip_ * scale);
170 170
171 extensions::ExtensionResource resource; 171 extensions::ExtensionResource resource;
172 172
173 // Find extension resource for non bundled component extensions. 173 // Find extension resource for non bundled component extensions.
174 // We try loading bigger image only if resource size is >= 32. 174 // We try loading bigger image only if resource size is >= 32.
175 if (resource_size_in_pixel >= kMatchBiggerTreshold) { 175 if (resource_size_in_pixel >= kMatchBiggerTreshold) {
176 resource = GetExtensionIconResource(extension_, icon_set_, 176 resource = GetExtensionIconResource(extension_, icon_set_,
177 resource_size_in_pixel, ExtensionIconSet::MATCH_BIGGER); 177 resource_size_in_pixel, ExtensionIconSet::MATCH_BIGGER);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 const content::NotificationDetails& details) { 230 const content::NotificationDetails& details) {
231 DCHECK_EQ(type, chrome::NOTIFICATION_EXTENSION_REMOVED); 231 DCHECK_EQ(type, chrome::NOTIFICATION_EXTENSION_REMOVED);
232 232
233 const Extension* extension = content::Details<const Extension>(details).ptr(); 233 const Extension* extension = content::Details<const Extension>(details).ptr();
234 234
235 if (extension_ == extension) 235 if (extension_ == extension)
236 extension_ = NULL; 236 extension_ = NULL;
237 } 237 }
238 238
239 } // namespace extensions 239 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/extension_action/extension_action_api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698