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 | 8 |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "components/autofill/core/browser/autofill_profile.h" | 10 #include "components/autofill/core/browser/autofill_profile.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 messageItem.text = _errorMessage; | 120 messageItem.text = _errorMessage; |
121 messageItem.image = NativeImage(IDR_IOS_PAYMENTS_WARNING); | 121 messageItem.image = NativeImage(IDR_IOS_PAYMENTS_WARNING); |
122 } else { | 122 } else { |
123 messageItem.text = | 123 messageItem.text = |
124 payment_request_util::GetShippingAddressSelectorInfoMessage( | 124 payment_request_util::GetShippingAddressSelectorInfoMessage( |
125 _paymentRequest); | 125 _paymentRequest); |
126 } | 126 } |
127 [model addItem:messageItem | 127 [model addItem:messageItem |
128 toSectionWithIdentifier:SectionIdentifierShippingAddress]; | 128 toSectionWithIdentifier:SectionIdentifierShippingAddress]; |
129 | 129 |
130 for (const auto& shippingAddress : _paymentRequest->shipping_profiles()) { | 130 for (auto* shippingAddress : _paymentRequest->shipping_profiles()) { |
131 ShippingAddressItem* item = | 131 ShippingAddressItem* item = |
132 [[ShippingAddressItem alloc] initWithType:ItemTypeShippingAddress]; | 132 [[ShippingAddressItem alloc] initWithType:ItemTypeShippingAddress]; |
133 item.accessibilityTraits |= UIAccessibilityTraitButton; | 133 item.accessibilityTraits |= UIAccessibilityTraitButton; |
134 item.name = NameLabelFromAutofillProfile(shippingAddress); | 134 item.name = NameLabelFromAutofillProfile(shippingAddress); |
135 item.address = AddressLabelFromAutofillProfile(shippingAddress); | 135 item.address = AddressLabelFromAutofillProfile(shippingAddress); |
136 item.phoneNumber = PhoneNumberLabelFromAutofillProfile(shippingAddress); | 136 item.phoneNumber = PhoneNumberLabelFromAutofillProfile(shippingAddress); |
137 if (_paymentRequest->selected_shipping_profile() == shippingAddress) { | 137 if (_paymentRequest->selected_shipping_profile() == shippingAddress) { |
138 item.accessoryType = MDCCollectionViewCellAccessoryCheckmark; | 138 item.accessoryType = MDCCollectionViewCellAccessoryCheckmark; |
139 _selectedItem = item; | 139 _selectedItem = item; |
140 } | 140 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 hidesInkViewAtIndexPath:(NSIndexPath*)indexPath { | 255 hidesInkViewAtIndexPath:(NSIndexPath*)indexPath { |
256 NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath]; | 256 NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath]; |
257 if (type == ItemTypeMessage) { | 257 if (type == ItemTypeMessage) { |
258 return YES; | 258 return YES; |
259 } else { | 259 } else { |
260 return NO; | 260 return NO; |
261 } | 261 } |
262 } | 262 } |
263 | 263 |
264 @end | 264 @end |
OLD | NEW |