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..aad7325ac55c86977b0363216746021c33350cd2 100644 |
| --- a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.h |
| +++ b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.h |
| @@ -12,51 +12,66 @@ |
| 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. |
| - 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(retain, nonatomic) NSAttributedString* contents; |
|
groby-ooo-7-16
2015/06/12 18:51:06
We ultimately want this readonly, since this _shou
dschuyler
2015/06/12 21:39:13
Done.
|
| +@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(nonatomic) CGFloat contentsOffset; |
|
groby-ooo-7-16
2015/06/12 18:51:06
See above re: immutable.
dschuyler
2015/06/12 21:39:14
Done.
|
| +@property(readonly, nonatomic) BOOL isContentsRTL; |
| +@property(readonly, nonatomic) AutocompleteMatch::Type matchType; |
| -- (void)setMaxMatchContentsWidth:(CGFloat)maxMatchContentsWidth; |
| +- (instancetype)initWithMatch:(const AutocompleteMatch&)match |
| + 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. |
| +@interface OmniboxPopupCell : NSCell { |
|
groby-ooo-7-16
2015/06/12 18:51:06
Skip the empty braces - not needed if you don't ha
dschuyler
2015/06/12 21:39:13
Done.
dschuyler
2015/06/12 21:39:14
Done.
|
| +} |
| + |
| +- (void)drawMatchWithFrame:(NSRect)cellFrame |
| + withCellData:(OmniboxPopupCellData*)cellData |
|
groby-ooo-7-16
2015/06/12 18:51:06
Does this need cellData? Can't it retrieve that fr
dschuyler
2015/06/12 21:39:13
Done.
dschuyler
2015/06/12 21:39:13
It can retrieve it from objectValue. Which is pre
|
| + 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_ |