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 CHROME_BROWSER_UI_VIEWS_PAYMENTS_CONTACT_INFO_EDITOR_VIEW_CONTROLLER_H_ | |
| 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_CONTACT_INFO_EDITOR_VIEW_CONTROLLER_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "base/strings/string16.h" | |
| 13 #include "chrome/browser/ui/views/payments/editor_view_controller.h" | |
| 14 #include "chrome/browser/ui/views/payments/validation_delegate.h" | |
| 15 #include "ui/base/models/simple_combobox_model.h" | |
|
Mathieu
2017/04/17 02:50:10
does it work without this line? normally editor_vi
tmartino
2017/04/18 19:39:17
We do need it in the .cc, but editor_view_controll
| |
| 16 | |
| 17 namespace autofill { | |
| 18 class AutofillProfile; | |
| 19 } | |
|
Mathieu
2017/04/17 02:50:09
} // namespace autofill
tmartino
2017/04/18 19:39:17
Done
| |
| 20 | |
| 21 namespace payments { | |
| 22 | |
| 23 class ContactInfoEditorViewController : public EditorViewController { | |
| 24 public: | |
| 25 // Does not take ownership of the arguments, which should outlive this object. | |
|
Mathieu
2017/04/17 02:50:09
Mention that |profile| can be nullptr but not the
tmartino
2017/04/18 19:39:17
Done
| |
| 26 ContactInfoEditorViewController(PaymentRequestSpec* spec, | |
| 27 PaymentRequestState* state, | |
| 28 PaymentRequestDialogView* dialog, | |
| 29 autofill::AutofillProfile* profile); | |
| 30 ~ContactInfoEditorViewController() override; | |
| 31 | |
| 32 // EditorViewController: | |
| 33 std::unique_ptr<views::View> CreateHeaderView() override; | |
| 34 std::vector<EditorField> GetFieldDefinitions() override; | |
| 35 base::string16 GetInitialValueForType( | |
| 36 autofill::ServerFieldType type) override; | |
| 37 bool ValidateModelAndSave() override; | |
| 38 std::unique_ptr<ValidationDelegate> CreateValidationDelegate( | |
| 39 const EditorField& field) override; | |
| 40 std::unique_ptr<ui::ComboboxModel> GetComboboxModelForType( | |
| 41 const autofill::ServerFieldType& type) override; | |
| 42 | |
| 43 protected: | |
| 44 // PaymentRequestSheetController: | |
| 45 base::string16 GetSheetTitle() override; | |
| 46 | |
| 47 private: | |
| 48 bool ValidateModel(); | |
| 49 void PopulateProfile(autofill::AutofillProfile* profile); | |
|
Mathieu
2017/04/17 02:50:09
A comment would be good to explain populating what
tmartino
2017/04/18 19:39:17
Done
| |
| 50 | |
| 51 autofill::AutofillProfile* profile_to_edit_; | |
| 52 | |
| 53 class ContactInfoValidationDelegate : public ValidationDelegate { | |
| 54 public: | |
| 55 ContactInfoValidationDelegate(const EditorField& field, | |
| 56 const std::string& locale, | |
| 57 EditorViewController* controller); | |
| 58 ~ContactInfoValidationDelegate() override; | |
| 59 | |
| 60 // ValidationDelegate: | |
| 61 bool ValidateTextfield(views::Textfield* textfield) override; | |
| 62 bool ValidateCombobox(views::Combobox* combobox) override; | |
| 63 void ComboboxModelChanged(views::Combobox* combobox) override {} | |
| 64 | |
| 65 private: | |
| 66 EditorField field_; | |
| 67 EditorViewController* controller_; | |
|
Mathieu
2017/04/17 02:50:09
outlives this class, never null, etc.
tmartino
2017/04/18 19:39:17
Done
| |
| 68 std::string locale_; | |
|
Mathieu
2017/04/17 02:50:10
can keep const std::string& to avoid the copy
tmartino
2017/04/18 19:39:17
Done
| |
| 69 }; | |
| 70 }; | |
| 71 | |
| 72 } // namespace payments | |
| 73 | |
| 74 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_CONTACT_INFO_EDITOR_VIEW_CONTROLLER_ H_ | |
| OLD | NEW |