Chromium Code Reviews| Index: chrome/browser/ui/views/payments/editor_view_controller.h |
| diff --git a/chrome/browser/ui/views/payments/editor_view_controller.h b/chrome/browser/ui/views/payments/editor_view_controller.h |
| index 35dfdd320f088bc4fd71677086b4e181d4b93e0e..393c0410bcf7a50c6eb0e094c94612e29044af43 100644 |
| --- a/chrome/browser/ui/views/payments/editor_view_controller.h |
| +++ b/chrome/browser/ui/views/payments/editor_view_controller.h |
| @@ -13,6 +13,7 @@ |
| #include "base/memory/ptr_util.h" |
| #include "base/strings/string16.h" |
| #include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h" |
| +#include "chrome/browser/ui/views/payments/validating_textfield.h" |
| #include "components/autofill/core/browser/field_types.h" |
| #include "ui/views/controls/button/vector_icon_button_delegate.h" |
| #include "ui/views/controls/textfield/textfield_controller.h" |
| @@ -44,7 +45,8 @@ struct EditorField { |
| // The PaymentRequestSheetController subtype for the editor screens of the |
| // Payment Request flow. |
| class EditorViewController : public PaymentRequestSheetController, |
| - public views::TextfieldController { |
| + public views::TextfieldController, |
| + public ValidatingTextfield::Delegate { |
| public: |
| // Does not take ownership of the arguments, which should outlive this object. |
| EditorViewController(PaymentRequest* request, |
| @@ -59,6 +61,18 @@ class EditorViewController : public PaymentRequestSheetController, |
| // Validates the data entered and attempts to save; returns true on success. |
| virtual bool ValidateModelAndSave() = 0; |
| + // ValidatingTextfield::Delegate implementation. |
| + bool ValidateTextfield(ValidatingTextfield* textfield) override; |
| + |
|
please use gerrit instead
2017/02/07 21:55:22
using TextFieldsMap = std::unordered_map<Validatin
Mathieu
2017/02/08 02:03:25
Done.
|
| + const std::unordered_map<ValidatingTextfield*, const EditorField>& |
| + text_fields() { |
| + return text_fields_; |
| + } |
| + |
| + protected: |
| + // PaymentRequestSheetController; |
| + std::unique_ptr<views::Button> CreatePrimaryButton() override; |
| + |
| private: |
| // PaymentRequestSheetController: |
| void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| @@ -70,14 +84,15 @@ class EditorViewController : public PaymentRequestSheetController, |
| // Creates a view for an input field to be added in the editor sheet. |field| |
| // is the field definition, which contains the label and the hint about |
| // the length of the input field. |
| - std::unique_ptr<views::View> CreateInputField(const EditorField& field, |
| - views::Textfield** text_field); |
| + std::unique_ptr<views::View> CreateInputField( |
| + const EditorField& field, |
| + ValidatingTextfield** text_field); |
| // Used to remember the association between the input field UI element and the |
| // original field definition. The Textfield* are owned by their parent view, |
|
please use gerrit instead
2017/02/07 21:55:22
ValidatingTextField
Mathieu
2017/02/08 02:03:25
Done.
|
| // this only keeps a reference that is good as long as the Textfield is |
| // visible. |
| - std::unordered_map<views::Textfield*, const EditorField> text_fields_; |
| + std::unordered_map<ValidatingTextfield*, const EditorField> text_fields_; |
|
please use gerrit instead
2017/02/07 21:55:22
Is EditorField an enum?
Mathieu
2017/02/08 02:03:25
it's a struct
|
| DISALLOW_COPY_AND_ASSIGN(EditorViewController); |
| }; |