Index: ui/app_list/views/app_list_item_view.cc |
diff --git a/ui/app_list/views/app_list_item_view.cc b/ui/app_list/views/app_list_item_view.cc |
index 671d299ba55656ae88d0dc09fbf389b72ec07d0c..95cdeef07f5407a58c6e4727e2bb9c079070fc61 100644 |
--- a/ui/app_list/views/app_list_item_view.cc |
+++ b/ui/app_list/views/app_list_item_view.cc |
@@ -60,6 +60,15 @@ const float kDraggingIconScale = 1.5f; |
// Delay in milliseconds of when the dragging UI should be shown for mouse drag. |
const int kMouseDragUIDelayInMs = 200; |
+const gfx::ShadowValues& GetIconShadows() { |
+ CR_DEFINE_STATIC_LOCAL( |
+ const gfx::ShadowValues, |
+ icon_shadows, |
+ (1, |
+ gfx::ShadowValue(gfx::Point(0, 2), 2, SkColorSetARGB(0x24, 0, 0, 0)))); |
+ return icon_shadows; |
+} |
+ |
} // namespace |
// static |
@@ -88,11 +97,6 @@ AppListItemView::AppListItemView(AppsGridView* apps_grid_view, |
title_->Invalidate(); |
SetTitleSubpixelAA(); |
- const gfx::ShadowValue kIconShadows[] = { |
- gfx::ShadowValue(gfx::Point(0, 2), 2, SkColorSetARGB(0x24, 0, 0, 0)), |
- }; |
- icon_shadows_.assign(kIconShadows, kIconShadows + arraysize(kIconShadows)); |
- |
AddChildView(icon_); |
AddChildView(title_); |
AddChildView(progress_bar_); |
@@ -112,19 +116,7 @@ AppListItemView::~AppListItemView() { |
item_->RemoveObserver(this); |
} |
-void AppListItemView::SetIconSize(const gfx::Size& size) { |
- if (icon_size_ == size) |
- return; |
- |
- icon_size_ = size; |
- UpdateIcon(); |
-} |
- |
void AppListItemView::UpdateIcon() { |
- // Skip if |icon_size_| has not been determined. |
- if (icon_size_.IsEmpty()) |
- return; |
- |
gfx::ImageSkia icon = item_->icon(); |
// Clear icon and bail out if item icon is empty. |
if (icon.isNull()) { |
@@ -132,12 +124,13 @@ void AppListItemView::UpdateIcon() { |
return; |
} |
- gfx::ImageSkia resized(gfx::ImageSkiaOperations::CreateResizedImage(icon, |
- skia::ImageOperations::RESIZE_BEST, icon_size_)); |
+ gfx::ImageSkia resized(gfx::ImageSkiaOperations::CreateResizedImage( |
+ icon, |
+ skia::ImageOperations::RESIZE_BEST, |
+ gfx::Size(kPreferredIconDimension, kPreferredIconDimension))); |
if (item_->has_shadow()) { |
- gfx::ImageSkia shadow( |
- gfx::ImageSkiaOperations::CreateImageWithDropShadow(resized, |
- icon_shadows_)); |
+ gfx::ImageSkia shadow(gfx::ImageSkiaOperations::CreateImageWithDropShadow( |
+ resized, GetIconShadows())); |
icon_->SetImage(shadow); |
return; |
} |
@@ -313,7 +306,7 @@ void AppListItemView::Layout() { |
icon_->SetBoundsRect(GetIconBoundsForTargetViewBounds(GetContentsBounds())); |
const gfx::Size title_size = title_->GetPreferredSize(); |
gfx::Rect title_bounds(rect.x() + (rect.width() - title_size.width()) / 2, |
- y + icon_size_.height() + kIconTitleSpacing, |
+ y + kPreferredIconDimension + kIconTitleSpacing, |
benwells
2014/08/13 22:47:06
i think this name is misleading now. It isn't the
tapted
2014/08/14 00:54:34
Changed to app_list::kGridIconDimension. Looks lik
|
title_size.width(), |
title_size.height()); |
title_bounds.Intersect(rect); |
@@ -525,8 +518,9 @@ gfx::Rect AppListItemView::GetIconBoundsForTargetViewBounds( |
title_->font_list().GetExpectedTextWidth(kLeftRightPaddingChars); |
rect.Inset(left_right_padding, kTopPadding, left_right_padding, 0); |
- gfx::Rect icon_bounds(rect.x(), rect.y(), rect.width(), icon_size_.height()); |
- icon_bounds.Inset(gfx::ShadowValue::GetMargin(icon_shadows_)); |
+ gfx::Rect icon_bounds( |
+ rect.x(), rect.y(), rect.width(), kPreferredIconDimension); |
+ icon_bounds.Inset(gfx::ShadowValue::GetMargin(GetIconShadows())); |
return icon_bounds; |
} |