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

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

Issue 2895473005: [Payments] Have expiration date be on the same line in CC editor (Closed)
Patch Set: addressed comments Created 3 years, 7 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/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 60e229c09fda672f524ec42b19d816fb628b4f12..9cc40813f80a45c3fbd7379e99439893c9338099 100644
--- a/chrome/browser/ui/views/payments/editor_view_controller.h
+++ b/chrome/browser/ui/views/payments/editor_view_controller.h
@@ -57,12 +57,6 @@ struct EditorField {
required(required),
control_type(control_type) {}
- struct Compare {
- bool operator()(const EditorField& lhs, const EditorField& rhs) const {
- return std::tie(lhs.type, lhs.label) < std::tie(rhs.type, rhs.label);
- }
- };
-
// Data type in the field.
autofill::ServerFieldType type;
// Label to be shown alongside the field.
@@ -85,8 +79,7 @@ class EditorViewController : public PaymentRequestSheetController,
std::unordered_map<ValidatingTextfield*, const EditorField>;
using ComboboxMap =
std::unordered_map<ValidatingCombobox*, const EditorField>;
- using ErrorLabelMap =
- std::map<const EditorField, views::View*, EditorField::Compare>;
+ using ErrorLabelMap = std::map<autofill::ServerFieldType, views::View*>;
// Does not take ownership of the arguments, which should outlive this object.
// |back_navigation_type| identifies what sort of back navigation should be
@@ -99,13 +92,16 @@ class EditorViewController : public PaymentRequestSheetController,
~EditorViewController() override;
// Will display |error_message| alongside the input field represented by
- // |field|.
- void DisplayErrorMessageForField(const EditorField& field,
+ // field |type|.
+ void DisplayErrorMessageForField(autofill::ServerFieldType type,
const base::string16& error_message);
const ComboboxMap& comboboxes() const { return comboboxes_; }
const TextFieldsMap& text_fields() const { return text_fields_; }
+ // Returns the View ID that can be used to lookup the input field for |type|.
+ static int GetInputFieldViewId(autofill::ServerFieldType type);
+
protected:
// Create a header view to be inserted before all fields.
virtual std::unique_ptr<views::View> CreateHeaderView();
@@ -147,6 +143,11 @@ class EditorViewController : public PaymentRequestSheetController,
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
views::View* GetFirstFocusedView() override;
+ // Will create a combobox according to the |field| definition. Will also keep
+ // track of this field to populate the edited model on save.
+ std::unique_ptr<ValidatingCombobox> CreateComboboxForField(
+ const EditorField& field);
+
private:
// views::TextfieldController:
void ContentsChanged(views::Textfield* sender,

Powered by Google App Engine
This is Rietveld 408576698