Commit 4ef5fa41 authored by tapted@chromium.org's avatar tapted@chromium.org

Resize webstore icons to a known size before placing them in the app list model.

Icons from the webstore can be unusual sizes. Once installed,
ExtensionAppItem uses extension_misc::EXTENSION_ICON_MEDIUM (48) to load
it, so be consistent with that.

BUG=338253
TEST=(CrOS) Start installing a large app from the webstore (e.g. tank
riders). While it has a progress bar, drag it around the app launcher -
the icon should grow a little, not a lot (see bug for screenshots).

Review URL: https://codereview.chromium.org/400893002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284879 0039d316-1c4b-4281-b951-d872f2087c98
parent 1d7727ea
...@@ -24,9 +24,11 @@ ...@@ -24,9 +24,11 @@
#include "extensions/browser/extension_system.h" #include "extensions/browser/extension_system.h"
#include "extensions/browser/extensions_browser_client.h" #include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/pref_names.h" #include "extensions/browser/pref_names.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
#include "extensions/common/extension_set.h" #include "extensions/common/extension_set.h"
#include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_operations.h"
using extensions::Extension; using extensions::Extension;
...@@ -104,9 +106,18 @@ void ExtensionAppModelBuilder::OnBeginExtensionInstall( ...@@ -104,9 +106,18 @@ void ExtensionAppModelBuilder::OnBeginExtensionInstall(
existing_item->SetIsInstalling(true); existing_item->SetIsInstalling(true);
return; return;
} }
// Icons from the webstore can be unusual sizes. Once installed,
// ExtensionAppItem uses extension_misc::EXTENSION_ICON_MEDIUM (48) to load
// it, so be consistent with that.
gfx::Size icon_size(extension_misc::EXTENSION_ICON_MEDIUM,
extension_misc::EXTENSION_ICON_MEDIUM);
gfx::ImageSkia resized(gfx::ImageSkiaOperations::CreateResizedImage(
params.installing_icon, skia::ImageOperations::RESIZE_BEST, icon_size));
InsertApp(CreateAppItem(params.extension_id, InsertApp(CreateAppItem(params.extension_id,
params.extension_name, params.extension_name,
params.installing_icon, resized,
params.is_platform_app)); params.is_platform_app));
SetHighlightedApp(params.extension_id); SetHighlightedApp(params.extension_id);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment