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

Unified Diff: athena/content/content_app_model_builder.cc

Issue 345773004: Load the actual app icon in Athena. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« apps/shell/common/shell_extensions_client.cc ('K') | « athena/content/DEPS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« apps/shell/common/shell_extensions_client.cc ('K') | « athena/content/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698