Chromium Code Reviews| Index: ios/chrome/browser/ui/payments/shipping_option_selection_mediator.mm |
| diff --git a/ios/chrome/browser/ui/payments/shipping_option_selection_mediator.mm b/ios/chrome/browser/ui/payments/shipping_option_selection_mediator.mm |
| index b7d341f7bfc675d46570bb1bcc10aee205540996..a8d129e1735ed8a91f94c845aac1c7c69cf30eef 100644 |
| --- a/ios/chrome/browser/ui/payments/shipping_option_selection_mediator.mm |
| +++ b/ios/chrome/browser/ui/payments/shipping_option_selection_mediator.mm |
| @@ -27,7 +27,10 @@ |
| @property(nonatomic, assign) PaymentRequest* paymentRequest; |
| // The selectable items to display in the collection. |
| -@property(nonatomic, strong) NSArray<PaymentsTextItem*>* items; |
| +@property(nonatomic, strong) NSMutableArray<PaymentsTextItem*>* items; |
| + |
| +// Creates the selectable items to display in the collection. |
| +- (void)createItems; |
|
lpromero
2017/06/14 09:10:13
Optional nit: "loadItems" might convey a better se
Moe
2017/06/14 14:35:05
Done.
|
| @end |
| @@ -44,13 +47,17 @@ |
| if (self) { |
| _paymentRequest = paymentRequest; |
| _selectedItemIndex = NSUIntegerMax; |
| - _items = [self createItems]; |
| + [self createItems]; |
| } |
| return self; |
| } |
| #pragma mark - PaymentRequestSelectorViewControllerDataSource |
| +- (BOOL)allowsEditMode { |
| + return NO; |
| +} |
| + |
| - (CollectionViewItem*)headerItem { |
| if (!self.headerText.length) |
| return nil; |
| @@ -72,11 +79,10 @@ |
| #pragma mark - Helper methods |
| -- (NSArray<PaymentsTextItem*>*)createItems { |
| +- (void)createItems { |
| const std::vector<web::PaymentShippingOption*>& shippingOptions = |
| _paymentRequest->shipping_options(); |
| - NSMutableArray<PaymentsTextItem*>* items = |
| - [NSMutableArray arrayWithCapacity:shippingOptions.size()]; |
| + _items = [NSMutableArray arrayWithCapacity:shippingOptions.size()]; |
| for (size_t index = 0; index < shippingOptions.size(); ++index) { |
| web::PaymentShippingOption* shippingOption = shippingOptions[index]; |
| DCHECK(shippingOption); |
| @@ -89,9 +95,8 @@ |
| if (_paymentRequest->selected_shipping_option() == shippingOption) |
| _selectedItemIndex = index; |
| - [items addObject:item]; |
| + [_items addObject:item]; |
| } |
| - return items; |
| } |
| @end |