OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_common.h" | 5 #include "chrome/browser/ui/autofill/autofill_dialog_common.h" |
6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" |
7 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
8 #include "components/autofill/core/browser/autofill_country.h" | 9 #include "components/autofill/core/browser/autofill_country.h" |
9 #include "components/autofill/core/browser/autofill_field.h" | 10 #include "components/autofill/core/browser/autofill_field.h" |
10 #include "components/autofill/core/browser/autofill_type.h" | 11 #include "components/autofill/core/browser/autofill_type.h" |
11 #include "grit/chromium_strings.h" | 12 #include "grit/chromium_strings.h" |
12 #include "grit/component_strings.h" | 13 #include "grit/component_strings.h" |
13 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
14 #include "grit/theme_resources.h" | 15 #include "grit/theme_resources.h" |
15 #include "grit/webkit_resources.h" | 16 #include "grit/webkit_resources.h" |
16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 else | 197 else |
197 BuildInputs(kBillingInputs, arraysize(kBillingInputs), inputs); | 198 BuildInputs(kBillingInputs, arraysize(kBillingInputs), inputs); |
198 | 199 |
199 BuildInputs(kBillingPhoneInputs, arraysize(kBillingPhoneInputs), inputs); | 200 BuildInputs(kBillingPhoneInputs, arraysize(kBillingPhoneInputs), inputs); |
200 BuildInputs(kEmailInputs, arraysize(kEmailInputs), inputs); | 201 BuildInputs(kEmailInputs, arraysize(kEmailInputs), inputs); |
201 break; | 202 break; |
202 | 203 |
203 case SECTION_CC_BILLING: | 204 case SECTION_CC_BILLING: |
204 BuildInputs(kCCInputs, arraysize(kCCInputs), inputs); | 205 BuildInputs(kCCInputs, arraysize(kCCInputs), inputs); |
205 | 206 |
206 if (IsI18nInputEnabled()) | 207 if (IsI18nInputEnabled()) { |
207 BuildI18nAddressInputs(ADDRESS_TYPE_BILLING, country_code, inputs); | 208 // Wallet only supports US billing addresses. |
208 else | 209 const std::string hardcoded_country_code = "US"; |
| 210 BuildI18nAddressInputs(ADDRESS_TYPE_BILLING, |
| 211 hardcoded_country_code, |
| 212 inputs); |
| 213 DCHECK_EQ(inputs->back().type, ADDRESS_BILLING_COUNTRY); |
| 214 inputs->back().length = DetailInput::NONE; |
| 215 inputs->back().initial_value = |
| 216 base::ASCIIToUTF16(hardcoded_country_code); |
| 217 } else { |
209 BuildInputs(kBillingInputs, arraysize(kBillingInputs), inputs); | 218 BuildInputs(kBillingInputs, arraysize(kBillingInputs), inputs); |
| 219 } |
210 | 220 |
211 BuildInputs(kBillingPhoneInputs, arraysize(kBillingPhoneInputs), inputs); | 221 BuildInputs(kBillingPhoneInputs, arraysize(kBillingPhoneInputs), inputs); |
212 break; | 222 break; |
213 | 223 |
214 case SECTION_SHIPPING: | 224 case SECTION_SHIPPING: |
215 if (IsI18nInputEnabled()) | 225 if (IsI18nInputEnabled()) |
216 BuildI18nAddressInputs(ADDRESS_TYPE_SHIPPING, country_code, inputs); | 226 BuildI18nAddressInputs(ADDRESS_TYPE_SHIPPING, country_code, inputs); |
217 else | 227 else |
218 BuildInputs(kShippingInputs, arraysize(kShippingInputs), inputs); | 228 BuildInputs(kShippingInputs, arraysize(kShippingInputs), inputs); |
219 | 229 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 std::vector<ServerFieldType> TypesFromInputs(const DetailInputs& inputs) { | 289 std::vector<ServerFieldType> TypesFromInputs(const DetailInputs& inputs) { |
280 std::vector<ServerFieldType> types; | 290 std::vector<ServerFieldType> types; |
281 for (size_t i = 0; i < inputs.size(); ++i) { | 291 for (size_t i = 0; i < inputs.size(); ++i) { |
282 types.push_back(inputs[i].type); | 292 types.push_back(inputs[i].type); |
283 } | 293 } |
284 return types; | 294 return types; |
285 } | 295 } |
286 | 296 |
287 } // namespace common | 297 } // namespace common |
288 } // namespace autofill | 298 } // namespace autofill |
OLD | NEW |