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

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

Issue 2883333003: Payment request shipping address editor now properly handles countries (Closed)
Patch Set: Rebase Created 3 years, 7 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
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 <utility>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
14 #include "chrome/browser/ui/views/payments/editor_view_controller.h" 15 #include "chrome/browser/ui/views/payments/editor_view_controller.h"
15 #include "chrome/browser/ui/views/payments/validating_textfield.h" 16 #include "chrome/browser/ui/views/payments/validating_textfield.h"
16 17
17 namespace autofill { 18 namespace autofill {
18 class AutofillProfile; 19 class AutofillProfile;
19 } // namespace autofill 20 } // namespace autofill
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 102
102 // List of fields, reset everytime the current country changes. 103 // List of fields, reset everytime the current country changes.
103 std::vector<EditorField> editor_fields_; 104 std::vector<EditorField> editor_fields_;
104 105
105 // The currently chosen country. Defaults to 0 as the first entry in the 106 // The currently chosen country. Defaults to 0 as the first entry in the
106 // combobox, which is the generated default value received from 107 // combobox, which is the generated default value received from
107 // autofill::CountryComboboxModel::countries() which is documented to always 108 // autofill::CountryComboboxModel::countries() which is documented to always
108 // have the default country at the top as well as within the sorted list. 109 // have the default country at the top as well as within the sorted list.
109 size_t chosen_country_index_; 110 size_t chosen_country_index_;
110 111
111 // The list of country codes as ordered in the country combobox model. 112 // The list of country codes and names as ordered in the country combobox
112 std::vector<std::string> country_codes_; 113 // model.
114 std::vector<std::pair<std::string, base::string16>> countries_;
113 115
114 // Identifies whether we tried and failed to load region data. 116 // Identifies whether we tried and failed to load region data.
115 bool failed_to_load_region_data_; 117 bool failed_to_load_region_data_;
116 118
117 // Updates |editor_fields_| based on the current country. 119 // Updates |editor_fields_| based on the current country.
118 void UpdateEditorFields(); 120 void UpdateEditorFields();
119 121
120 // Called when data changes need to force a view update. |synchronous| 122 // Called when data changes need to force a view update. |synchronous|
121 // specifies whether the view update can be done synchronously. 123 // specifies whether the view update can be done synchronously.
122 void OnDataChanged(bool synchronous); 124 void OnDataChanged(bool synchronous);
123 125
124 // Saves the current state of the |editor_fields_| in |profile| and ignore 126 // Saves the current state of the |editor_fields_| in |profile| and ignore
125 // errors if |ignore_errors| is true. Return false on errors, ignored or not. 127 // errors if |ignore_errors| is true. Return false on errors, ignored or not.
126 bool SaveFieldsToProfile(autofill::AutofillProfile* profile, 128 bool SaveFieldsToProfile(autofill::AutofillProfile* profile,
127 bool ignore_errors); 129 bool ignore_errors);
128 130
129 // When a combobox model has changed, a view update might be needed, e.g., if 131 // When a combobox model has changed, a view update might be needed, e.g., if
130 // there is no data in the combobox and it must be converted to a text field. 132 // there is no data in the combobox and it must be converted to a text field.
131 void OnComboboxModelChanged(views::Combobox* combobox); 133 void OnComboboxModelChanged(views::Combobox* combobox);
132 134
133 // Failed to fetch the region data in time. 135 // Failed to fetch the region data in time.
134 void RegionDataLoadTimedOut(); 136 void RegionDataLoadTimedOut();
135 137
136 DISALLOW_COPY_AND_ASSIGN(ShippingAddressEditorViewController); 138 DISALLOW_COPY_AND_ASSIGN(ShippingAddressEditorViewController);
137 }; 139 };
138 140
139 } // namespace payments 141 } // namespace payments
140 142
141 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_SHIPPING_ADDRESS_EDITOR_VIEW_CONTROL LER_H_ 143 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_SHIPPING_ADDRESS_EDITOR_VIEW_CONTROL LER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698