| 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/shipping_address_selection_view_controller.
h" | 5 #import "ios/chrome/browser/payments/shipping_address_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_profile.h" | 9 #include "components/autofill/core/browser/autofill_profile.h" |
| 10 #include "components/strings/grit/components_strings.h" | 10 #include "components/strings/grit/components_strings.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 __weak ShippingAddressItem* _selectedItem; | 62 __weak ShippingAddressItem* _selectedItem; |
| 63 } | 63 } |
| 64 | 64 |
| 65 // Called when the user presses the return button. | 65 // Called when the user presses the return button. |
| 66 - (void)onReturn; | 66 - (void)onReturn; |
| 67 | 67 |
| 68 @end | 68 @end |
| 69 | 69 |
| 70 @implementation ShippingAddressSelectionViewController | 70 @implementation ShippingAddressSelectionViewController |
| 71 | 71 |
| 72 @synthesize isLoading = _isLoading; | 72 @synthesize pending = _pending; |
| 73 @synthesize errorMessage = _errorMessage; | 73 @synthesize errorMessage = _errorMessage; |
| 74 @synthesize delegate = _delegate; | 74 @synthesize delegate = _delegate; |
| 75 | 75 |
| 76 - (instancetype)initWithPaymentRequest:(PaymentRequest*)paymentRequest { | 76 - (instancetype)initWithPaymentRequest:(PaymentRequest*)paymentRequest { |
| 77 DCHECK(paymentRequest); | 77 DCHECK(paymentRequest); |
| 78 if ((self = [super initWithStyle:CollectionViewControllerStyleAppBar])) { | 78 if ((self = [super initWithStyle:CollectionViewControllerStyleAppBar])) { |
| 79 self.title = | 79 self.title = |
| 80 payment_request_util::GetShippingAddressSelectorTitle(paymentRequest); | 80 payment_request_util::GetShippingAddressSelectorTitle(paymentRequest); |
| 81 | 81 |
| 82 UIBarButtonItem* returnButton = | 82 UIBarButtonItem* returnButton = |
| (...skipping 14 matching lines...) Expand all Loading... |
| 97 | 97 |
| 98 #pragma mark - CollectionViewController methods | 98 #pragma mark - CollectionViewController methods |
| 99 | 99 |
| 100 - (void)loadModel { | 100 - (void)loadModel { |
| 101 [super loadModel]; | 101 [super loadModel]; |
| 102 CollectionViewModel* model = self.collectionViewModel; | 102 CollectionViewModel* model = self.collectionViewModel; |
| 103 _selectedItem = nil; | 103 _selectedItem = nil; |
| 104 | 104 |
| 105 [model addSectionWithIdentifier:SectionIdentifierShippingAddress]; | 105 [model addSectionWithIdentifier:SectionIdentifierShippingAddress]; |
| 106 | 106 |
| 107 if (_isLoading) { | 107 if (_pending) { |
| 108 StatusItem* statusItem = [[StatusItem alloc] initWithType:ItemTypeSpinner]; | 108 StatusItem* statusItem = [[StatusItem alloc] initWithType:ItemTypeSpinner]; |
| 109 statusItem.text = | 109 statusItem.text = |
| 110 l10n_util::GetNSString(IDS_IOS_PAYMENT_REQUEST_CHECKING_LABEL); | 110 l10n_util::GetNSString(IDS_IOS_PAYMENT_REQUEST_CHECKING_LABEL); |
| 111 [model addItem:statusItem | 111 [model addItem:statusItem |
| 112 toSectionWithIdentifier:SectionIdentifierShippingAddress]; | 112 toSectionWithIdentifier:SectionIdentifierShippingAddress]; |
| 113 return; | 113 return; |
| 114 } | 114 } |
| 115 | 115 |
| 116 PaymentsTextItem* messageItem = | 116 PaymentsTextItem* messageItem = |
| 117 [[PaymentsTextItem alloc] initWithType:ItemTypeMessage]; | 117 [[PaymentsTextItem alloc] initWithType:ItemTypeMessage]; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 hidesInkViewAtIndexPath:(NSIndexPath*)indexPath { | 254 hidesInkViewAtIndexPath:(NSIndexPath*)indexPath { |
| 255 NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath]; | 255 NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath]; |
| 256 if (type == ItemTypeMessage) { | 256 if (type == ItemTypeMessage) { |
| 257 return YES; | 257 return YES; |
| 258 } else { | 258 } else { |
| 259 return NO; | 259 return NO; |
| 260 } | 260 } |
| 261 } | 261 } |
| 262 | 262 |
| 263 @end | 263 @end |
| OLD | NEW |