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

Unified Diff: chrome/browser/ui/cocoa/omnibox/omnibox_popup_matrix.mm

Issue 1821823004: [Mac][Material Design] Update Omnibox dropdown on Mac to MD (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up for review. Created 4 years, 8 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
Index: chrome/browser/ui/cocoa/omnibox/omnibox_popup_matrix.mm
diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_matrix.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_matrix.mm
index c3dc7e6afd3619ad3405343af3e5c689df680a7c..e7c2f0346d7fd5ec5bf66b25d61f1f6778b7af41 100644
--- a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_matrix.mm
+++ b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_matrix.mm
@@ -32,6 +32,7 @@ const NSInteger kMiddleButtonNumber = 2;
popupView:(const OmniboxPopupViewMac&)popupView
answerImage:(NSImage*)answerImage {
base::scoped_nsobject<NSMutableArray> array([[NSMutableArray alloc] init]);
+ BOOL isDarkTheme = [tableView hasDarkTheme];
CGFloat max_match_contents_width = 0.0f;
CGFloat contentsOffset = -1.0f;
for (const AutocompleteMatch& match : result) {
@@ -42,8 +43,12 @@ const NSInteger kMiddleButtonNumber = 2;
[[OmniboxPopupCellData alloc]
initWithMatch:match
contentsOffset:contentsOffset
- image:popupView.ImageForMatch(match)
- answerImage:(match.answer ? answerImage : nil)]);
+ image:popupView.ImageForMatch(match, NO)
+ answerImage:(match.answer ? answerImage : nil)
+ forDarkTheme:isDarkTheme]);
+ if (isDarkTheme) {
+ [cellData setIncognitoImage:popupView.ImageForMatch(match, YES)];
+ }
[array addObject:cellData];
if (match.type == AutocompleteMatchType::SEARCH_SUGGEST_TAIL) {
max_match_contents_width =
@@ -118,10 +123,14 @@ const NSInteger kMiddleButtonNumber = 2;
@synthesize separator = separator_;
@synthesize maxMatchContentsWidth = maxMatchContentsWidth_;
@synthesize answerLineHeight = answerLineHeight_;
+@synthesize contentLeftPadding = contentLeftPadding_;
+@synthesize hasDarkTheme = hasDarkTheme_;
-- (instancetype)initWithObserver:(OmniboxPopupMatrixObserver*)observer {
+- (instancetype)initWithObserver:(OmniboxPopupMatrixObserver*)observer
+ forDarkTheme:(BOOL)isDarkTheme {
if ((self = [super initWithFrame:NSZeroRect])) {
observer_ = observer;
+ hasDarkTheme_ = isDarkTheme;
base::scoped_nsobject<NSTableColumn> column(
[[NSTableColumn alloc] initWithIdentifier:@"MainColumn"]);
@@ -132,7 +141,9 @@ const NSInteger kMiddleButtonNumber = 2;
[self setIntercellSpacing:NSMakeSize(0.0, 0.0)];
[self setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleNone];
- [self setBackgroundColor:[NSColor controlBackgroundColor]];
+ NSColor* backgroundColor =
+ OmniboxPopupViewMac::BackgroundColor(hasDarkTheme_);
+ [self setBackgroundColor:backgroundColor];
[self setAllowsEmptySelection:YES];
[self deselectAll:self];

Powered by Google App Engine
This is Rietveld 408576698