 Chromium Code Reviews
 Chromium Code Reviews Issue 345773004:
  Load the actual app icon in Athena.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 345773004:
  Load the actual app icon in Athena.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| 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..0f5eed72aa464277f50a53f3b191504f577f3c3f 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); | 
| @@ -67,9 +71,16 @@ class AppItem : public app_list::AppListItem { | 
| 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(); | 
| 
xiyuan
2014/06/20 21:36:04
nit: This is not necessary. AppListMainView::Prelo
 | 
| + SetIcon(icon_image_.image_skia(), false); | 
| SetName(extension->name()); | 
| } | 
| @@ -83,6 +94,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); | 
| }; |