| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/shipping_option_selection_view_controller.h
" | 5 #import "ios/chrome/browser/payments/shipping_option_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 "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "components/payments/currency_formatter.h" | 10 #include "components/payments/currency_formatter.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 CollectionViewTextItem* _selectedItem; | 60 CollectionViewTextItem* _selectedItem; |
| 61 } | 61 } |
| 62 | 62 |
| 63 // Called when the user presses the return button. | 63 // Called when the user presses the return button. |
| 64 - (void)onReturn; | 64 - (void)onReturn; |
| 65 | 65 |
| 66 @end | 66 @end |
| 67 | 67 |
| 68 @implementation ShippingOptionSelectionViewController | 68 @implementation ShippingOptionSelectionViewController |
| 69 | 69 |
| 70 @synthesize isLoading = _isLoading; | 70 @synthesize pending = _pending; |
| 71 @synthesize errorMessage = _errorMessage; | 71 @synthesize errorMessage = _errorMessage; |
| 72 | 72 |
| 73 - (instancetype)initWithPaymentRequest:(PaymentRequest*)paymentRequest { | 73 - (instancetype)initWithPaymentRequest:(PaymentRequest*)paymentRequest { |
| 74 DCHECK(paymentRequest); | 74 DCHECK(paymentRequest); |
| 75 if ((self = [super initWithStyle:CollectionViewControllerStyleAppBar])) { | 75 if ((self = [super initWithStyle:CollectionViewControllerStyleAppBar])) { |
| 76 self.title = | 76 self.title = |
| 77 payment_request_util::GetShippingOptionSelectorTitle(paymentRequest); | 77 payment_request_util::GetShippingOptionSelectorTitle(paymentRequest); |
| 78 | 78 |
| 79 UIBarButtonItem* returnButton = | 79 UIBarButtonItem* returnButton = |
| 80 [ChromeIcon templateBarButtonItemWithImage:[ChromeIcon backIcon] | 80 [ChromeIcon templateBarButtonItemWithImage:[ChromeIcon backIcon] |
| (...skipping 22 matching lines...) Expand all Loading... |
| 103 | 103 |
| 104 #pragma mark - CollectionViewController methods | 104 #pragma mark - CollectionViewController methods |
| 105 | 105 |
| 106 - (void)loadModel { | 106 - (void)loadModel { |
| 107 [super loadModel]; | 107 [super loadModel]; |
| 108 CollectionViewModel* model = self.collectionViewModel; | 108 CollectionViewModel* model = self.collectionViewModel; |
| 109 _selectedItem = nil; | 109 _selectedItem = nil; |
| 110 | 110 |
| 111 [model addSectionWithIdentifier:SectionIdentifierShippingOption]; | 111 [model addSectionWithIdentifier:SectionIdentifierShippingOption]; |
| 112 | 112 |
| 113 if (self.isLoading) { | 113 if (self.pending) { |
| 114 StatusItem* statusItem = [[StatusItem alloc] initWithType:ItemTypeSpinner]; | 114 StatusItem* statusItem = [[StatusItem alloc] initWithType:ItemTypeSpinner]; |
| 115 statusItem.text = | 115 statusItem.text = |
| 116 l10n_util::GetNSString(IDS_IOS_PAYMENT_REQUEST_CHECKING_LABEL); | 116 l10n_util::GetNSString(IDS_IOS_PAYMENT_REQUEST_CHECKING_LABEL); |
| 117 [model addItem:statusItem | 117 [model addItem:statusItem |
| 118 toSectionWithIdentifier:SectionIdentifierShippingOption]; | 118 toSectionWithIdentifier:SectionIdentifierShippingOption]; |
| 119 return; | 119 return; |
| 120 } | 120 } |
| 121 | 121 |
| 122 if (_errorMessage) { | 122 if (_errorMessage) { |
| 123 PaymentsTextItem* messageItem = | 123 PaymentsTextItem* messageItem = |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 hidesInkViewAtIndexPath:(NSIndexPath*)indexPath { | 247 hidesInkViewAtIndexPath:(NSIndexPath*)indexPath { |
| 248 NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath]; | 248 NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath]; |
| 249 if (type == ItemTypeMessage) { | 249 if (type == ItemTypeMessage) { |
| 250 return YES; | 250 return YES; |
| 251 } else { | 251 } else { |
| 252 return NO; | 252 return NO; |
| 253 } | 253 } |
| 254 } | 254 } |
| 255 | 255 |
| 256 @end | 256 @end |
| OLD | NEW |