| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_CELL_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_CELL_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_CELL_H_ | 6 #define CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_CELL_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| 11 #include "components/omnibox/browser/autocomplete_match.h" | 11 #include "components/omnibox/browser/autocomplete_match.h" |
| 12 | 12 |
| 13 class OmniboxPopupViewMac; | 13 class OmniboxPopupViewMac; |
| 14 | 14 |
| 15 @interface OmniboxPopupCellData : NSObject<NSCopying> { | 15 @interface OmniboxPopupCellData : NSObject<NSCopying> |
| 16 @private | |
| 17 // Left hand side of the separator (e.g. a hyphen). | |
| 18 NSAttributedString* contents_; | |
| 19 // Right hand side of the separator (e.g. a hyphen). | |
| 20 NSAttributedString* description_; | |
| 21 | 16 |
| 22 // NOTE: While |prefix_| is used only for postfix suggestions, it still needs | 17 // Left hand side of the separator (e.g. a hyphen). |
| 23 // to be a member of the class. This allows the |NSAttributedString| instance | 18 @property(readonly, retain, nonatomic) NSAttributedString* contents; |
| 24 // to stay alive between the call to |drawTitle| and the actual paint event | |
| 25 // which accesses the |NSAttributedString| instance. | |
| 26 NSAttributedString* prefix_; | |
| 27 | 19 |
| 28 // Common icon that shows next to most rows in the list. | 20 // Right hand side of the separator (e.g. a hyphen). |
| 29 NSImage* image_; | 21 @property(readonly, retain, nonatomic) NSAttributedString* description; |
| 30 // Uncommon icon that only shows on answer rows (e.g. weather). | |
| 31 NSImage* answerImage_; | |
| 32 | 22 |
| 33 // The offset at which the infinite suggestion contents should be displayed. | 23 // NOTE: While |prefix_| is used only for postfix suggestions, it still needs |
| 34 CGFloat contentsOffset_; | 24 // to be a member of the class. This allows the |NSAttributedString| instance |
| 25 // to stay alive between the call to |drawTitle| and the actual paint event |
| 26 // which accesses the |NSAttributedString| instance. |
| 27 @property(readonly, retain, nonatomic) NSAttributedString* prefix; |
| 35 | 28 |
| 36 BOOL isContentsRTL_; | 29 // Common icon that shows next to most rows in the list. |
| 37 | |
| 38 // Is this suggestion an answer or calculator result. | |
| 39 bool isAnswer_; | |
| 40 | |
| 41 AutocompleteMatch::Type matchType_; | |
| 42 | |
| 43 int max_lines_; | |
| 44 } | |
| 45 | |
| 46 @property(readonly, retain, nonatomic) NSAttributedString* contents; | |
| 47 @property(readonly, retain, nonatomic) NSAttributedString* description; | |
| 48 @property(readonly, retain, nonatomic) NSAttributedString* prefix; | |
| 49 @property(readonly, retain, nonatomic) NSImage* image; | 30 @property(readonly, retain, nonatomic) NSImage* image; |
| 50 @property(retain, nonatomic) NSImage* incognitoImage; | 31 @property(retain, nonatomic) NSImage* incognitoImage; |
| 32 |
| 33 // Uncommon icon that only shows on answer rows (e.g. weather). |
| 51 @property(readonly, retain, nonatomic) NSImage* answerImage; | 34 @property(readonly, retain, nonatomic) NSImage* answerImage; |
| 35 |
| 36 // The offset at which the infinite suggestion contents should be displayed. |
| 52 @property(readonly, nonatomic) CGFloat contentsOffset; | 37 @property(readonly, nonatomic) CGFloat contentsOffset; |
| 53 @property(readonly, nonatomic) BOOL isContentsRTL; | 38 @property(readonly, nonatomic) BOOL isContentsRTL; |
| 39 |
| 40 // Is this suggestion an answer or calculator result. |
| 54 @property(readonly, nonatomic) bool isAnswer; | 41 @property(readonly, nonatomic) bool isAnswer; |
| 55 @property(readonly, nonatomic) AutocompleteMatch::Type matchType; | 42 @property(readonly, nonatomic) AutocompleteMatch::Type matchType; |
| 56 @property(readonly, nonatomic) int max_lines; | 43 @property(readonly, nonatomic) int max_lines; |
| 57 | 44 |
| 58 - (instancetype)initWithMatch:(const AutocompleteMatch&)match | 45 - (instancetype)initWithMatch:(const AutocompleteMatch&)match |
| 59 contentsOffset:(CGFloat)contentsOffset | 46 contentsOffset:(CGFloat)contentsOffset |
| 60 image:(NSImage*)image | 47 image:(NSImage*)image |
| 61 answerImage:(NSImage*)answerImage | 48 answerImage:(NSImage*)answerImage |
| 62 forDarkTheme:(BOOL)isDarkTheme; | 49 forDarkTheme:(BOOL)isDarkTheme; |
| 63 | 50 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 79 | 66 |
| 80 + (NSAttributedString*)createSeparatorStringForDarkTheme:(BOOL)isDarkTheme; | 67 + (NSAttributedString*)createSeparatorStringForDarkTheme:(BOOL)isDarkTheme; |
| 81 | 68 |
| 82 + (CGFloat)getContentAreaWidth:(NSRect)cellFrame; | 69 + (CGFloat)getContentAreaWidth:(NSRect)cellFrame; |
| 83 | 70 |
| 84 @end | 71 @end |
| 85 | 72 |
| 86 const CGFloat kContentLineHeight = 25.0; | 73 const CGFloat kContentLineHeight = 25.0; |
| 87 | 74 |
| 88 #endif // CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_CELL_H_ | 75 #endif // CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_POPUP_CELL_H_ |
| OLD | NEW |