OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" | 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 form_structure_.ParseFieldTypesFromAutocompleteAttributes(&has_types, | 160 form_structure_.ParseFieldTypesFromAutocompleteAttributes(&has_types, |
161 &has_sections); | 161 &has_sections); |
162 // Fail if the author didn't specify autocomplete types. | 162 // Fail if the author didn't specify autocomplete types. |
163 if (!has_types) { | 163 if (!has_types) { |
164 callback_.Run(NULL); | 164 callback_.Run(NULL); |
165 delete this; | 165 delete this; |
166 return; | 166 return; |
167 } | 167 } |
168 | 168 |
169 const DetailInput kEmailInputs[] = { | 169 const DetailInput kEmailInputs[] = { |
170 { 1, EMAIL_ADDRESS, "Email address" }, | 170 { 1, EMAIL_ADDRESS, IDS_AUTOFILL_DIALOG_PLACEHOLDER_EMAIL }, |
171 }; | 171 }; |
172 | 172 |
173 const DetailInput kCCInputs[] = { | 173 const DetailInput kCCInputs[] = { |
174 { 2, CREDIT_CARD_NUMBER, "Card number" }, | 174 { 2, CREDIT_CARD_NUMBER, IDS_AUTOFILL_DIALOG_PLACEHOLDER_CARD_NUMBER }, |
175 { 3, CREDIT_CARD_EXP_MONTH }, | 175 { 3, CREDIT_CARD_EXP_MONTH }, |
176 { 3, CREDIT_CARD_EXP_4_DIGIT_YEAR }, | 176 { 3, CREDIT_CARD_EXP_4_DIGIT_YEAR }, |
177 { 3, CREDIT_CARD_VERIFICATION_CODE, "CVC" }, | 177 { 3, CREDIT_CARD_VERIFICATION_CODE, IDS_AUTOFILL_DIALOG_PLACEHOLDER_CVC }, |
178 { 4, CREDIT_CARD_NAME, "Cardholder name" }, | 178 { 4, CREDIT_CARD_NAME, IDS_AUTOFILL_DIALOG_PLACEHOLDER_CARDHOLDER_NAME }, |
179 }; | 179 }; |
180 | 180 |
181 const DetailInput kBillingInputs[] = { | 181 const DetailInput kBillingInputs[] = { |
182 { 5, ADDRESS_HOME_LINE1, "Street address", "billing" }, | 182 { 5, ADDRESS_HOME_LINE1, IDS_AUTOFILL_DIALOG_PLACEHOLDER_ADDRESS_LINE_1, |
183 { 6, ADDRESS_HOME_LINE2, "Street address (optional)", "billing" }, | 183 "billing" }, |
184 { 7, ADDRESS_HOME_CITY, "City", "billing" }, | 184 { 6, ADDRESS_HOME_LINE2, IDS_AUTOFILL_DIALOG_PLACEHOLDER_ADDRESS_LINE_2, |
185 { 8, ADDRESS_HOME_STATE, "State", "billing" }, | 185 "billing" }, |
186 { 8, ADDRESS_HOME_ZIP, "ZIP code", "billing", 0.5 }, | 186 { 7, ADDRESS_HOME_CITY, IDS_AUTOFILL_DIALOG_PLACEHOLDER_LOCALITY, |
| 187 "billing" }, |
| 188 // TODO(estade): state is supposed to be a combobox. |
| 189 { 8, ADDRESS_HOME_STATE, IDS_AUTOFILL_FIELD_LABEL_STATE, "billing" }, |
| 190 { 8, ADDRESS_HOME_ZIP, IDS_AUTOFILL_DIALOG_PLACEHOLDER_POSTAL_CODE, |
| 191 "billing", 0.5 }, |
187 }; | 192 }; |
188 | 193 |
189 const DetailInput kShippingInputs[] = { | 194 const DetailInput kShippingInputs[] = { |
190 { 9, NAME_FULL, "Full name", "shipping" }, | 195 { 9, NAME_FULL, IDS_AUTOFILL_DIALOG_PLACEHOLDER_ADDRESSEE_NAME, |
191 { 10, ADDRESS_HOME_LINE1, "Street address", "shipping" }, | 196 "shipping" }, |
192 { 11, ADDRESS_HOME_LINE2, "Street address (optional)", "shipping" }, | 197 { 10, ADDRESS_HOME_LINE1, IDS_AUTOFILL_DIALOG_PLACEHOLDER_ADDRESS_LINE_1, |
193 { 12, ADDRESS_HOME_CITY, "City", "shipping" }, | 198 "shipping" }, |
194 { 13, ADDRESS_HOME_STATE, "State", "shipping" }, | 199 { 11, ADDRESS_HOME_LINE2, IDS_AUTOFILL_DIALOG_PLACEHOLDER_ADDRESS_LINE_2, |
195 { 13, ADDRESS_HOME_ZIP, "ZIP code", "shipping", 0.5 }, | 200 "shipping" }, |
| 201 { 12, ADDRESS_HOME_CITY, IDS_AUTOFILL_DIALOG_PLACEHOLDER_LOCALITY, |
| 202 "shipping" }, |
| 203 // TODO(estade): state is supposed to be a combobox. |
| 204 { 13, ADDRESS_HOME_STATE, IDS_AUTOFILL_FIELD_LABEL_STATE, "shipping" }, |
| 205 { 13, ADDRESS_HOME_ZIP, IDS_AUTOFILL_DIALOG_PLACEHOLDER_POSTAL_CODE, |
| 206 "shipping", 0.5 }, |
196 }; | 207 }; |
197 | 208 |
198 FilterInputs(form_structure_, | 209 FilterInputs(form_structure_, |
199 kEmailInputs, | 210 kEmailInputs, |
200 arraysize(kEmailInputs), | 211 arraysize(kEmailInputs), |
201 &requested_email_fields_); | 212 &requested_email_fields_); |
202 | 213 |
203 FilterInputs(form_structure_, | 214 FilterInputs(form_structure_, |
204 kCCInputs, | 215 kCCInputs, |
205 arraysize(kCCInputs), | 216 arraysize(kCCInputs), |
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 DialogSection section) { | 1044 DialogSection section) { |
1034 return const_cast<DetailInputs*>(&RequestedFieldsForSection(section)); | 1045 return const_cast<DetailInputs*>(&RequestedFieldsForSection(section)); |
1035 } | 1046 } |
1036 | 1047 |
1037 void AutofillDialogControllerImpl::HidePopup() { | 1048 void AutofillDialogControllerImpl::HidePopup() { |
1038 if (popup_controller_) | 1049 if (popup_controller_) |
1039 popup_controller_->Hide(); | 1050 popup_controller_->Hide(); |
1040 } | 1051 } |
1041 | 1052 |
1042 } // namespace autofill | 1053 } // namespace autofill |
OLD | NEW |