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/i18n/rtl.h" | |
8 #include "base/logging.h" | 7 #include "base/logging.h" |
9 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
10 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" | 9 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" |
11 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h" | 10 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h" |
12 #include "grit/ui_resources.h" | 11 #include "grit/ui_resources.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" |
14 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
15 #include "ui/gfx/image/image.h" | 14 #include "ui/gfx/image/image.h" |
16 #include "ui/gfx/point.h" | 15 #include "ui/gfx/point.h" |
17 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 subtext:(NSString*)subtext | 188 subtext:(NSString*)subtext |
190 index:(size_t)index | 189 index:(size_t)index |
191 bounds:(NSRect)bounds | 190 bounds:(NSRect)bounds |
192 selected:(BOOL)isSelected { | 191 selected:(BOOL)isSelected { |
193 // If this row is selected, highlight it. | 192 // If this row is selected, highlight it. |
194 if (isSelected) { | 193 if (isSelected) { |
195 [HighlightColor() set]; | 194 [HighlightColor() set]; |
196 [NSBezierPath fillRect:bounds]; | 195 [NSBezierPath fillRect:bounds]; |
197 } | 196 } |
198 | 197 |
199 BOOL isRTL = base::i18n::IsRTL(); | 198 BOOL isRTL = controller_->IsRTL(); |
200 | 199 |
201 NSDictionary* nameAttributes = | 200 NSDictionary* nameAttributes = |
202 [NSDictionary dictionaryWithObjectsAndKeys: | 201 [NSDictionary dictionaryWithObjectsAndKeys: |
203 controller_->GetNameFontForRow(index).GetNativeFont(), | 202 controller_->GetNameFontForRow(index).GetNativeFont(), |
204 NSFontAttributeName, NameColor(), NSForegroundColorAttributeName, | 203 NSFontAttributeName, NameColor(), NSForegroundColorAttributeName, |
205 nil]; | 204 nil]; |
206 NSSize nameSize = [name sizeWithAttributes:nameAttributes]; | 205 NSSize nameSize = [name sizeWithAttributes:nameAttributes]; |
207 CGFloat x = bounds.origin.x + | 206 CGFloat x = bounds.origin.x + |
208 (isRTL ? | 207 (isRTL ? |
209 bounds.size.width - AutofillPopupView::kEndPadding - nameSize.width : | 208 bounds.size.width - AutofillPopupView::kEndPadding - nameSize.width : |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 return nil; | 253 return nil; |
255 | 254 |
256 int iconId = controller_->GetIconResourceID(controller_->icons()[index]); | 255 int iconId = controller_->GetIconResourceID(controller_->icons()[index]); |
257 DCHECK_NE(-1, iconId); | 256 DCHECK_NE(-1, iconId); |
258 | 257 |
259 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 258 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
260 return rb.GetNativeImageNamed(iconId).ToNSImage(); | 259 return rb.GetNativeImageNamed(iconId).ToNSImage(); |
261 } | 260 } |
262 | 261 |
263 @end | 262 @end |
OLD | NEW |