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

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

Issue 1508893003: Use proper namespace in skia/ext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years 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
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"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 // Ignore all hit tests. The grid controller needs to be the owner of any drags. 167 // Ignore all hit tests. The grid controller needs to be the owner of any drags.
168 - (NSView*)hitTest:(NSPoint)aPoint { 168 - (NSView*)hitTest:(NSPoint)aPoint {
169 return nil; 169 return nil;
170 } 170 }
171 171
172 - (void)drawRect:(NSRect)dirtyRect { 172 - (void)drawRect:(NSRect)dirtyRect {
173 if (!selected_) 173 if (!selected_)
174 return; 174 return;
175 175
176 [gfx::SkColorToSRGBNSColor(app_list::kSelectedColor) set]; 176 [skia::SkColorToSRGBNSColor(app_list::kSelectedColor) set];
177 NSRectFillUsingOperation(dirtyRect, NSCompositeSourceOver); 177 NSRectFillUsingOperation(dirtyRect, NSCompositeSourceOver);
178 } 178 }
179 179
180 - (void)mouseDown:(NSEvent*)theEvent { 180 - (void)mouseDown:(NSEvent*)theEvent {
181 [[[self button] cell] setHighlighted:YES]; 181 [[[self button] cell] setHighlighted:YES];
182 } 182 }
183 183
184 - (void)mouseDragged:(NSEvent*)theEvent { 184 - (void)mouseDragged:(NSEvent*)theEvent {
185 NSPoint pointInView = [self convertPoint:[theEvent locationInWindow] 185 NSPoint pointInView = [self convertPoint:[theEvent locationInWindow]
186 fromView:nil]; 186 fromView:nil];
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 [paragraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; 236 [paragraphStyle setLineBreakMode:NSLineBreakByTruncatingTail];
237 [paragraphStyle setAlignment:NSCenterTextAlignment]; 237 [paragraphStyle setAlignment:NSCenterTextAlignment];
238 NSDictionary* titleAttributes = @{ 238 NSDictionary* titleAttributes = @{
239 NSParagraphStyleAttributeName : paragraphStyle, 239 NSParagraphStyleAttributeName : paragraphStyle,
240 NSFontAttributeName : ui::ResourceBundle::GetSharedInstance() 240 NSFontAttributeName : ui::ResourceBundle::GetSharedInstance()
241 .GetFontList(app_list::kItemTextFontStyle) 241 .GetFontList(app_list::kItemTextFontStyle)
242 .DeriveWithSizeDelta(kMacFontSizeDelta) 242 .DeriveWithSizeDelta(kMacFontSizeDelta)
243 .GetPrimaryFont() 243 .GetPrimaryFont()
244 .GetNativeFont(), 244 .GetNativeFont(),
245 NSForegroundColorAttributeName : 245 NSForegroundColorAttributeName :
246 gfx::SkColorToSRGBNSColor(app_list::kGridTitleColor) 246 skia::SkColorToSRGBNSColor(app_list::kGridTitleColor)
247 }; 247 };
248 NSString* buttonTitle = 248 NSString* buttonTitle =
249 base::SysUTF8ToNSString([self model]->GetDisplayName()); 249 base::SysUTF8ToNSString([self model]->GetDisplayName());
250 base::scoped_nsobject<NSAttributedString> attributedTitle( 250 base::scoped_nsobject<NSAttributedString> attributedTitle(
251 [[NSAttributedString alloc] initWithString:buttonTitle 251 [[NSAttributedString alloc] initWithString:buttonTitle
252 attributes:titleAttributes]); 252 attributes:titleAttributes]);
253 [[self button] setAttributedTitle:attributedTitle]; 253 [[self button] setAttributedTitle:attributedTitle];
254 254
255 // If the display name would be truncated in the NSButton, or if the display 255 // If the display name would be truncated in the NSButton, or if the display
256 // name differs from the full name, add a tooltip showing the full name. 256 // name differs from the full name, add a tooltip showing the full name.
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « ui/app_list/cocoa/app_list_view_controller.mm ('k') | ui/app_list/cocoa/apps_search_results_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698