| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import "ios/chrome/browser/ui/payments/address_edit_view_controller.h" | |
| 6 | |
| 7 #include "components/strings/grit/components_strings.h" | |
| 8 #import "ios/chrome/browser/ui/payments/payment_request_edit_view_controller+int
ernal.h" | |
| 9 #import "ios/chrome/browser/ui/payments/payment_request_editor_field.h" | |
| 10 #include "ui/base/l10n/l10n_util.h" | |
| 11 | |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 13 #error "This file requires ARC support." | |
| 14 #endif | |
| 15 | |
| 16 namespace { | |
| 17 | |
| 18 NSString* const kAddressEditCollectionViewAccessibilityID = | |
| 19 @"kAddressEditCollectionViewAccessibilityID"; | |
| 20 | |
| 21 } // namespace | |
| 22 | |
| 23 @interface AddressEditViewController () | |
| 24 | |
| 25 // The list of field definitions for the editor. | |
| 26 @property(nonatomic, weak) NSArray<EditorField*>* fields; | |
| 27 | |
| 28 @end | |
| 29 | |
| 30 @implementation AddressEditViewController | |
| 31 | |
| 32 @synthesize delegate = _delegate; | |
| 33 @synthesize fields = _fields; | |
| 34 | |
| 35 #pragma mark - Setters | |
| 36 | |
| 37 - (void)setDelegate:(id<AddressEditViewControllerDelegate>)delegate { | |
| 38 [super setDelegate:delegate]; | |
| 39 _delegate = delegate; | |
| 40 } | |
| 41 | |
| 42 #pragma mark - CollectionViewController methods | |
| 43 | |
| 44 - (void)viewDidLoad { | |
| 45 [super viewDidLoad]; | |
| 46 | |
| 47 self.collectionView.accessibilityIdentifier = | |
| 48 kAddressEditCollectionViewAccessibilityID; | |
| 49 } | |
| 50 | |
| 51 #pragma mark - PaymentRequestEditViewControllerActions methods | |
| 52 | |
| 53 - (void)onCancel { | |
| 54 [super onCancel]; | |
| 55 | |
| 56 [self.delegate addressEditViewControllerDidCancel:self]; | |
| 57 } | |
| 58 | |
| 59 - (void)onDone { | |
| 60 [super onDone]; | |
| 61 | |
| 62 if (![self validateForm]) | |
| 63 return; | |
| 64 | |
| 65 [self.delegate addressEditViewController:self | |
| 66 didFinishEditingFields:self.fields]; | |
| 67 } | |
| 68 | |
| 69 @end | |
| OLD | NEW |