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..9e6df40f46669d3f9053f7041325c62a2a28eb3e 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,8 +45,11 @@ 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: |
+ using TextFieldsMap = |
+ std::unordered_map<ValidatingTextfield*, const EditorField>; |
please use gerrit instead
2017/02/08 18:50:54
This might make copies of EditorField. I'd prefer
Mathieu
2017/02/08 21:21:50
Discussed offline, EditorField is cheap and copies
|
// Does not take ownership of the arguments, which should outlive this object. |
EditorViewController(PaymentRequest* request, |
PaymentRequestDialogView* dialog); |
@@ -59,6 +63,15 @@ class EditorViewController : public PaymentRequestSheetController, |
// Validates the data entered and attempts to save; returns true on success. |
virtual bool ValidateModelAndSave() = 0; |
+ // ValidatingTextfield::Delegate implementation. |
anthonyvd
2017/02/08 15:28:28
For consistency, maybe just "// ValidatingTextfiel
Mathieu
2017/02/08 21:21:50
Done.
|
+ bool ValidateTextfield(ValidatingTextfield* textfield) override; |
+ |
+ const TextFieldsMap& text_fields() { return text_fields_; } |
please use gerrit instead
2017/02/08 18:50:54
Make this method const please.
Mathieu
2017/02/08 21:21:50
Done.
|
+ |
+ protected: |
+ // PaymentRequestSheetController; |
+ std::unique_ptr<views::Button> CreatePrimaryButton() override; |
+ |
private: |
// PaymentRequestSheetController: |
void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
@@ -70,14 +83,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, |
- // this only keeps a reference that is good as long as the Textfield is |
- // visible. |
- std::unordered_map<views::Textfield*, const EditorField> text_fields_; |
+ // original field definition. The ValidatingTextfield* are owned by their |
+ // parent view, this only keeps a reference that is good as long as the |
+ // textfield is visible. |
+ TextFieldsMap text_fields_; |
DISALLOW_COPY_AND_ASSIGN(EditorViewController); |
}; |