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

Unified Diff: trunk/src/chrome/browser/extensions/api/extension_action/extension_action_api.cc

Issue 24262008: Revert 224473 "Remove dependency on ui::ScaleFactor from ui/gfx" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 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
Index: trunk/src/chrome/browser/extensions/api/extension_action/extension_action_api.cc
===================================================================
--- trunk/src/chrome/browser/extensions/api/extension_action/extension_action_api.cc (revision 224497)
+++ trunk/src/chrome/browser/extensions/api/extension_action/extension_action_api.cc (working copy)
@@ -100,7 +100,8 @@
}
// Conversion function for reading/writing to storage.
-std::string RepresentationToString(const gfx::ImageSkia& image, float scale) {
+std::string RepresentationToString(const gfx::ImageSkia& image,
+ ui::ScaleFactor scale) {
SkBitmap bitmap = image.GetRepresentation(scale).sk_bitmap();
IPC::Message bitmap_pickle;
// Clear the header values so they don't vary in serialization.
@@ -143,8 +144,7 @@
if (icon_value->GetString(kIconSizes[i].size_string, &str_value) &&
StringToSkBitmap(str_value, &bitmap)) {
CHECK(!bitmap.isNull());
- float scale = ui::GetImageScale(kIconSizes[i].scale);
- icon.AddRepresentation(gfx::ImageSkiaRep(bitmap, scale));
+ icon.AddRepresentation(gfx::ImageSkiaRep(bitmap, kIconSizes[i].scale));
}
}
action->SetIcon(kTabId, gfx::Image(icon));
@@ -172,11 +172,10 @@
if (!icon.isNull()) {
base::DictionaryValue* icon_value = new base::DictionaryValue();
for (size_t i = 0; i < arraysize(kIconSizes); i++) {
- float scale = ui::GetImageScale(kIconSizes[i].scale);
- if (icon.HasRepresentation(scale)) {
+ if (icon.HasRepresentation(kIconSizes[i].scale)) {
icon_value->SetString(
kIconSizes[i].size_string,
- RepresentationToString(icon, scale));
+ RepresentationToString(icon, kIconSizes[i].scale));
}
}
dict->Set(kIconStorageKey, icon_value);
@@ -697,8 +696,7 @@
SkBitmap bitmap;
EXTENSION_FUNCTION_VALIDATE(IPC::ReadParam(&pickle, &iter, &bitmap));
CHECK(!bitmap.isNull());
- float scale = ui::GetImageScale(kIconSizes[i].scale);
- icon.AddRepresentation(gfx::ImageSkiaRep(bitmap, scale));
+ icon.AddRepresentation(gfx::ImageSkiaRep(bitmap, kIconSizes[i].scale));
}
}

Powered by Google App Engine
This is Rietveld 408576698