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

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

Issue 2773383002: [Payments] In shipping address editor, enable required + phone validation. (Closed)
Patch Set: clear error Created 3 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_SHIPPING_ADDRESS_EDITOR_VIEW_CONTROLLER _H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_SHIPPING_ADDRESS_EDITOR_VIEW_CONTROLLER _H_
6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_SHIPPING_ADDRESS_EDITOR_VIEW_CONTROLLER _H_ 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_SHIPPING_ADDRESS_EDITOR_VIEW_CONTROLLER _H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 ~ShippingAddressValidationDelegate() override; 51 ~ShippingAddressValidationDelegate() override;
52 52
53 // ValidationDelegate: 53 // ValidationDelegate:
54 bool ValidateTextfield(views::Textfield* textfield) override; 54 bool ValidateTextfield(views::Textfield* textfield) override;
55 bool ValidateCombobox(views::Combobox* combobox) override; 55 bool ValidateCombobox(views::Combobox* combobox) override;
56 56
57 private: 57 private:
58 bool ValidateValue(const base::string16& value); 58 bool ValidateValue(const base::string16& value);
59 59
60 EditorField field_; 60 EditorField field_;
61 // TODO(mad): Bring back when needed. 61 ShippingAddressEditorViewController* controller_;
anthonyvd 2017/03/27 14:05:08 nit: comment about why the raw pointer is OK?
Mathieu 2017/03/27 16:36:11 Done.
62 // ShippingAddressEditorViewController* parent_{nullptr};
63 62
64 DISALLOW_COPY_AND_ASSIGN(ShippingAddressValidationDelegate); 63 DISALLOW_COPY_AND_ASSIGN(ShippingAddressValidationDelegate);
65 }; 64 };
66 friend class ShippingAddressValidationDelegate; 65 friend class ShippingAddressValidationDelegate;
67 66
68 // List of fields, reset everytime the current country changes. 67 // List of fields, reset everytime the current country changes.
69 std::vector<EditorField> editor_fields_; 68 std::vector<EditorField> editor_fields_;
70 69
71 // The currently chosen country. Defaults to 0 as the first entry in the 70 // The currently chosen country. Defaults to 0 as the first entry in the
72 // combobox, which is the generated default value received from 71 // combobox, which is the generated default value received from
73 // autofill::CountryComboboxModel::countries() which is documented to always 72 // autofill::CountryComboboxModel::countries() which is documented to always
74 // have the default country at the top as well as within the sorted list. 73 // have the default country at the top as well as within the sorted list.
75 size_t chosen_country_index_{0}; 74 size_t chosen_country_index_{0};
76 75
77 // The list of country codes as ordered in the country combobox model. 76 // The list of country codes as ordered in the country combobox model.
78 std::vector<std::string> country_codes_; 77 std::vector<std::string> country_codes_;
79 78
80 // Updates |editor_fields_| based on the current country. 79 // Updates |editor_fields_| based on the current country.
81 void UpdateEditorFields(); 80 void UpdateEditorFields();
82 81
83 // Called by the validation delegate when the country combobox changed. 82 // Called by the validation delegate when the country combobox changed.
84 void OnCountryChanged(views::Combobox* combobox); 83 void OnCountryChanged(views::Combobox* combobox);
85 84
86 DISALLOW_COPY_AND_ASSIGN(ShippingAddressEditorViewController); 85 DISALLOW_COPY_AND_ASSIGN(ShippingAddressEditorViewController);
87 }; 86 };
88 87
89 } // namespace payments 88 } // namespace payments
90 89
91 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_SHIPPING_ADDRESS_EDITOR_VIEW_CONTROL LER_H_ 90 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_SHIPPING_ADDRESS_EDITOR_VIEW_CONTROL LER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698