OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/autofill/autofill_popup_view_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 if (suggestion.frontend_id == autofill::POPUP_ITEM_ID_SEPARATOR) { | 119 if (suggestion.frontend_id == autofill::POPUP_ITEM_ID_SEPARATOR) { |
120 [self drawSeparatorWithBounds:rowBounds]; | 120 [self drawSeparatorWithBounds:rowBounds]; |
121 continue; | 121 continue; |
122 } | 122 } |
123 | 123 |
124 // Additional offset applied to the text in the vertical direction. | 124 // Additional offset applied to the text in the vertical direction. |
125 CGFloat textYOffset = 0; | 125 CGFloat textYOffset = 0; |
126 | 126 |
127 NSString* value = SysUTF16ToNSString(controller_->GetElidedValueAt(i)); | 127 NSString* value = SysUTF16ToNSString(controller_->GetElidedValueAt(i)); |
128 NSString* label = SysUTF16ToNSString(controller_->GetElidedLabelAt(i)); | 128 NSString* label = SysUTF16ToNSString(controller_->GetElidedLabelAt(i)); |
129 BOOL isSelected = static_cast<int>(i) == controller_->selected_line(); | 129 BOOL isSelected = controller_->selected_line() && |
| 130 i == controller_->selected_line().value(); |
130 [self drawSuggestionWithName:value | 131 [self drawSuggestionWithName:value |
131 subtext:label | 132 subtext:label |
132 index:i | 133 index:i |
133 bounds:rowBounds | 134 bounds:rowBounds |
134 selected:isSelected | 135 selected:isSelected |
135 textYOffset:textYOffset]; | 136 textYOffset:textYOffset]; |
136 } | 137 } |
137 } | 138 } |
138 | 139 |
139 #pragma mark - | 140 #pragma mark - |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 } | 305 } |
305 | 306 |
306 int iconId = delegate_->GetIconResourceID(icon); | 307 int iconId = delegate_->GetIconResourceID(icon); |
307 DCHECK_NE(-1, iconId); | 308 DCHECK_NE(-1, iconId); |
308 | 309 |
309 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 310 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
310 return rb.GetNativeImageNamed(iconId).ToNSImage(); | 311 return rb.GetNativeImageNamed(iconId).ToNSImage(); |
311 } | 312 } |
312 | 313 |
313 @end | 314 @end |
OLD | NEW |