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 486df2c83f31c1f571e2396ef7c972ab2c5a1880..019258f4ce087465bf779176d9fce37c8b1a9c1c 100644 |
| --- a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.h |
| +++ b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.h |
| @@ -11,19 +11,12 @@ |
| #include "components/omnibox/autocomplete_match.h" |
| class OmniboxPopupViewMac; |
| +@class OmniboxPopupCell; |
| -// 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 { |
| @private |
| - // The popup view parent of this cell. |
| - OmniboxPopupViewMac* parent_; |
| - |
| - // The match which will be rendered for this row in omnibox dropdown. |
| - AutocompleteMatch match_; |
| - |
| // NSAttributedString instances for various match components. |
| + base::scoped_nsobject<NSAttributedString> contents_; |
| base::scoped_nsobject<NSAttributedString> separator_; |
| base::scoped_nsobject<NSAttributedString> description_; |
| @@ -33,14 +26,29 @@ class OmniboxPopupViewMac; |
| // which accesses the |NSAttributedString| instance. |
| base::scoped_nsobject<NSAttributedString> prefix_; |
| + base::scoped_nsobject<NSImage> image_; |
| + |
| // The width of widest match contents in a set of infinite suggestions. |
| CGFloat maxMatchContentsWidth_; |
| // The offset at which the infinite suggestion contents should be displayed. |
| CGFloat contentsOffset_; |
| + |
| + BOOL isContentsRTL_; |
| + AutocompleteMatch::Type matchType_; |
| } |
| -- (void)setMatch:(const AutocompleteMatch&)match; |
| +@property (assign, nonatomic) NSRect rect; |
| + |
| +- (id)initWithMatch:(const AutocompleteMatch&)match; |
| + |
| +- (void)drawMatchWithFrame:(NSRect)cellFrame |
| + inCell:(OmniboxPopupCell*)cell |
| + inView:(NSView*)controlView; |
| + |
| +- (void)setContents:(NSAttributedString*)contents; |
| + |
| +- (void)setImage:(NSImage*)image; |
| - (void)setMaxMatchContentsWidth:(CGFloat)maxMatchContentsWidth; |
| @@ -49,6 +57,24 @@ class OmniboxPopupViewMac; |
| // Returns the width of the match contents. |
| - (CGFloat)getMatchContentsWidth; |
| +@end |
| + |
| +// 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 : NSCell { |
| + @private |
| + base::scoped_nsobject<OmniboxPopupCellData> cellData_; |
| +} |
| + |
| +- (void)setCellData:(OmniboxPopupCellData*)cellData; |
| + |
| +- (CGFloat)drawMatchPart:(NSAttributedString*)attributedString |
| + withFrame:(NSRect)cellFrame |
| + atOffset:(CGFloat)offset |
| + withMaxWidth:(int)maxWidth |
| + inView:(NSView*)controlView; |
|
Scott Hess - ex-Googler
2015/05/15 00:09:38
If this is only being exposed so that the cell imp
groby-ooo-7-16
2015/05/15 16:53:56
If it's a purely private category in a .mm, I'd su
dschuyler
2015/05/15 21:52:03
Thanks! I didn't know about that option.
Done.
dschuyler
2015/05/15 21:52:04
Done.
|
| + |
| // 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. |