| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 - (NSInteger)highlightedRow { | 100 - (NSInteger)highlightedRow { |
| 101 return hoveredIndex_; | 101 return hoveredIndex_; |
| 102 } | 102 } |
| 103 | 103 |
| 104 - (void)setHighlightedRow:(NSInteger)rowIndex { | 104 - (void)setHighlightedRow:(NSInteger)rowIndex { |
| 105 hoveredIndex_ = rowIndex; | 105 hoveredIndex_ = rowIndex; |
| 106 } | 106 } |
| 107 | 107 |
| 108 - (CGFloat)tableView:(NSTableView*)tableView heightOfRow:(NSInteger)row { | 108 - (CGFloat)tableView:(NSTableView*)tableView heightOfRow:(NSInteger)row { |
| 109 CGFloat height = kContentLineHeight; | 109 CGFloat height = [OmniboxPopupCell getContentTextHeight]; |
| 110 if ([[array_ objectAtIndex:row] isAnswer]) { | 110 if ([[array_ objectAtIndex:row] isAnswer]) { |
| 111 OmniboxPopupMatrix* matrix = | 111 OmniboxPopupMatrix* matrix = |
| 112 base::mac::ObjCCastStrict<OmniboxPopupMatrix>(tableView); | 112 base::mac::ObjCCastStrict<OmniboxPopupMatrix>(tableView); |
| 113 NSRect rowRect = [tableView rectOfColumn:0]; | 113 NSRect rowRect = [tableView rectOfColumn:0]; |
| 114 OmniboxPopupCellData* cellData = | 114 OmniboxPopupCellData* cellData = |
| 115 base::mac::ObjCCastStrict<OmniboxPopupCellData>( | 115 base::mac::ObjCCastStrict<OmniboxPopupCellData>( |
| 116 [array_ objectAtIndex:row]); | 116 [array_ objectAtIndex:row]); |
| 117 // Subtract any Material Design padding and/or icon. | 117 // Subtract any Material Design padding and/or icon. |
| 118 rowRect.size.width = [OmniboxPopupCell getContentAreaWidth:rowRect] - | 118 rowRect.size.width = [OmniboxPopupCell getContentAreaWidth:rowRect] - |
| 119 [matrix contentLeftPadding]; | 119 [matrix contentLeftPadding]; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 [self selectRowIndex:row]; | 314 [self selectRowIndex:row]; |
| 315 if (row != -1) { | 315 if (row != -1) { |
| 316 DCHECK(observer_); | 316 DCHECK(observer_); |
| 317 observer_->OnMatrixRowSelected(self, row); | 317 observer_->OnMatrixRowSelected(self, row); |
| 318 return YES; | 318 return YES; |
| 319 } | 319 } |
| 320 return NO; | 320 return NO; |
| 321 } | 321 } |
| 322 | 322 |
| 323 @end | 323 @end |
| OLD | NEW |