| Index: ui/app_list/cocoa/apps_search_results_controller.mm
|
| diff --git a/ui/app_list/cocoa/apps_search_results_controller.mm b/ui/app_list/cocoa/apps_search_results_controller.mm
|
| index 314f079e8ad0811830c9949ef6eb68725f989939..c14a90081adf309e44c6aa8e020dc0d55431b37b 100644
|
| --- a/ui/app_list/cocoa/apps_search_results_controller.mm
|
| +++ b/ui/app_list/cocoa/apps_search_results_controller.mm
|
| @@ -50,12 +50,17 @@ const NSBackgroundStyle kBackgroundHovered = NSBackgroundStyleRaised;
|
| @private
|
| base::scoped_nsobject<NSAttributedString> attributedStringValue_;
|
| base::scoped_nsobject<NSImage> resultIcon_;
|
| +
|
| + // Width of the table cell that needs to be set aside for action buttons.
|
| + CGFloat actionButtonWidth_;
|
| }
|
|
|
| @property(readonly, nonatomic) NSAttributedString* attributedStringValue;
|
| @property(readonly, nonatomic) NSImage* resultIcon;
|
| +@property(readonly, nonatomic) CGFloat actionButtonWidth;
|
|
|
| -- (id)initWithSearchResult:(app_list::SearchResult*)result;
|
| +- (id)initWithSearchResult:(app_list::SearchResult*)result
|
| + actionButtonWidth:(CGFloat)actionButtonWidth;
|
|
|
| - (NSMutableAttributedString*)createRenderText:(const base::string16&)content
|
| tags:(const app_list::SearchResult::Tags&)tags;
|
| @@ -258,7 +263,8 @@ const NSBackgroundStyle kBackgroundHovered = NSBackgroundStyleRaised;
|
|
|
| base::scoped_nsobject<AppsSearchResultRep> resultRep(
|
| [[AppsSearchResultRep alloc]
|
| - initWithSearchResult:[self searchResults]->GetItemAt(rowIndex)]);
|
| + initWithSearchResult:[self searchResults]->GetItemAt(rowIndex)
|
| + actionButtonWidth:bridge_->ActionButtonWidthForItem(rowIndex)]);
|
| return resultRep.autorelease();
|
| }
|
|
|
| @@ -300,6 +306,8 @@ const NSBackgroundStyle kBackgroundHovered = NSBackgroundStyleRaised;
|
|
|
| @implementation AppsSearchResultRep
|
|
|
| +@synthesize actionButtonWidth = actionButtonWidth_;
|
| +
|
| - (NSAttributedString*)attributedStringValue {
|
| return attributedStringValue_;
|
| }
|
| @@ -308,7 +316,8 @@ const NSBackgroundStyle kBackgroundHovered = NSBackgroundStyleRaised;
|
| return resultIcon_;
|
| }
|
|
|
| -- (id)initWithSearchResult:(app_list::SearchResult*)result {
|
| +- (id)initWithSearchResult:(app_list::SearchResult*)result
|
| + actionButtonWidth:(CGFloat)actionButtonWidth {
|
| if ((self = [super init])) {
|
| attributedStringValue_.reset(
|
| [[self createResultsAttributedStringWithModel:result] retain]);
|
| @@ -316,6 +325,7 @@ const NSBackgroundStyle kBackgroundHovered = NSBackgroundStyleRaised;
|
| resultIcon_.reset([gfx::NSImageFromImageSkiaWithColorSpace(
|
| result->icon(), base::mac::GetSRGBColorSpace()) retain]);
|
| }
|
| + actionButtonWidth_ = actionButtonWidth;
|
| }
|
| return self;
|
| }
|
| @@ -433,7 +443,9 @@ const NSBackgroundStyle kBackgroundHovered = NSBackgroundStyleRaised;
|
|
|
| NSAttributedString* titleText = [self attributedStringValue];
|
| NSRect titleRect = cellFrame;
|
| - titleRect.size.width -= kTextTrailPadding + kIconViewWidth;
|
| + titleRect.size.width -= kTextTrailPadding + kIconViewWidth +
|
| + [[self objectValue] actionButtonWidth];
|
| +
|
| titleRect.origin.x += kIconViewWidth;
|
| titleRect.origin.y +=
|
| floor(NSHeight(cellFrame) / 2 - [titleText size].height / 2);
|
|
|