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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 messageItem.text = _errorMessage; | 121 messageItem.text = _errorMessage; |
122 messageItem.image = NativeImage(IDR_IOS_PAYMENTS_WARNING); | 122 messageItem.image = NativeImage(IDR_IOS_PAYMENTS_WARNING); |
123 } else { | 123 } else { |
124 messageItem.text = | 124 messageItem.text = |
125 payment_request_util::GetShippingAddressSelectorInfoMessage( | 125 payment_request_util::GetShippingAddressSelectorInfoMessage( |
126 _paymentRequest); | 126 _paymentRequest); |
127 } | 127 } |
128 [model addItem:messageItem | 128 [model addItem:messageItem |
129 toSectionWithIdentifier:SectionIdentifierShippingAddress]; | 129 toSectionWithIdentifier:SectionIdentifierShippingAddress]; |
130 | 130 |
131 for (const auto& shippingAddress : _paymentRequest->shipping_profiles()) { | 131 for (auto* shippingAddress : _paymentRequest->shipping_profiles()) { |
132 AutofillProfileItem* item = | 132 AutofillProfileItem* item = |
133 [[AutofillProfileItem alloc] initWithType:ItemTypeShippingAddress]; | 133 [[AutofillProfileItem alloc] initWithType:ItemTypeShippingAddress]; |
134 item.accessibilityTraits |= UIAccessibilityTraitButton; | 134 item.accessibilityTraits |= UIAccessibilityTraitButton; |
135 item.name = GetNameLabelFromAutofillProfile(shippingAddress); | 135 item.name = GetNameLabelFromAutofillProfile(shippingAddress); |
136 item.address = GetAddressLabelFromAutofillProfile(shippingAddress); | 136 item.address = GetAddressLabelFromAutofillProfile(shippingAddress); |
137 item.phoneNumber = GetPhoneNumberLabelFromAutofillProfile(shippingAddress); | 137 item.phoneNumber = GetPhoneNumberLabelFromAutofillProfile(shippingAddress); |
138 if (_paymentRequest->selected_shipping_profile() == shippingAddress) { | 138 if (_paymentRequest->selected_shipping_profile() == shippingAddress) { |
139 item.accessoryType = MDCCollectionViewCellAccessoryCheckmark; | 139 item.accessoryType = MDCCollectionViewCellAccessoryCheckmark; |
140 _selectedItem = item; | 140 _selectedItem = item; |
141 } | 141 } |
(...skipping 113 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 |