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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 string16& country, |
60 const std::string& locale); | 60 const std::string& locale); |
61 | 61 |
62 // Returns the application locale. | |
63 // The first time this is called, it should be called from the UI thread. | |
64 // Once [ http://crbug.com/100845 ] is fixed, this method should *only* be | |
65 // called from the UI thread. | |
66 static const std::string ApplicationLocale(); | |
67 | |
68 const std::string country_code() const { return country_code_; } | 62 const std::string country_code() const { return country_code_; } |
69 const string16 name() const { return name_; } | 63 const string16 name() const { return name_; } |
70 const string16 postal_code_label() const { return postal_code_label_; } | 64 const string16 postal_code_label() const { return postal_code_label_; } |
71 const string16 state_label() const { return state_label_; } | 65 const string16 state_label() const { return state_label_; } |
72 | 66 |
73 // City is expected in a complete address for this country. | 67 // City is expected in a complete address for this country. |
74 bool requires_city() const { | 68 bool requires_city() const { |
75 return (address_required_fields_ & ADDRESS_REQUIRES_CITY) != 0; | 69 return (address_required_fields_ & ADDRESS_REQUIRES_CITY) != 0; |
76 } | 70 } |
77 | 71 |
(...skipping 25 matching lines...) Expand all Loading... |
103 // The localized label for the state (or province, district, etc.) field. | 97 // The localized label for the state (or province, district, etc.) field. |
104 string16 state_label_; | 98 string16 state_label_; |
105 | 99 |
106 // Address requirement field codes for the country. | 100 // Address requirement field codes for the country. |
107 AddressRequiredFields address_required_fields_; | 101 AddressRequiredFields address_required_fields_; |
108 | 102 |
109 DISALLOW_COPY_AND_ASSIGN(AutofillCountry); | 103 DISALLOW_COPY_AND_ASSIGN(AutofillCountry); |
110 }; | 104 }; |
111 | 105 |
112 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_COUNTRY_H_ | 106 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_COUNTRY_H_ |
OLD | NEW |