Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: ios/chrome/browser/payments/payment_method_selection_view_controller.mm

Issue 2744823003: [Payment Request] Generic edit form (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // Update the reference to the selected item. 164 // Update the reference to the selected item.
165 _selectedItem = newlySelectedItem; 165 _selectedItem = newlySelectedItem;
166 166
167 // Notify the delegate of the selection. 167 // Notify the delegate of the selection.
168 NSInteger index = [model indexInItemTypeForIndexPath:indexPath]; 168 NSInteger index = [model indexInItemTypeForIndexPath:indexPath];
169 DCHECK(index < (NSInteger)_paymentRequest->credit_cards().size()); 169 DCHECK(index < (NSInteger)_paymentRequest->credit_cards().size());
170 [_delegate 170 [_delegate
171 paymentMethodSelectionViewController:self 171 paymentMethodSelectionViewController:self
172 didSelectPaymentMethod:_paymentRequest 172 didSelectPaymentMethod:_paymentRequest
173 ->credit_cards()[index]]; 173 ->credit_cards()[index]];
174 } else if (item.type == ItemTypeAddMethod) {
175 [_delegate paymentMethodSelectionViewControllerDidSelectAddCard:self];
174 } 176 }
175 // TODO(crbug.com/602666): Present a credit card addition UI when
176 // itemType == ItemTypeAddMethod.
177 } 177 }
178 178
179 #pragma mark MDCCollectionViewStylingDelegate 179 #pragma mark MDCCollectionViewStylingDelegate
180 180
181 - (CGFloat)collectionView:(UICollectionView*)collectionView 181 - (CGFloat)collectionView:(UICollectionView*)collectionView
182 cellHeightAtIndexPath:(NSIndexPath*)indexPath { 182 cellHeightAtIndexPath:(NSIndexPath*)indexPath {
183 CollectionViewItem* item = 183 CollectionViewItem* item =
184 [self.collectionViewModel itemAtIndexPath:indexPath]; 184 [self.collectionViewModel itemAtIndexPath:indexPath];
185 switch (item.type) { 185 switch (item.type) {
186 case ItemTypePaymentMethod: 186 case ItemTypePaymentMethod:
187 return MDCCellDefaultTwoLineHeight; 187 return MDCCellDefaultTwoLineHeight;
188 case ItemTypeAddMethod: 188 case ItemTypeAddMethod:
189 return [MDCCollectionViewCell 189 return [MDCCollectionViewCell
190 cr_preferredHeightForWidth:CGRectGetWidth(collectionView.bounds) 190 cr_preferredHeightForWidth:CGRectGetWidth(collectionView.bounds)
191 forItem:item]; 191 forItem:item];
192 default: 192 default:
193 NOTREACHED(); 193 NOTREACHED();
194 return MDCCellDefaultOneLineHeight; 194 return MDCCellDefaultOneLineHeight;
195 } 195 }
196 } 196 }
197 197
198 @end 198 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698