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 #include "components/autofill/core/browser/field_types.h" | |
| 12 #import "ios/chrome/browser/ui/collection_view/collection_view_controller.h" | |
| 13 | |
| 14 // Item type for the error message item. This value is chosen to avoid | |
| 15 // overlapping with the values starting from kItemTypeEnumZero. This is a | |
| 16 // repeated item type. | |
| 17 const NSInteger ItemTypeErrorMessage = kItemTypeEnumZero + 100; | |
|
lpromero
2017/03/16 13:01:06
Did you mean to add this to the implementation fil
Moe
2017/03/16 15:44:22
Done.
| |
| 18 | |
| 19 // Field definition for an editor field. Used for building the UI and | |
|
lpromero
2017/03/16 13:01:06
s/an/a
Moe
2017/03/16 15:44:22
It should be "an editor...", right?
lpromero
2017/03/16 16:08:08
0_0 Why did I made this comment?
| |
| 20 // validation. | |
| 21 struct EditorField { | |
| 22 EditorField(autofill::ServerFieldType data_type, | |
| 23 const base::string16& label, | |
| 24 bool required, | |
| 25 int item_type, | |
| 26 int section_id) | |
| 27 : data_type(data_type), | |
| 28 label(label), | |
| 29 required(required), | |
| 30 item_type(item_type), | |
| 31 section_id(section_id) {} | |
| 32 | |
| 33 // Data type for the field. | |
| 34 const autofill::ServerFieldType data_type; | |
| 35 // Label for the field. | |
| 36 const base::string16 label; | |
| 37 // Whether the field is required. | |
| 38 bool required; | |
| 39 // Item type for the field. | |
| 40 int item_type; | |
| 41 // Section identifier for the field. | |
| 42 int section_id; | |
| 43 }; | |
| 44 | |
| 45 // The collection view controller for a generic Payment Request edit screen. It | |
| 46 // Features sections for every EditorField returned by -editorFields. Each | |
|
lpromero
2017/03/16 13:01:06
Nit: s/Features/features
Moe
2017/03/16 15:44:22
Done.
| |
| 47 // section has a text field as well as an optional error message item. | |
| 48 @interface PaymentRequestEditViewController | |
| 49 : CollectionViewController<UITextFieldDelegate> | |
| 50 | |
| 51 // Subclasses override this method to returns a list of field definitions for | |
|
lpromero
2017/03/16 13:01:06
s/returns/return
lpromero
2017/03/16 13:01:06
Is there an alternative to subclassing this contro
Moe
2017/03/16 15:44:22
Done.
Moe
2017/03/16 15:44:22
I can definitely pass those as a property, but unf
| |
| 52 // the editor. | |
| 53 - (std::vector<EditorField>)editorFields; | |
| 54 | |
| 55 - (instancetype)init NS_DESIGNATED_INITIALIZER; | |
| 56 | |
| 57 - (instancetype)initWithStyle:(CollectionViewControllerStyle)style | |
| 58 NS_UNAVAILABLE; | |
| 59 | |
| 60 @end | |
| 61 | |
| 62 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_EDIT_VIEW_CONTROLLER_H_ | |
| OLD | NEW |