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

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.mm

Issue 2727233003: Uses child views in Autofill Popup so we can trigger (Closed)
Patch Set: Uses base::Optional<size_t> instead of representing no selection as -1. Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698