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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 NSColor* nameColor = | 198 NSColor* nameColor = |
199 // TODO(crbug.com/666189): Use | |
msw
2016/11/17 18:49:39
Put this comment above the entire statement.
lshang
2016/11/18 00:03:19
Done.
| |
200 // AutofillPopupLayoutModel::GetValueFontColorForRow() instead and remove | |
201 // IsWarning() method. | |
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]; |
208 x -= rightAlign ? nameSize.width : 0; | 211 x -= rightAlign ? nameSize.width : 0; |
(...skipping 56 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 |