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/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" | 9 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" |
10 #include "chrome/browser/ui/autofill/autofill_popup_layout_model.h" | 10 #include "chrome/browser/ui/autofill/autofill_popup_layout_model.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 bounds:bounds | 188 bounds:bounds |
189 textYOffset:textYOffset]; | 189 textYOffset:textYOffset]; |
190 } | 190 } |
191 | 191 |
192 - (CGFloat)drawName:(NSString*)name | 192 - (CGFloat)drawName:(NSString*)name |
193 atX:(CGFloat)x | 193 atX:(CGFloat)x |
194 index:(size_t)index | 194 index:(size_t)index |
195 rightAlign:(BOOL)rightAlign | 195 rightAlign:(BOOL)rightAlign |
196 bounds:(NSRect)bounds | 196 bounds:(NSRect)bounds |
197 textYOffset:(CGFloat)textYOffset { | 197 textYOffset:(CGFloat)textYOffset { |
| 198 // TODO(crbug.com/666189): Use |
| 199 // AutofillPopupLayoutModel::GetValueFontColorForRow() instead and remove |
| 200 // IsWarning() method. |
198 NSColor* nameColor = | 201 NSColor* nameColor = |
199 controller_->IsWarning(index) ? [self warningColor] : [self nameColor]; | 202 controller_->IsWarning(index) ? [self warningColor] : [self nameColor]; |
200 NSDictionary* nameAttributes = [NSDictionary | 203 NSDictionary* nameAttributes = [NSDictionary |
201 dictionaryWithObjectsAndKeys:controller_->layout_model() | 204 dictionaryWithObjectsAndKeys:controller_->layout_model() |
202 .GetValueFontListForRow(index) | 205 .GetValueFontListForRow(index) |
203 .GetPrimaryFont() | 206 .GetPrimaryFont() |
204 .GetNativeFont(), | 207 .GetNativeFont(), |
205 NSFontAttributeName, nameColor, | 208 NSFontAttributeName, nameColor, |
206 NSForegroundColorAttributeName, nil]; | 209 NSForegroundColorAttributeName, nil]; |
207 NSSize nameSize = [name sizeWithAttributes:nameAttributes]; | 210 NSSize nameSize = [name sizeWithAttributes:nameAttributes]; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 return nil; | 268 return nil; |
266 | 269 |
267 int iconId = delegate_->GetIconResourceID(icon); | 270 int iconId = delegate_->GetIconResourceID(icon); |
268 DCHECK_NE(-1, iconId); | 271 DCHECK_NE(-1, iconId); |
269 | 272 |
270 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 273 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
271 return rb.GetNativeImageNamed(iconId).ToNSImage(); | 274 return rb.GetNativeImageNamed(iconId).ToNSImage(); |
272 } | 275 } |
273 | 276 |
274 @end | 277 @end |
OLD | NEW |