| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_COUNTRY_H_ | 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_COUNTRY_H_ |
| 6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_COUNTRY_H_ | 6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_COUNTRY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 static void GetAvailableCountries( | 49 static void GetAvailableCountries( |
| 50 std::vector<std::string>* country_codes); | 50 std::vector<std::string>* country_codes); |
| 51 | 51 |
| 52 // Returns the likely country code for |locale|, or "US" as a fallback if no | 52 // Returns the likely country code for |locale|, or "US" as a fallback if no |
| 53 // mapping from the locale is available. | 53 // mapping from the locale is available. |
| 54 static const std::string CountryCodeForLocale(const std::string& locale); | 54 static const std::string CountryCodeForLocale(const std::string& locale); |
| 55 | 55 |
| 56 // Returns the country code corresponding to |country|, which should be a | 56 // Returns the country code corresponding to |country|, which should be a |
| 57 // country code or country name localized to |locale|. This function can | 57 // country code or country name localized to |locale|. This function can |
| 58 // be expensive so use judiciously. | 58 // be expensive so use judiciously. |
| 59 static const std::string GetCountryCode(const string16& country, | 59 static const std::string GetCountryCode(const base::string16& country, |
| 60 const std::string& locale); | 60 const std::string& locale); |
| 61 | 61 |
| 62 const std::string country_code() const { return country_code_; } | 62 const std::string country_code() const { return country_code_; } |
| 63 const string16 name() const { return name_; } | 63 const base::string16 name() const { return name_; } |
| 64 const string16 postal_code_label() const { return postal_code_label_; } | 64 const base::string16 postal_code_label() const { return postal_code_label_; } |
| 65 const string16 state_label() const { return state_label_; } | 65 const base::string16 state_label() const { return state_label_; } |
| 66 | 66 |
| 67 // City is expected in a complete address for this country. | 67 // City is expected in a complete address for this country. |
| 68 bool requires_city() const { | 68 bool requires_city() const { |
| 69 return (address_required_fields_ & ADDRESS_REQUIRES_CITY) != 0; | 69 return (address_required_fields_ & ADDRESS_REQUIRES_CITY) != 0; |
| 70 } | 70 } |
| 71 | 71 |
| 72 // State is expected in a complete address for this country. | 72 // State is expected in a complete address for this country. |
| 73 bool requires_state() const { | 73 bool requires_state() const { |
| 74 return (address_required_fields_ & ADDRESS_REQUIRES_STATE) != 0; | 74 return (address_required_fields_ & ADDRESS_REQUIRES_STATE) != 0; |
| 75 } | 75 } |
| 76 | 76 |
| 77 // Zip is expected in a complete address for this country. | 77 // Zip is expected in a complete address for this country. |
| 78 bool requires_zip() const { | 78 bool requires_zip() const { |
| 79 return (address_required_fields_ & ADDRESS_REQUIRES_ZIP) != 0; | 79 return (address_required_fields_ & ADDRESS_REQUIRES_ZIP) != 0; |
| 80 } | 80 } |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 AutofillCountry(const std::string& country_code, | 83 AutofillCountry(const std::string& country_code, |
| 84 const string16& name, | 84 const base::string16& name, |
| 85 const string16& postal_code_label, | 85 const base::string16& postal_code_label, |
| 86 const string16& state_label); | 86 const base::string16& state_label); |
| 87 | 87 |
| 88 // The two-letter ISO-3166 country code. | 88 // The two-letter ISO-3166 country code. |
| 89 std::string country_code_; | 89 std::string country_code_; |
| 90 | 90 |
| 91 // The country's name, localized to the app locale. | 91 // The country's name, localized to the app locale. |
| 92 string16 name_; | 92 base::string16 name_; |
| 93 | 93 |
| 94 // The localized label for the postal code (or zip code) field. | 94 // The localized label for the postal code (or zip code) field. |
| 95 string16 postal_code_label_; | 95 base::string16 postal_code_label_; |
| 96 | 96 |
| 97 // The localized label for the state (or province, district, etc.) field. | 97 // The localized label for the state (or province, district, etc.) field. |
| 98 string16 state_label_; | 98 base::string16 state_label_; |
| 99 | 99 |
| 100 // Address requirement field codes for the country. | 100 // Address requirement field codes for the country. |
| 101 AddressRequiredFields address_required_fields_; | 101 AddressRequiredFields address_required_fields_; |
| 102 | 102 |
| 103 DISALLOW_COPY_AND_ASSIGN(AutofillCountry); | 103 DISALLOW_COPY_AND_ASSIGN(AutofillCountry); |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_COUNTRY_H_ | 106 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_COUNTRY_H_ |
| OLD | NEW |