| Index: ui/app_list/cocoa/apps_grid_view_item.mm
|
| diff --git a/ui/app_list/cocoa/apps_grid_view_item.mm b/ui/app_list/cocoa/apps_grid_view_item.mm
|
| index e09065257b1f1e7df94c847077757df45f404750..db7d612efea01d7631294c984e7301c195aaf9de 100644
|
| --- a/ui/app_list/cocoa/apps_grid_view_item.mm
|
| +++ b/ui/app_list/cocoa/apps_grid_view_item.mm
|
| @@ -14,6 +14,7 @@
|
| #include "ui/base/resource/resource_bundle.h"
|
| #include "ui/gfx/image/image_skia_util_mac.h"
|
| #include "ui/gfx/font.h"
|
| +#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
|
|
|
| namespace {
|
|
|
| @@ -90,6 +91,18 @@ void ItemModelObserverBridge::ItemPercentDownloadedChanged() {
|
|
|
| @end
|
|
|
| +@interface AppsGridItemButtonCell : NSButtonCell {
|
| + @private
|
| + BOOL hasShadow_;
|
| +}
|
| +
|
| +@property(assign, nonatomic) BOOL hasShadow;
|
| +
|
| +@end
|
| +
|
| +@interface AppsGridItemButton : NSButton;
|
| +@end
|
| +
|
| @implementation AppsGridItemBackgroundView
|
|
|
| - (NSButton*)button {
|
| @@ -149,8 +162,8 @@ void ItemModelObserverBridge::ItemPercentDownloadedChanged() {
|
|
|
| - (id)initWithSize:(NSSize)tileSize {
|
| if ((self = [super init])) {
|
| - scoped_nsobject<NSButton> prototypeButton(
|
| - [[NSButton alloc] initWithFrame:NSMakeRect(
|
| + scoped_nsobject<AppsGridItemButton> prototypeButton(
|
| + [[AppsGridItemButton alloc] initWithFrame:NSMakeRect(
|
| 0, 0, tileSize.width, tileSize.height - kTileTopPadding)]);
|
|
|
| // This NSButton style always positions the icon at the very top of the
|
| @@ -182,6 +195,7 @@ void ItemModelObserverBridge::ItemPercentDownloadedChanged() {
|
| NSButton* button = [self button];
|
| [button setTitle:base::SysUTF8ToNSString(itemModel->title())];
|
| [button setImage:gfx::NSImageFromImageSkia(itemModel->icon())];
|
| + [[button cell] setHasShadow:itemModel->has_shadow()];
|
| observerBridge_.reset(new app_list::ItemModelObserverBridge(self, itemModel));
|
|
|
| if (trackingArea_.get())
|
| @@ -225,3 +239,40 @@ void ItemModelObserverBridge::ItemPercentDownloadedChanged() {
|
| }
|
|
|
| @end
|
| +
|
| +@implementation AppsGridItemButton
|
| +
|
| ++ (Class)cellClass {
|
| + return [AppsGridItemButtonCell class];
|
| +}
|
| +
|
| +@end
|
| +
|
| +@implementation AppsGridItemButtonCell
|
| +
|
| +@synthesize hasShadow = hasShadow_;
|
| +
|
| +- (void)drawImage:(NSImage*)image
|
| + withFrame:(NSRect)frame
|
| + inView:(NSView*)controlView {
|
| + if (!hasShadow_) {
|
| + [super drawImage:image
|
| + withFrame:frame
|
| + inView:controlView];
|
| + return;
|
| + }
|
| +
|
| + scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]);
|
| + gfx::ScopedNSGraphicsContextSaveGState context;
|
| + [shadow setShadowOffset:NSMakeSize(0, -2)];
|
| + [shadow setShadowBlurRadius:2.0];
|
| + [shadow setShadowColor:[NSColor colorWithCalibratedWhite:0
|
| + alpha:0.14]];
|
| + [shadow set];
|
| +
|
| + [super drawImage:image
|
| + withFrame:frame
|
| + inView:controlView];
|
| +}
|
| +
|
| +@end
|
|
|