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

Side by Side Diff: ui/app_list/cocoa/apps_grid_view_item.mm

Issue 151693004: Clean-up: Replaces obsolete Font/FontList methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced. Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/app_list/cocoa/signin_view_controller.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "skia/ext/skia_utils_mac.h" 11 #include "skia/ext/skia_utils_mac.h"
12 #include "ui/app_list/app_list_constants.h" 12 #include "ui/app_list/app_list_constants.h"
13 #include "ui/app_list/app_list_item.h" 13 #include "ui/app_list/app_list_item.h"
14 #include "ui/app_list/app_list_item_observer.h" 14 #include "ui/app_list/app_list_item_observer.h"
15 #import "ui/app_list/cocoa/apps_grid_controller.h" 15 #import "ui/app_list/cocoa/apps_grid_controller.h"
16 #import "ui/base/cocoa/menu_controller.h" 16 #import "ui/base/cocoa/menu_controller.h"
17 #include "ui/base/resource/resource_bundle.h" 17 #include "ui/base/resource/resource_bundle.h"
18 #include "ui/gfx/font.h" 18 #include "ui/gfx/font_list.h"
19 #include "ui/gfx/image/image_skia_operations.h" 19 #include "ui/gfx/image/image_skia_operations.h"
20 #include "ui/gfx/image/image_skia_util_mac.h" 20 #include "ui/gfx/image/image_skia_util_mac.h"
21 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" 21 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
22 22
23 namespace { 23 namespace {
24 24
25 // Padding from the top of the tile to the top of the app icon. 25 // Padding from the top of the tile to the top of the app icon.
26 const CGFloat kTileTopPadding = 10; 26 const CGFloat kTileTopPadding = 10;
27 27
28 const CGFloat kIconSize = 48; 28 const CGFloat kIconSize = 48;
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 if (progressIndicator_) 262 if (progressIndicator_)
263 return; 263 return;
264 264
265 base::scoped_nsobject<NSMutableParagraphStyle> paragraphStyle( 265 base::scoped_nsobject<NSMutableParagraphStyle> paragraphStyle(
266 [[NSMutableParagraphStyle alloc] init]); 266 [[NSMutableParagraphStyle alloc] init]);
267 [paragraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; 267 [paragraphStyle setLineBreakMode:NSLineBreakByTruncatingTail];
268 [paragraphStyle setAlignment:NSCenterTextAlignment]; 268 [paragraphStyle setAlignment:NSCenterTextAlignment];
269 NSDictionary* titleAttributes = @{ 269 NSDictionary* titleAttributes = @{
270 NSParagraphStyleAttributeName : paragraphStyle, 270 NSParagraphStyleAttributeName : paragraphStyle,
271 NSFontAttributeName : ui::ResourceBundle::GetSharedInstance() 271 NSFontAttributeName : ui::ResourceBundle::GetSharedInstance()
272 .GetFont(app_list::kItemTextFontStyle) 272 .GetFontList(app_list::kItemTextFontStyle)
273 .DeriveFont(kMacFontSizeDelta) 273 .DeriveWithSizeDelta(kMacFontSizeDelta)
274 .GetPrimaryFont()
274 .GetNativeFont(), 275 .GetNativeFont(),
275 NSForegroundColorAttributeName : [self isSelected] ? 276 NSForegroundColorAttributeName : [self isSelected] ?
276 gfx::SkColorToSRGBNSColor(app_list::kGridTitleHoverColor) : 277 gfx::SkColorToSRGBNSColor(app_list::kGridTitleHoverColor) :
277 gfx::SkColorToSRGBNSColor(app_list::kGridTitleColor) 278 gfx::SkColorToSRGBNSColor(app_list::kGridTitleColor)
278 }; 279 };
279 NSString* buttonTitle = base::SysUTF8ToNSString([self model]->title()); 280 NSString* buttonTitle = base::SysUTF8ToNSString([self model]->title());
280 base::scoped_nsobject<NSAttributedString> attributedTitle( 281 base::scoped_nsobject<NSAttributedString> attributedTitle(
281 [[NSAttributedString alloc] initWithString:buttonTitle 282 [[NSAttributedString alloc] initWithString:buttonTitle
282 attributes:titleAttributes]); 283 attributes:titleAttributes]);
283 [[self button] setAttributedTitle:attributedTitle]; 284 [[self button] setAttributedTitle:attributedTitle];
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 } 490 }
490 491
491 // Workaround for http://crbug.com/324365: AppKit in Mavericks tries to call 492 // Workaround for http://crbug.com/324365: AppKit in Mavericks tries to call
492 // - [NSButtonCell item] when inspecting accessibility. Without this, an 493 // - [NSButtonCell item] when inspecting accessibility. Without this, an
493 // unrecognized selector exception is thrown inside AppKit, crashing Chrome. 494 // unrecognized selector exception is thrown inside AppKit, crashing Chrome.
494 - (id)item { 495 - (id)item {
495 return nil; 496 return nil;
496 } 497 }
497 498
498 @end 499 @end
OLDNEW
« no previous file with comments | « no previous file | ui/app_list/cocoa/signin_view_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698