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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/payments/contact_info_editor_view_controller.h
diff --git a/chrome/browser/ui/views/payments/contact_info_editor_view_controller.h b/chrome/browser/ui/views/payments/contact_info_editor_view_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..3a94806673588b54a42895ba7836a6c15a3ebbf0
--- /dev/null
+++ b/chrome/browser/ui/views/payments/contact_info_editor_view_controller.h
@@ -0,0 +1,78 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_CONTACT_INFO_EDITOR_VIEW_CONTROLLER_H_
+#define CHROME_BROWSER_UI_VIEWS_PAYMENTS_CONTACT_INFO_EDITOR_VIEW_CONTROLLER_H_
+
+#include <memory>
+#include <vector>
+
+#include "base/macros.h"
+#include "base/strings/string16.h"
+#include "chrome/browser/ui/views/payments/editor_view_controller.h"
+#include "chrome/browser/ui/views/payments/validation_delegate.h"
+
+namespace autofill {
+class AutofillProfile;
+} // namespace autofill
+
+namespace payments {
+
+class ContactInfoEditorViewController : public EditorViewController {
+ public:
+ // Does not take ownership of the arguments, which should outlive this object.
+ // Passing nullptr as |profile| indicates that we are editing a new profile;
+ // other arguments should never be null.
+ ContactInfoEditorViewController(PaymentRequestSpec* spec,
+ PaymentRequestState* state,
+ PaymentRequestDialogView* dialog,
+ autofill::AutofillProfile* profile);
+ ~ContactInfoEditorViewController() override;
+
+ // EditorViewController:
+ std::unique_ptr<views::View> CreateHeaderView() override;
+ std::vector<EditorField> GetFieldDefinitions() override;
+ base::string16 GetInitialValueForType(
+ autofill::ServerFieldType type) override;
+ bool ValidateModelAndSave() override;
+ std::unique_ptr<ValidationDelegate> CreateValidationDelegate(
+ const EditorField& field) override;
+ std::unique_ptr<ui::ComboboxModel> GetComboboxModelForType(
+ const autofill::ServerFieldType& type) override;
+
+ protected:
+ // PaymentRequestSheetController:
+ base::string16 GetSheetTitle() override;
+
+ private:
+ bool ValidateModel();
+ // Uses the values in the UI fields to populate the corresponding values in
+ // |profile|.
+ void PopulateProfile(autofill::AutofillProfile* profile);
+
+ autofill::AutofillProfile* profile_to_edit_;
+
+ class ContactInfoValidationDelegate : public ValidationDelegate {
+ public:
+ ContactInfoValidationDelegate(const EditorField& field,
+ const std::string& locale,
+ EditorViewController* controller);
+ ~ContactInfoValidationDelegate() override;
+
+ // ValidationDelegate:
+ bool ValidateTextfield(views::Textfield* textfield) override;
+ bool ValidateCombobox(views::Combobox* combobox) override;
+ void ComboboxModelChanged(views::Combobox* combobox) override {}
+
+ private:
+ EditorField field_;
+ // Outlives this class. Never null.
+ EditorViewController* controller_;
+ const std::string& locale_;
+ };
+};
+
+} // namespace payments
+
+#endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_CONTACT_INFO_EDITOR_VIEW_CONTROLLER_H_
« 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