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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_COUNTRY_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_COUNTRY_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_COUNTRY_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_COUNTRY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // Returns the likely country code for |locale|, or "US" as a fallback if no | 54 // Returns the likely country code for |locale|, or "US" as a fallback if no |
55 // mapping from the locale is available. | 55 // mapping from the locale is available. |
56 static const std::string CountryCodeForLocale(const std::string& locale); | 56 static const std::string CountryCodeForLocale(const std::string& locale); |
57 | 57 |
58 // Returns the country code corresponding to |country|, which should be a | 58 // Returns the country code corresponding to |country|, which should be a |
59 // country code or country name localized to |locale|. This function can | 59 // country code or country name localized to |locale|. This function can |
60 // be expensive so use judiciously. | 60 // be expensive so use judiciously. |
61 static const std::string GetCountryCode(const base::string16& country, | 61 static const std::string GetCountryCode(const base::string16& country, |
62 const std::string& locale); | 62 const std::string& locale); |
63 | 63 |
64 const std::string country_code() const { return country_code_; } | 64 const std::string& country_code() const { return country_code_; } |
65 const base::string16 name() const { return name_; } | 65 const base::string16& name() const { return name_; } |
66 const base::string16 postal_code_label() const { return postal_code_label_; } | 66 const base::string16& postal_code_label() const { return postal_code_label_; } |
67 const base::string16 state_label() const { return state_label_; } | 67 const base::string16& state_label() const { return state_label_; } |
68 | 68 |
69 // City is expected in a complete address for this country. | 69 // City is expected in a complete address for this country. |
70 bool requires_city() const { | 70 bool requires_city() const { |
71 return (address_required_fields_ & ADDRESS_REQUIRES_CITY) != 0; | 71 return (address_required_fields_ & ADDRESS_REQUIRES_CITY) != 0; |
72 } | 72 } |
73 | 73 |
74 // State is expected in a complete address for this country. | 74 // State is expected in a complete address for this country. |
75 bool requires_state() const { | 75 bool requires_state() const { |
76 return (address_required_fields_ & ADDRESS_REQUIRES_STATE) != 0; | 76 return (address_required_fields_ & ADDRESS_REQUIRES_STATE) != 0; |
77 } | 77 } |
(...skipping 23 matching lines...) Expand all Loading... |
101 | 101 |
102 // Address requirement field codes for the country. | 102 // Address requirement field codes for the country. |
103 AddressRequiredFields address_required_fields_; | 103 AddressRequiredFields address_required_fields_; |
104 | 104 |
105 DISALLOW_COPY_AND_ASSIGN(AutofillCountry); | 105 DISALLOW_COPY_AND_ASSIGN(AutofillCountry); |
106 }; | 106 }; |
107 | 107 |
108 } // namespace autofill | 108 } // namespace autofill |
109 | 109 |
110 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_COUNTRY_H_ | 110 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_COUNTRY_H_ |
OLD | NEW |