Chromium Code Reviews| Index: athena/content/content_app_model_builder.cc |
| diff --git a/athena/content/content_app_model_builder.cc b/athena/content/content_app_model_builder.cc |
| index f91b1c10619f923ed217ff32002e791aa604b3fd..254758e18145925eae65cc58b0a7d62649dce673 100644 |
| --- a/athena/content/content_app_model_builder.cc |
| +++ b/athena/content/content_app_model_builder.cc |
| @@ -7,7 +7,10 @@ |
| #include "apps/shell/browser/shell_extension_system.h" |
| #include "athena/activity/public/activity_factory.h" |
| #include "athena/activity/public/activity_manager.h" |
| +#include "extensions/browser/extension_icon_image.h" |
| +#include "extensions/common/constants.h" |
| #include "extensions/common/extension.h" |
| +#include "extensions/common/manifest_handlers/icons_handler.h" |
| #include "ui/app_list/app_list_item.h" |
| #include "ui/app_list/app_list_model.h" |
| @@ -17,8 +20,6 @@ namespace athena { |
| namespace { |
| -const int kIconSize = 64; |
| - |
| ShellExtensionSystem* GetShellExtensionSystem( |
| content::BrowserContext* context) { |
| return static_cast<ShellExtensionSystem*>( |
| @@ -27,7 +28,10 @@ ShellExtensionSystem* GetShellExtensionSystem( |
| gfx::ImageSkia CreateFlatColorImage(SkColor color) { |
| SkBitmap bitmap; |
| - bitmap.setConfig(SkBitmap::kARGB_8888_Config, kIconSize, kIconSize); |
| + bitmap.setConfig( |
| + SkBitmap::kARGB_8888_Config, |
| + extension_misc::EXTENSION_ICON_MEDIUM, |
| + extension_misc::EXTENSION_ICON_MEDIUM); |
| bitmap.allocPixels(); |
| bitmap.eraseColor(color); |
| return gfx::ImageSkia::CreateFrom1xBitmap(bitmap); |
| @@ -61,15 +65,23 @@ class DummyItem : public app_list::AppListItem { |
| DISALLOW_COPY_AND_ASSIGN(DummyItem); |
| }; |
| -class AppItem : public app_list::AppListItem { |
| +class AppItem : public app_list::AppListItem, |
| + public extensions::IconImage::Observer { |
|
oshima
2014/06/19 23:06:22
is this observer used?
Jun Mukai
2014/06/19 23:08:32
oops, removed. thanks for catching this.
|
| public: |
| AppItem(scoped_refptr<extensions::Extension> extension, |
| content::BrowserContext* browser_context) |
| : app_list::AppListItem(extension->id()), |
| extension_(extension), |
| - browser_context_(browser_context) { |
| - // TODO(mukai): componentize extension_icon_image and use it. |
| - SetIcon(CreateFlatColorImage(SK_ColorBLACK), false); |
| + browser_context_(browser_context), |
| + icon_image_(browser_context_, |
| + extension.get(), |
| + extensions::IconsInfo::GetIcons(extension.get()), |
| + extension_misc::EXTENSION_ICON_MEDIUM, |
| + // TODO(mukai): better default icon |
| + CreateFlatColorImage(SK_ColorBLACK), |
| + NULL) { |
| + icon_image_.image_skia().EnsureRepsForSupportedScales(); |
| + SetIcon(icon_image_.image_skia(), false); |
| SetName(extension->name()); |
| } |
| @@ -83,6 +95,7 @@ class AppItem : public app_list::AppListItem { |
| scoped_refptr<extensions::Extension> extension_; |
| content::BrowserContext* browser_context_; |
| + extensions::IconImage icon_image_; |
| DISALLOW_COPY_AND_ASSIGN(AppItem); |
| }; |