| 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/payments/payment_method_selection_view_controller.h" | 5 #import "ios/chrome/browser/payments/payment_method_selection_view_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "components/autofill/core/browser/autofill_data_util.h" | 9 #include "components/autofill/core/browser/autofill_data_util.h" |
| 10 #include "components/autofill/core/browser/credit_card.h" | 10 #include "components/autofill/core/browser/credit_card.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 #pragma mark - CollectionViewController methods | 90 #pragma mark - CollectionViewController methods |
| 91 | 91 |
| 92 - (void)loadModel { | 92 - (void)loadModel { |
| 93 [super loadModel]; | 93 [super loadModel]; |
| 94 CollectionViewModel* model = self.collectionViewModel; | 94 CollectionViewModel* model = self.collectionViewModel; |
| 95 _selectedItem = nil; | 95 _selectedItem = nil; |
| 96 | 96 |
| 97 [model addSectionWithIdentifier:SectionIdentifierPayment]; | 97 [model addSectionWithIdentifier:SectionIdentifierPayment]; |
| 98 | 98 |
| 99 for (const auto& paymentMethod : _paymentRequest->credit_cards()) { | 99 for (auto* paymentMethod : _paymentRequest->credit_cards()) { |
| 100 PaymentMethodItem* paymentMethodItem = | 100 PaymentMethodItem* paymentMethodItem = |
| 101 [[PaymentMethodItem alloc] initWithType:ItemTypePaymentMethod]; | 101 [[PaymentMethodItem alloc] initWithType:ItemTypePaymentMethod]; |
| 102 paymentMethodItem.accessibilityTraits |= UIAccessibilityTraitButton; | 102 paymentMethodItem.accessibilityTraits |= UIAccessibilityTraitButton; |
| 103 paymentMethodItem.methodID = | 103 paymentMethodItem.methodID = |
| 104 base::SysUTF16ToNSString(paymentMethod->TypeAndLastFourDigits()); | 104 base::SysUTF16ToNSString(paymentMethod->TypeAndLastFourDigits()); |
| 105 paymentMethodItem.methodDetail = base::SysUTF16ToNSString( | 105 paymentMethodItem.methodDetail = base::SysUTF16ToNSString( |
| 106 paymentMethod->GetRawInfo(autofill::CREDIT_CARD_NAME_FULL)); | 106 paymentMethod->GetRawInfo(autofill::CREDIT_CARD_NAME_FULL)); |
| 107 int methodTypeIconID = | 107 int methodTypeIconID = |
| 108 autofill::data_util::GetPaymentRequestData(paymentMethod->type()) | 108 autofill::data_util::GetPaymentRequestData(paymentMethod->type()) |
| 109 .icon_resource_id; | 109 .icon_resource_id; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 return [MDCCollectionViewCell | 190 return [MDCCollectionViewCell |
| 191 cr_preferredHeightForWidth:CGRectGetWidth(collectionView.bounds) | 191 cr_preferredHeightForWidth:CGRectGetWidth(collectionView.bounds) |
| 192 forItem:item]; | 192 forItem:item]; |
| 193 default: | 193 default: |
| 194 NOTREACHED(); | 194 NOTREACHED(); |
| 195 return MDCCellDefaultOneLineHeight; | 195 return MDCCellDefaultOneLineHeight; |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| 199 @end | 199 @end |
| OLD | NEW |