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

Side by Side Diff: chrome/browser/ui/views/payments/contact_info_editor_view_controller.h

Issue 2816083002: [WebPayments] Desktop implementation of Contact Editor (Closed)
Patch Set: rebase Created 3 years, 8 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 unified diff | Download patch
OLDNEW
(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
16 namespace autofill {
17 class AutofillProfile;
18 } // namespace autofill
19
20 namespace payments {
21
22 class ContactInfoEditorViewController : public EditorViewController {
23 public:
24 // Does not take ownership of the arguments, which should outlive this object.
25 // Passing nullptr as |profile| indicates that we are editing a new profile;
26 // other arguments should never be null.
27 ContactInfoEditorViewController(PaymentRequestSpec* spec,
28 PaymentRequestState* state,
29 PaymentRequestDialogView* dialog,
30 autofill::AutofillProfile* profile);
31 ~ContactInfoEditorViewController() override;
32
33 // EditorViewController:
34 std::unique_ptr<views::View> CreateHeaderView() override;
35 std::vector<EditorField> GetFieldDefinitions() override;
36 base::string16 GetInitialValueForType(
37 autofill::ServerFieldType type) override;
38 bool ValidateModelAndSave() override;
39 std::unique_ptr<ValidationDelegate> CreateValidationDelegate(
40 const EditorField& field) override;
41 std::unique_ptr<ui::ComboboxModel> GetComboboxModelForType(
42 const autofill::ServerFieldType& type) override;
43
44 protected:
45 // PaymentRequestSheetController:
46 base::string16 GetSheetTitle() override;
47
48 private:
49 bool ValidateModel();
50 // Uses the values in the UI fields to populate the corresponding values in
51 // |profile|.
52 void PopulateProfile(autofill::AutofillProfile* profile);
53
54 autofill::AutofillProfile* profile_to_edit_;
55
56 class ContactInfoValidationDelegate : public ValidationDelegate {
57 public:
58 ContactInfoValidationDelegate(const EditorField& field,
59 const std::string& locale,
60 EditorViewController* controller);
61 ~ContactInfoValidationDelegate() override;
62
63 // ValidationDelegate:
64 bool ValidateTextfield(views::Textfield* textfield) override;
65 bool ValidateCombobox(views::Combobox* combobox) override;
66 void ComboboxModelChanged(views::Combobox* combobox) override {}
67
68 private:
69 EditorField field_;
70 // Outlives this class. Never null.
71 EditorViewController* controller_;
72 const std::string& locale_;
73 };
74 };
75
76 } // namespace payments
77
78 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_CONTACT_INFO_EDITOR_VIEW_CONTROLLER_ H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/views/payments/contact_info_editor_view_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698