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

Unified Diff: chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.h

Issue 1099403005: [AiS] changing mac omnibox suggestions form NSMatrix to NSTableView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: autorelease on column data cell Created 5 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..703516311c17e5f7a02e9546dfadcc4b0e6484f6 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_;
-
- base::scoped_nsobject<NSImage> answerImage_;
+ // Left hand side of the separator (e.g. a hyphen).
+ NSAttributedString* contents_;
+ // Right hand side of the separator (e.g. a hyphen).
+ NSAttributedString* description_;
// 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_;
+ // Common icon that shows next to most rows in the list.
+ NSImage* image_;
+ // Uncommon icon that only shows on answer rows (e.g. weather).
+ NSImage* answerImage_;
// 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
+
+// Overrides how cells are displayed. Uses information from
+// OmniboxPopupCellData to draw suggestion results.
+@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_
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698