OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ios/chrome/browser/ui/payments/payment_request_view_controller.h" | 5 #import "ios/chrome/browser/ui/payments/payment_request_view_controller.h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 | 8 |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 withOption:(web::PaymentShippingOption*)option { | 470 withOption:(web::PaymentShippingOption*)option { |
471 item.text = base::SysUTF16ToNSString(option->label); | 471 item.text = base::SysUTF16ToNSString(option->label); |
472 payments::CurrencyFormatter* currencyFormatter = | 472 payments::CurrencyFormatter* currencyFormatter = |
473 _paymentRequest->GetOrCreateCurrencyFormatter(); | 473 _paymentRequest->GetOrCreateCurrencyFormatter(); |
474 item.detailText = SysUTF16ToNSString( | 474 item.detailText = SysUTF16ToNSString( |
475 currencyFormatter->Format(base::UTF16ToASCII(option->amount.value))); | 475 currencyFormatter->Format(base::UTF16ToASCII(option->amount.value))); |
476 } | 476 } |
477 | 477 |
478 - (void)fillPaymentMethodItem:(PaymentMethodItem*)item | 478 - (void)fillPaymentMethodItem:(PaymentMethodItem*)item |
479 withCreditCard:(autofill::CreditCard*)creditCard { | 479 withCreditCard:(autofill::CreditCard*)creditCard { |
480 item.methodID = base::SysUTF16ToNSString(creditCard->TypeAndLastFourDigits()); | 480 item.methodID = |
| 481 base::SysUTF16ToNSString(creditCard->NetworkAndLastFourDigits()); |
481 item.methodDetail = base::SysUTF16ToNSString( | 482 item.methodDetail = base::SysUTF16ToNSString( |
482 creditCard->GetRawInfo(autofill::CREDIT_CARD_NAME_FULL)); | 483 creditCard->GetRawInfo(autofill::CREDIT_CARD_NAME_FULL)); |
483 int cardTypeIconID = | 484 int issuerNetworkIconID = |
484 autofill::data_util::GetPaymentRequestData(creditCard->type()) | 485 autofill::data_util::GetPaymentRequestData(creditCard->network()) |
485 .icon_resource_id; | 486 .icon_resource_id; |
486 item.methodTypeIcon = NativeImage(cardTypeIconID); | 487 item.methodTypeIcon = NativeImage(issuerNetworkIconID); |
487 } | 488 } |
488 | 489 |
489 - (void)fillContactInfoItem:(AutofillProfileItem*)item | 490 - (void)fillContactInfoItem:(AutofillProfileItem*)item |
490 withAutofillProfile:(autofill::AutofillProfile*)profile { | 491 withAutofillProfile:(autofill::AutofillProfile*)profile { |
491 DCHECK(profile); | 492 DCHECK(profile); |
492 item.name = GetNameLabelFromAutofillProfile(*profile); | 493 item.name = GetNameLabelFromAutofillProfile(*profile); |
493 item.phoneNumber = GetPhoneNumberLabelFromAutofillProfile(*profile); | 494 item.phoneNumber = GetPhoneNumberLabelFromAutofillProfile(*profile); |
494 item.email = GetEmailLabelFromAutofillProfile(*profile); | 495 item.email = GetEmailLabelFromAutofillProfile(*profile); |
495 } | 496 } |
496 | 497 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 | 625 |
625 - (BOOL)collectionView:(UICollectionView*)collectionView | 626 - (BOOL)collectionView:(UICollectionView*)collectionView |
626 shouldHideItemBackgroundAtIndexPath:(NSIndexPath*)indexPath { | 627 shouldHideItemBackgroundAtIndexPath:(NSIndexPath*)indexPath { |
627 // No background on the footer text item. | 628 // No background on the footer text item. |
628 NSInteger sectionIdentifier = | 629 NSInteger sectionIdentifier = |
629 [self.collectionViewModel sectionIdentifierForSection:indexPath.section]; | 630 [self.collectionViewModel sectionIdentifierForSection:indexPath.section]; |
630 return sectionIdentifier == SectionIdentifierFooter ? YES : NO; | 631 return sectionIdentifier == SectionIdentifierFooter ? YES : NO; |
631 } | 632 } |
632 | 633 |
633 @end | 634 @end |
OLD | NEW |