| 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 #import "chrome/browser/ui/cocoa/omnibox/omnibox_popup_matrix.h" | 5 #import "chrome/browser/ui/cocoa/omnibox/omnibox_popup_matrix.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/mac/foundation_util.h" | 8 #include "base/mac/foundation_util.h" |
| 9 #import "chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.h" | 9 #import "chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.h" |
| 10 #include "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h" | 10 #include "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 CGFloat max_match_contents_width = 0.0f; | 36 CGFloat max_match_contents_width = 0.0f; |
| 37 CGFloat contentsOffset = -1.0f; | 37 CGFloat contentsOffset = -1.0f; |
| 38 for (const AutocompleteMatch& match : result) { | 38 for (const AutocompleteMatch& match : result) { |
| 39 if (match.type == AutocompleteMatchType::SEARCH_SUGGEST_TAIL && | 39 if (match.type == AutocompleteMatchType::SEARCH_SUGGEST_TAIL && |
| 40 contentsOffset < 0.0f) | 40 contentsOffset < 0.0f) |
| 41 contentsOffset = [OmniboxPopupCell computeContentsOffset:match]; | 41 contentsOffset = [OmniboxPopupCell computeContentsOffset:match]; |
| 42 base::scoped_nsobject<OmniboxPopupCellData> cellData( | 42 base::scoped_nsobject<OmniboxPopupCellData> cellData( |
| 43 [[OmniboxPopupCellData alloc] | 43 [[OmniboxPopupCellData alloc] |
| 44 initWithMatch:match | 44 initWithMatch:match |
| 45 contentsOffset:contentsOffset | 45 contentsOffset:contentsOffset |
| 46 image:popupView.ImageForMatch(match, NO) | 46 image:popupView.ImageForMatch(match) |
| 47 answerImage:(match.answer ? answerImage : nil) | 47 answerImage:(match.answer ? answerImage : nil) |
| 48 forDarkTheme:isDarkTheme]); | 48 forDarkTheme:isDarkTheme]); |
| 49 if (isDarkTheme) { | 49 if (isDarkTheme) |
| 50 [cellData setIncognitoImage:popupView.ImageForMatch(match, YES)]; | 50 [cellData setIncognitoImage:popupView.ImageForMatch(match)]; |
| 51 } | |
| 52 [array addObject:cellData]; | 51 [array addObject:cellData]; |
| 53 if (match.type == AutocompleteMatchType::SEARCH_SUGGEST_TAIL) { | 52 if (match.type == AutocompleteMatchType::SEARCH_SUGGEST_TAIL) { |
| 54 max_match_contents_width = | 53 max_match_contents_width = |
| 55 std::max(max_match_contents_width, [cellData getMatchContentsWidth]); | 54 std::max(max_match_contents_width, [cellData getMatchContentsWidth]); |
| 56 } | 55 } |
| 57 } | 56 } |
| 58 | 57 |
| 59 [tableView setMaxMatchContentsWidth:max_match_contents_width]; | 58 [tableView setMaxMatchContentsWidth:max_match_contents_width]; |
| 60 return [self initWithArray:array]; | 59 return [self initWithArray:array]; |
| 61 } | 60 } |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 [self selectRowIndex:row]; | 298 [self selectRowIndex:row]; |
| 300 if (row != -1) { | 299 if (row != -1) { |
| 301 DCHECK(observer_); | 300 DCHECK(observer_); |
| 302 observer_->OnMatrixRowSelected(self, row); | 301 observer_->OnMatrixRowSelected(self, row); |
| 303 return YES; | 302 return YES; |
| 304 } | 303 } |
| 305 return NO; | 304 return NO; |
| 306 } | 305 } |
| 307 | 306 |
| 308 @end | 307 @end |
| OLD | NEW |