Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Unified Diff: chrome/browser/ui/views/payments/credit_card_editor_view_controller.h

Issue 2689363004: [Payments] Add combobox support to editors. (Closed)
Patch Set: Initial Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/payments/credit_card_editor_view_controller.h
diff --git a/chrome/browser/ui/views/payments/credit_card_editor_view_controller.h b/chrome/browser/ui/views/payments/credit_card_editor_view_controller.h
index 15e07fc6eef20bce22e62b52e261eff10e3688c6..648dab5e90a1c1e81a3d8d074c9ba12c4e05097f 100644
--- a/chrome/browser/ui/views/payments/credit_card_editor_view_controller.h
+++ b/chrome/browser/ui/views/payments/credit_card_editor_view_controller.h
@@ -7,7 +7,8 @@
#include "base/macros.h"
#include "chrome/browser/ui/views/payments/editor_view_controller.h"
-#include "chrome/browser/ui/views/payments/validating_textfield.h"
+#include "chrome/browser/ui/views/payments/validation_delegate.h"
+#include "ui/base/models/simple_combobox_model.h"
namespace payments {
@@ -25,24 +26,33 @@ class CreditCardEditorViewController : public EditorViewController {
// EditorViewController:
std::vector<EditorField> GetFieldDefinitions() override;
bool ValidateModelAndSave() override;
- std::unique_ptr<ValidatingTextfield::Delegate> CreateValidationDelegate(
+ std::unique_ptr<ValidationDelegate> CreateValidationDelegate(
const EditorField& field) override;
+ ui::ComboboxModel* GetComboboxModelForType(
+ const autofill::ServerFieldType& type) override;
private:
- class ValidationDelegate : public ValidatingTextfield::Delegate {
+ class CreditCardValidationDelegate : public ValidationDelegate {
public:
- explicit ValidationDelegate(const EditorField& field);
- ~ValidationDelegate() override;
+ explicit CreditCardValidationDelegate(const EditorField& field);
+ ~CreditCardValidationDelegate() override;
- // ValidatingTextfield::Delegate:
+ // ValidationDelegate:
bool ValidateTextfield(views::Textfield* textfield) override;
+ bool ValidateCombobox(views::Combobox* combobox) override;
private:
+ // Validates a specific |value|.
+ bool ValidateValue(const base::string16& value);
+
EditorField field_;
- DISALLOW_COPY_AND_ASSIGN(ValidationDelegate);
+ DISALLOW_COPY_AND_ASSIGN(CreditCardValidationDelegate);
};
+ std::unique_ptr<ui::SimpleComboboxModel> exp_month_model_;
Mathieu 2017/02/14 21:23:54 Under the current code, it's problematic to have t
sky 2017/02/14 23:19:24 Indeed. You'll have to tie the lifetime of the mod
Mathieu 2017/02/15 03:15:57 I've picked the last option, as I think that for m
+ std::unique_ptr<ui::SimpleComboboxModel> exp_year_model_;
+
DISALLOW_COPY_AND_ASSIGN(CreditCardEditorViewController);
};

Powered by Google App Engine
This is Rietveld 408576698