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

Unified Diff: ui/app_list/cocoa/apps_search_results_controller.mm

Issue 19460003: One-click install for the OSX App Launcher Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Cleaner, more future-proof Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
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);
« no previous file with comments | « ui/app_list/cocoa/apps_search_results_controller.h ('k') | ui/app_list/cocoa/apps_search_results_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698