Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: ios/chrome/browser/payments/shipping_address_selection_view_controller.mm

Issue 2744823003: [Payment Request] Generic edit form (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 14 matching lines...) Expand all
25 #include "ios/chrome/grit/ios_strings.h" 25 #include "ios/chrome/grit/ios_strings.h"
26 #include "ios/chrome/grit/ios_theme_resources.h" 26 #include "ios/chrome/grit/ios_theme_resources.h"
27 #include "ui/base/l10n/l10n_util.h" 27 #include "ui/base/l10n/l10n_util.h"
28 28
29 #if !defined(__has_feature) || !__has_feature(objc_arc) 29 #if !defined(__has_feature) || !__has_feature(objc_arc)
30 #error "This file requires ARC support." 30 #error "This file requires ARC support."
31 #endif 31 #endif
32 32
33 namespace { 33 namespace {
34 using ::payment_request_util::GetNameLabelFromAutofillProfile; 34 using ::payment_request_util::GetNameLabelFromAutofillProfile;
35 using ::payment_request_util::GetAddressLabelFromAutofillProfile; 35 using ::payment_request_util::GetShippingAddressLabelFromAutofillProfile;
36 using ::payment_request_util::GetPhoneNumberLabelFromAutofillProfile; 36 using ::payment_request_util::GetPhoneNumberLabelFromAutofillProfile;
37 using ::payment_request_util::GetShippingAddressSelectorTitle; 37 using ::payment_request_util::GetShippingAddressSelectorTitle;
38 using ::payment_request_util::GetShippingAddressSelectorInfoMessage; 38 using ::payment_request_util::GetShippingAddressSelectorInfoMessage;
39 39
40 NSString* const kShippingAddressSelectionCollectionViewID = 40 NSString* const kShippingAddressSelectionCollectionViewID =
41 @"kShippingAddressSelectionCollectionViewID"; 41 @"kShippingAddressSelectionCollectionViewID";
42 42
43 const CGFloat kSeparatorEdgeInset = 14; 43 const CGFloat kSeparatorEdgeInset = 14;
44 44
45 typedef NS_ENUM(NSInteger, SectionIdentifier) { 45 typedef NS_ENUM(NSInteger, SectionIdentifier) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 123 }
124 [model addItem:messageItem 124 [model addItem:messageItem
125 toSectionWithIdentifier:SectionIdentifierShippingAddress]; 125 toSectionWithIdentifier:SectionIdentifierShippingAddress];
126 126
127 for (auto* shippingAddress : _paymentRequest->shipping_profiles()) { 127 for (auto* shippingAddress : _paymentRequest->shipping_profiles()) {
128 DCHECK(shippingAddress); 128 DCHECK(shippingAddress);
129 AutofillProfileItem* item = 129 AutofillProfileItem* item =
130 [[AutofillProfileItem alloc] initWithType:ItemTypeShippingAddress]; 130 [[AutofillProfileItem alloc] initWithType:ItemTypeShippingAddress];
131 item.accessibilityTraits |= UIAccessibilityTraitButton; 131 item.accessibilityTraits |= UIAccessibilityTraitButton;
132 item.name = GetNameLabelFromAutofillProfile(*shippingAddress); 132 item.name = GetNameLabelFromAutofillProfile(*shippingAddress);
133 item.address = GetAddressLabelFromAutofillProfile(*shippingAddress); 133 item.address = GetShippingAddressLabelFromAutofillProfile(*shippingAddress);
134 item.phoneNumber = GetPhoneNumberLabelFromAutofillProfile(*shippingAddress); 134 item.phoneNumber = GetPhoneNumberLabelFromAutofillProfile(*shippingAddress);
135 if (_paymentRequest->selected_shipping_profile() == shippingAddress) { 135 if (_paymentRequest->selected_shipping_profile() == shippingAddress) {
136 item.accessoryType = MDCCollectionViewCellAccessoryCheckmark; 136 item.accessoryType = MDCCollectionViewCellAccessoryCheckmark;
137 _selectedItem = item; 137 _selectedItem = item;
138 } 138 }
139 [model addItem:item 139 [model addItem:item
140 toSectionWithIdentifier:SectionIdentifierShippingAddress]; 140 toSectionWithIdentifier:SectionIdentifierShippingAddress];
141 } 141 }
142 142
143 PaymentsTextItem* addShippingAddress = 143 PaymentsTextItem* addShippingAddress =
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 hidesInkViewAtIndexPath:(NSIndexPath*)indexPath { 252 hidesInkViewAtIndexPath:(NSIndexPath*)indexPath {
253 NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath]; 253 NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath];
254 if (type == ItemTypeMessage) { 254 if (type == ItemTypeMessage) {
255 return YES; 255 return YES;
256 } else { 256 } else {
257 return NO; 257 return NO;
258 } 258 }
259 } 259 }
260 260
261 @end 261 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698