| 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 #include "components/autofill/core/browser/field_types.h" |
| 12 #import "ios/chrome/browser/ui/collection_view/collection_view_controller.h" |
| 13 |
| 14 // Field definition for an editor field. Used for building the UI and |
| 15 // validation. |
| 16 struct EditorField { |
| 17 EditorField(autofill::ServerFieldType data_type, |
| 18 const base::string16& label, |
| 19 bool required, |
| 20 int item_type, |
| 21 int section_id) |
| 22 : data_type(data_type), |
| 23 label(label), |
| 24 required(required), |
| 25 item_type(item_type), |
| 26 section_id(section_id) {} |
| 27 |
| 28 // Data type for the field. |
| 29 const autofill::ServerFieldType data_type; |
| 30 // Label for the field. |
| 31 const base::string16 label; |
| 32 // Whether the field is required. |
| 33 bool required; |
| 34 // Item type for the field. |
| 35 int item_type; |
| 36 // Section identifier for the field. |
| 37 int section_id; |
| 38 }; |
| 39 |
| 40 // The collection view controller for a generic Payment Request edit screen. It |
| 41 // features sections for every EditorField returned by -editorFields. Each |
| 42 // section has a text field as well as an optional error message item. |
| 43 @interface PaymentRequestEditViewController |
| 44 : CollectionViewController<UITextFieldDelegate> |
| 45 |
| 46 // Subclasses override this method to return a list of field definitions for the |
| 47 // editor. |
| 48 - (std::vector<EditorField>)editorFields; |
| 49 |
| 50 - (instancetype)init NS_DESIGNATED_INITIALIZER; |
| 51 |
| 52 - (instancetype)initWithStyle:(CollectionViewControllerStyle)style |
| 53 NS_UNAVAILABLE; |
| 54 |
| 55 @end |
| 56 |
| 57 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_EDIT_VIEW_CONTROLLER_H_ |
| OLD | NEW |