OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/save_card_bubble_view_bridge.h" | 5 #import "chrome/browser/ui/cocoa/autofill/save_card_bubble_view_bridge.h" |
6 | 6 |
7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 9 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
10 #include "chrome/browser/ui/cocoa/chrome_style.h" | 10 #include "chrome/browser/ui/cocoa/chrome_style.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 - (void)loadView { | 229 - (void)loadView { |
230 // Title. | 230 // Title. |
231 NSString* title = SysUTF16ToNSString(bridge_->GetWindowTitle()); | 231 NSString* title = SysUTF16ToNSString(bridge_->GetWindowTitle()); |
232 base::scoped_nsobject<NSTextView> titleLabel( | 232 base::scoped_nsobject<NSTextView> titleLabel( |
233 [SaveCardBubbleViewCocoa makeWrappingLabel:title withFontSize:15.0]); | 233 [SaveCardBubbleViewCocoa makeWrappingLabel:title withFontSize:15.0]); |
234 | 234 |
235 // Credit card info. | 235 // Credit card info. |
236 autofill::CreditCard card = bridge_->GetCard(); | 236 autofill::CreditCard card = bridge_->GetCard(); |
237 base::scoped_nsobject<NSImageView> cardIcon( | 237 base::scoped_nsobject<NSImageView> cardIcon( |
238 [[NSImageView alloc] initWithFrame:NSZeroRect]); | 238 [[NSImageView alloc] initWithFrame:NSZeroRect]); |
239 [cardIcon setToolTip:base::SysUTF16ToNSString(card.TypeForDisplay())]; | 239 [cardIcon setToolTip:base::SysUTF16ToNSString(card.NetworkForDisplay())]; |
240 [cardIcon setWantsLayer:YES]; | 240 [cardIcon setWantsLayer:YES]; |
241 [[cardIcon layer] setBorderWidth:1.0]; | 241 [[cardIcon layer] setBorderWidth:1.0]; |
242 [[cardIcon layer] setCornerRadius:2.0]; | 242 [[cardIcon layer] setCornerRadius:2.0]; |
243 [[cardIcon layer] setMasksToBounds:YES]; | 243 [[cardIcon layer] setMasksToBounds:YES]; |
244 [[cardIcon layer] | 244 [[cardIcon layer] |
245 setBorderColor:skia::CGColorCreateFromSkColor(kIconBorderColor)]; | 245 setBorderColor:skia::CGColorCreateFromSkColor(kIconBorderColor)]; |
246 [cardIcon setImage:ResourceBundle::GetSharedInstance() | 246 [cardIcon |
247 .GetNativeImageNamed( | 247 setImage:ResourceBundle::GetSharedInstance() |
248 autofill::CreditCard::IconResourceId(card.type())) | 248 .GetNativeImageNamed( |
249 .AsNSImage()]; | 249 autofill::CreditCard::IconResourceId(card.network())) |
| 250 .AsNSImage()]; |
250 [cardIcon setFrameSize:[[cardIcon image] size]]; | 251 [cardIcon setFrameSize:[[cardIcon image] size]]; |
251 | 252 |
252 // Midline horizontal ellipsis follwed by last four digits. | 253 // Midline horizontal ellipsis follwed by last four digits. |
253 base::scoped_nsobject<NSTextField> lastFourLabel([SaveCardBubbleViewCocoa | 254 base::scoped_nsobject<NSTextField> lastFourLabel([SaveCardBubbleViewCocoa |
254 makeLabel:SysUTF16ToNSString(base::string16(autofill::kMidlineEllipsis) + | 255 makeLabel:SysUTF16ToNSString(base::string16(autofill::kMidlineEllipsis) + |
255 card.LastFourDigits())]); | 256 card.LastFourDigits())]); |
256 | 257 |
257 base::scoped_nsobject<NSTextField> expirationDateLabel( | 258 base::scoped_nsobject<NSTextField> expirationDateLabel( |
258 [SaveCardBubbleViewCocoa | 259 [SaveCardBubbleViewCocoa |
259 makeLabel:base::SysUTF16ToNSString( | 260 makeLabel:base::SysUTF16ToNSString( |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 } | 429 } |
429 } | 430 } |
430 | 431 |
431 // If none of the legal message links are the source of the click, the source | 432 // If none of the legal message links are the source of the click, the source |
432 // must be the learn more link. | 433 // must be the learn more link. |
433 bridge_->OnLearnMoreClicked(); | 434 bridge_->OnLearnMoreClicked(); |
434 return YES; | 435 return YES; |
435 } | 436 } |
436 | 437 |
437 @end | 438 @end |
OLD | NEW |