| OLD | NEW |
| 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 Loading... |
| 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 // Raw pointer back to the owner of this class, therefore will not be null. |
| 62 // ShippingAddressEditorViewController* parent_{nullptr}; | 62 ShippingAddressEditorViewController* controller_; |
| 63 | 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(ShippingAddressValidationDelegate); | 64 DISALLOW_COPY_AND_ASSIGN(ShippingAddressValidationDelegate); |
| 65 }; | 65 }; |
| 66 friend class ShippingAddressValidationDelegate; | 66 friend class ShippingAddressValidationDelegate; |
| 67 | 67 |
| 68 // List of fields, reset everytime the current country changes. | 68 // List of fields, reset everytime the current country changes. |
| 69 std::vector<EditorField> editor_fields_; | 69 std::vector<EditorField> editor_fields_; |
| 70 | 70 |
| 71 // The currently chosen country. Defaults to 0 as the first entry in the | 71 // The currently chosen country. Defaults to 0 as the first entry in the |
| 72 // combobox, which is the generated default value received from | 72 // combobox, which is the generated default value received from |
| 73 // autofill::CountryComboboxModel::countries() which is documented to always | 73 // autofill::CountryComboboxModel::countries() which is documented to always |
| 74 // have the default country at the top as well as within the sorted list. | 74 // have the default country at the top as well as within the sorted list. |
| 75 size_t chosen_country_index_{0}; | 75 size_t chosen_country_index_{0}; |
| 76 | 76 |
| 77 // The list of country codes as ordered in the country combobox model. | 77 // The list of country codes as ordered in the country combobox model. |
| 78 std::vector<std::string> country_codes_; | 78 std::vector<std::string> country_codes_; |
| 79 | 79 |
| 80 // Updates |editor_fields_| based on the current country. | 80 // Updates |editor_fields_| based on the current country. |
| 81 void UpdateEditorFields(); | 81 void UpdateEditorFields(); |
| 82 | 82 |
| 83 // Called by the validation delegate when the country combobox changed. | 83 // Called by the validation delegate when the country combobox changed. |
| 84 void OnCountryChanged(views::Combobox* combobox); | 84 void OnCountryChanged(views::Combobox* combobox); |
| 85 | 85 |
| 86 DISALLOW_COPY_AND_ASSIGN(ShippingAddressEditorViewController); | 86 DISALLOW_COPY_AND_ASSIGN(ShippingAddressEditorViewController); |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 } // namespace payments | 89 } // namespace payments |
| 90 | 90 |
| 91 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_SHIPPING_ADDRESS_EDITOR_VIEW_CONTROL
LER_H_ | 91 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_SHIPPING_ADDRESS_EDITOR_VIEW_CONTROL
LER_H_ |
| OLD | NEW |