Chromium Code Reviews| Index: chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.h |
| diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.h b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.h |
| index d72200b95cb2c123b18ad203ec63938ddb645744..5de96c05162b4288199c9c785480fda4177a9984 100644 |
| --- a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.h |
| +++ b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.h |
| @@ -12,51 +12,64 @@ |
| class OmniboxPopupViewMac; |
| -// OmniboxPopupCell overrides how backgrounds are displayed to |
| -// handle hover versus selected. So long as we're in there, it also |
| -// provides some default initialization. |
| -@interface OmniboxPopupCell : NSButtonCell { |
| +@interface OmniboxPopupCellData : NSObject<NSCopying> { |
| @private |
| - // The match which will be rendered for this row in omnibox dropdown. |
| - AutocompleteMatch match_; |
| - |
| // NSAttributedString instances for various match components. |
|
Scott Hess - ex-Googler
2015/06/12 22:21:59
The comment telling us that the NSAttributedString
dschuyler
2015/06/12 23:07:54
Done.
|
| - base::scoped_nsobject<NSAttributedString> separator_; |
| - base::scoped_nsobject<NSAttributedString> description_; |
| + NSAttributedString* contents_; |
| + NSAttributedString* description_; |
| - base::scoped_nsobject<NSImage> answerImage_; |
| + NSImage* answerImage_; |
| // NOTE: While |prefix_| is used only for postfix suggestions, it still needs |
| // to be a member of the class. This allows the |NSAttributedString| instance |
| // to stay alive between the call to |drawTitle| and the actual paint event |
| // which accesses the |NSAttributedString| instance. |
| - base::scoped_nsobject<NSAttributedString> prefix_; |
| + NSAttributedString* prefix_; |
| - // The width of widest match contents in a set of infinite suggestions. |
| - CGFloat maxMatchContentsWidth_; |
| + NSImage* image_; |
| // The offset at which the infinite suggestion contents should be displayed. |
| CGFloat contentsOffset_; |
| -} |
| - |
| -- (void)setAnswerImage:(NSImage*)image; |
| -- (void)setMatch:(const AutocompleteMatch&)match; |
| + BOOL isContentsRTL_; |
| + AutocompleteMatch::Type matchType_; |
| +} |
| -- (NSAttributedString*)description; |
| +@property(readonly, retain, nonatomic) NSAttributedString* contents; |
| +@property(readonly, retain, nonatomic) NSAttributedString* description; |
| +@property(readonly, retain, nonatomic) NSAttributedString* prefix; |
| +@property(readonly, retain, nonatomic) NSImage* image; |
| +@property(readonly, retain, nonatomic) NSImage* answerImage; |
| +@property(readonly, nonatomic) CGFloat contentsOffset; |
| +@property(readonly, nonatomic) BOOL isContentsRTL; |
| +@property(readonly, nonatomic) AutocompleteMatch::Type matchType; |
| -- (void)setMaxMatchContentsWidth:(CGFloat)maxMatchContentsWidth; |
| +- (instancetype)initWithMatch:(const AutocompleteMatch&)match |
| + contentsOffset:(CGFloat)contentsOffset |
| + image:(NSImage*)image |
| + answerImage:(NSImage*)answerImage; |
| -- (void)setContentsOffset:(CGFloat)contentsOffset; |
| +// Each row is allowed to have a different value. |
| +- (CGFloat)rowHeight; |
| // Returns the width of the match contents. |
| - (CGFloat)getMatchContentsWidth; |
| +@end |
| + |
| +// OmniboxPopupCell overrides how cells are displayed. The OmniboxPopupCell |
| +// uses information from OmniboxPopupCellData to draw suggestion results. |
|
Scott Hess - ex-Googler
2015/06/12 22:21:59
I'd also remove the talking-about-myself-by-given-
dschuyler
2015/06/12 23:07:53
Done.
|
| +@interface OmniboxPopupCell : NSCell |
| + |
| +- (void)drawMatchWithFrame:(NSRect)cellFrame inView:(NSView*)controlView; |
| + |
| // Returns the offset of the start of the contents in the input text for the |
| // given match. It is costly to compute this offset, so it is computed once and |
| // shared by all OmniboxPopupCell instances through OmniboxPopupViewMac parent. |
| + (CGFloat)computeContentsOffset:(const AutocompleteMatch&)match; |
| ++ (NSAttributedString*)createSeparatorString; |
| + |
| @end |
| #endif // CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_CELL_H_ |