Chromium Code Reviews| 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 #ifndef IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_EDIT_VIEW_CONTROLLER_H_ | |
| 6 #define IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_EDIT_VIEW_CONTROLLER_H_ | |
| 7 | |
| 8 #import <UIKit/UIKit.h> | |
| 9 #include <vector> | |
| 10 | |
| 11 #import "ios/chrome/browser/ui/collection_view/collection_view_controller.h" | |
| 12 | |
| 13 @class EditorField; | |
| 14 @class PaymentRequestEditViewController; | |
| 15 | |
| 16 // Delegate protocol for PaymentRequestEditViewController. | |
| 17 @protocol PaymentRequestEditViewControllerDelegate<NSObject> | |
| 18 | |
| 19 // Notifies the delegate that the user has finished editing the fields supplied | |
| 20 // to the initializer. The value property of each field reflects the submitted | |
| 21 // value. | |
| 22 - (void)paymentRequestEditViewController: | |
| 23 (PaymentRequestEditViewController*)controller | |
| 24 didFinishEditingFields:(NSArray<EditorField*>*)fields; | |
| 25 | |
| 26 // Notifies the delegate that the user has chosen to return to the previous | |
| 27 // screen. | |
| 28 - (void)paymentRequestEditViewControllerDidReturn: | |
| 29 (PaymentRequestEditViewController*)controller; | |
| 30 | |
| 31 @end | |
| 32 | |
| 33 // Validator protocol for PaymentRequestEditViewController. | |
| 34 @protocol PaymentRequestEditViewControllerValidator<NSObject> | |
| 35 | |
| 36 // Returns the validation error string for |value|. |autofillType| corresponds | |
| 37 // to autofill::ServerFieldType. |required| indicates whether this is a required | |
| 38 // field. If there are no validation errors, an empty string is returned. | |
| 39 - (NSString*)paymentRequestEditViewController: | |
| 40 (PaymentRequestEditViewController*)controller | |
| 41 validateValue:(NSString*)value | |
| 42 autofillType:(NSInteger)autofillType | |
| 43 required:(BOOL)required; | |
| 44 | |
| 45 @end | |
| 46 | |
| 47 // The collection view controller for a generic Payment Request edit screen. It | |
| 48 // features sections for every EditorField supplied to the initializer. Each | |
| 49 // section has a text field as well as an error message item which is visible | |
| 50 // wehn the value of its respective text field is invalid. | |
|
lpromero
2017/03/23 12:58:36
when
Moe
2017/03/23 15:20:43
Done.
| |
| 51 @interface PaymentRequestEditViewController : CollectionViewController | |
| 52 | |
| 53 // The delegate to be notified when the user returns or finishes editing the | |
| 54 // fields. | |
| 55 @property(nonatomic, weak) id<PaymentRequestEditViewControllerDelegate> | |
| 56 editorDelegate; | |
| 57 | |
| 58 // The delegate to be called for validating the fields. By default, this object | |
|
lpromero
2017/03/23 12:58:35
s/this object/the controller, to avoid a doubt in
Moe
2017/03/23 15:20:43
Done.
| |
| 59 // is the validator | |
|
lpromero
2017/03/23 12:58:35
Missing period
Moe
2017/03/23 15:20:43
Done.
| |
| 60 @property(nonatomic, weak) id<PaymentRequestEditViewControllerValidator> | |
| 61 validatorDelegate; | |
| 62 | |
| 63 // Initializes this instance with a list of field definitions for the editor. | |
| 64 - (instancetype)initWithEditorFields:(NSArray<EditorField*>*)fields | |
| 65 NS_DESIGNATED_INITIALIZER; | |
| 66 | |
| 67 - (instancetype)init NS_UNAVAILABLE; | |
| 68 | |
| 69 - (instancetype)initWithStyle:(CollectionViewControllerStyle)style | |
| 70 NS_UNAVAILABLE; | |
| 71 | |
| 72 @end | |
| 73 | |
| 74 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_EDIT_VIEW_CONTROLLER_H_ | |
| OLD | NEW |