| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ui/app_list/cocoa/apps_grid_view_item.h" | 5 #import "ui/app_list/cocoa/apps_grid_view_item.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
| 9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 - (void)updateButtonImage { | 267 - (void)updateButtonImage { |
| 268 const gfx::Size iconSize = gfx::Size(kIconSize, kIconSize); | 268 const gfx::Size iconSize = gfx::Size(kIconSize, kIconSize); |
| 269 gfx::ImageSkia icon = [self model]->icon(); | 269 gfx::ImageSkia icon = [self model]->icon(); |
| 270 if (icon.size() != iconSize) { | 270 if (icon.size() != iconSize) { |
| 271 icon = gfx::ImageSkiaOperations::CreateResizedImage( | 271 icon = gfx::ImageSkiaOperations::CreateResizedImage( |
| 272 icon, skia::ImageOperations::RESIZE_BEST, iconSize); | 272 icon, skia::ImageOperations::RESIZE_BEST, iconSize); |
| 273 } | 273 } |
| 274 NSImage* buttonImage = gfx::NSImageFromImageSkiaWithColorSpace( | 274 NSImage* buttonImage = gfx::NSImageFromImageSkiaWithColorSpace( |
| 275 icon, base::mac::GetSRGBColorSpace()); | 275 icon, base::mac::GetSRGBColorSpace()); |
| 276 [[self button] setImage:buttonImage]; | 276 [[self button] setImage:buttonImage]; |
| 277 [[[self button] cell] setHasShadow:[self model]->has_shadow()]; | 277 [[[self button] cell] setHasShadow:true]; |
| 278 } | 278 } |
| 279 | 279 |
| 280 - (void)setModel:(app_list::AppListItem*)itemModel { | 280 - (void)setModel:(app_list::AppListItem*)itemModel { |
| 281 [trackingArea_.get() clearOwner]; | 281 [trackingArea_.get() clearOwner]; |
| 282 if (!itemModel) { | 282 if (!itemModel) { |
| 283 observerBridge_.reset(); | 283 observerBridge_.reset(); |
| 284 return; | 284 return; |
| 285 } | 285 } |
| 286 | 286 |
| 287 observerBridge_.reset(new app_list::ItemModelObserverBridge(self, itemModel)); | 287 observerBridge_.reset(new app_list::ItemModelObserverBridge(self, itemModel)); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 } | 445 } |
| 446 | 446 |
| 447 // Workaround for http://crbug.com/324365: AppKit in Mavericks tries to call | 447 // Workaround for http://crbug.com/324365: AppKit in Mavericks tries to call |
| 448 // - [NSButtonCell item] when inspecting accessibility. Without this, an | 448 // - [NSButtonCell item] when inspecting accessibility. Without this, an |
| 449 // unrecognized selector exception is thrown inside AppKit, crashing Chrome. | 449 // unrecognized selector exception is thrown inside AppKit, crashing Chrome. |
| 450 - (id)item { | 450 - (id)item { |
| 451 return nil; | 451 return nil; |
| 452 } | 452 } |
| 453 | 453 |
| 454 @end | 454 @end |
| OLD | NEW |