| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_INPUT_I18N_H_ |
| 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_INPUT_I18N_H_ |
| 7 |
| 8 #include "chrome/browser/ui/autofill/autofill_dialog_input.h" |
| 9 |
| 10 namespace autofill { |
| 11 namespace common { |
| 12 |
| 13 // An implementation of AutofillDialogInput with internationalized fields. This |
| 14 // implementation allows changing the country/region field. Do not instantiate |
| 15 // this object directly. Use AutofillDialogInput::BuildInstance() instead. |
| 16 class AutofillDialogInputI18n : public AutofillDialogInput { |
| 17 public: |
| 18 AutofillDialogInputI18n(); |
| 19 virtual ~AutofillDialogInputI18n(); |
| 20 |
| 21 // AutofillDialogInput implementation. |
| 22 virtual void BuildInputsForSection(DialogSection dialog_section, |
| 23 DetailInputs* inputs) OVERRIDE; |
| 24 virtual void BuildInputsForSection(DialogSection dialog_section, |
| 25 const std::string& selected_country_region, |
| 26 DetailInputs* inputs) OVERRIDE; |
| 27 |
| 28 private: |
| 29 enum AddressType { |
| 30 ADDRESS_TYPE_BILLING, |
| 31 ADDRESS_TYPE_SHIPPING, |
| 32 }; |
| 33 |
| 34 // Converts a home-address |field_type| into a billing-address field if |
| 35 // |address_type| is ADDRESS_TYPE_BILLING. Otherwise returns the original |
| 36 // field type. |
| 37 static ServerFieldType GetFieldType(AddressType address_type, |
| 38 ServerFieldType field_type); |
| 39 |
| 40 // Builds the autofill |inputs| for |dialog_section| with the specified |
| 41 // |country_region| and |language| specific inputs. |
| 42 void BuildLocalizedInputs(DialogSection dialog_section, |
| 43 const std::string& language, |
| 44 const std::string& country_region, |
| 45 DetailInputs* inputs); |
| 46 |
| 47 // Builds only the address part of |inputs| starting at |field_row|. |
| 48 int BuildAddressInputs(AddressType type, |
| 49 int field_row, |
| 50 const std::string& language, |
| 51 const std::string& country_region, |
| 52 DetailInputs* inputs); |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(AutofillDialogInputI18n); |
| 55 }; |
| 56 |
| 57 } // namespace common |
| 58 } // namespace autofill |
| 59 |
| 60 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_INPUT_I18N_H_ |
| OLD | NEW |