| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 bounds:bounds | 190 bounds:bounds |
| 191 textYOffset:textYOffset]; | 191 textYOffset:textYOffset]; |
| 192 } | 192 } |
| 193 | 193 |
| 194 - (CGFloat)drawName:(NSString*)name | 194 - (CGFloat)drawName:(NSString*)name |
| 195 atX:(CGFloat)x | 195 atX:(CGFloat)x |
| 196 index:(size_t)index | 196 index:(size_t)index |
| 197 rightAlign:(BOOL)rightAlign | 197 rightAlign:(BOOL)rightAlign |
| 198 bounds:(NSRect)bounds | 198 bounds:(NSRect)bounds |
| 199 textYOffset:(CGFloat)textYOffset { | 199 textYOffset:(CGFloat)textYOffset { |
| 200 // TODO(crbug.com/666189): Use | 200 NSColor* nameColor = skia::SkColorToSRGBNSColor( |
| 201 // AutofillPopupLayoutModel::GetValueFontColorForRow() instead and remove | 201 controller_->layout_model().GetValueFontColorForRow(index)); |
| 202 // IsWarning() method. | |
| 203 NSColor* nameColor = | |
| 204 controller_->IsWarning(index) ? [self warningColor] : [self nameColor]; | |
| 205 NSDictionary* nameAttributes = [NSDictionary | 202 NSDictionary* nameAttributes = [NSDictionary |
| 206 dictionaryWithObjectsAndKeys:controller_->layout_model() | 203 dictionaryWithObjectsAndKeys:controller_->layout_model() |
| 207 .GetValueFontListForRow(index) | 204 .GetValueFontListForRow(index) |
| 208 .GetPrimaryFont() | 205 .GetPrimaryFont() |
| 209 .GetNativeFont(), | 206 .GetNativeFont(), |
| 210 NSFontAttributeName, nameColor, | 207 NSFontAttributeName, nameColor, |
| 211 NSForegroundColorAttributeName, nil]; | 208 NSForegroundColorAttributeName, nil]; |
| 212 NSSize nameSize = [name sizeWithAttributes:nameAttributes]; | 209 NSSize nameSize = [name sizeWithAttributes:nameAttributes]; |
| 213 x -= rightAlign ? nameSize.width : 0; | 210 x -= rightAlign ? nameSize.width : 0; |
| 214 CGFloat y = bounds.origin.y + (bounds.size.height - nameSize.height) / 2; | 211 CGFloat y = bounds.origin.y + (bounds.size.height - nameSize.height) / 2; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 return nil; | 268 return nil; |
| 272 | 269 |
| 273 int iconId = delegate_->GetIconResourceID(icon); | 270 int iconId = delegate_->GetIconResourceID(icon); |
| 274 DCHECK_NE(-1, iconId); | 271 DCHECK_NE(-1, iconId); |
| 275 | 272 |
| 276 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 273 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 277 return rb.GetNativeImageNamed(iconId).ToNSImage(); | 274 return rb.GetNativeImageNamed(iconId).ToNSImage(); |
| 278 } | 275 } |
| 279 | 276 |
| 280 @end | 277 @end |
| OLD | NEW |