| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_COUNTRY_H_ | |
| 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_COUNTRY_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/string16.h" | |
| 13 | |
| 14 // Stores data associated with a country. Strings are localized to the app | |
| 15 // locale. | |
| 16 class AutofillCountry { | |
| 17 public: | |
| 18 // Returns country data corresponding to the two-letter ISO code | |
| 19 // |country_code|. | |
| 20 AutofillCountry(const std::string& country_code, const std::string& locale); | |
| 21 ~AutofillCountry(); | |
| 22 | |
| 23 // Fills |country_codes| with a list of the available countries' codes. | |
| 24 static void GetAvailableCountries( | |
| 25 std::vector<std::string>* country_codes); | |
| 26 | |
| 27 // Returns the likely country code for |locale|, or "US" as a fallback if no | |
| 28 // mapping from the locale is available. | |
| 29 static const std::string CountryCodeForLocale(const std::string& locale); | |
| 30 | |
| 31 // Returns the country code corresponding to |country|, which should be a | |
| 32 // country code or country name localized to |locale|. This function can | |
| 33 // be expensive so use judiciously. | |
| 34 static const std::string GetCountryCode(const string16& country, | |
| 35 const std::string& locale); | |
| 36 | |
| 37 // Returns the application locale. | |
| 38 // The first time this is called, it should be called from the UI thread. | |
| 39 // Once [ http://crbug.com/100845 ] is fixed, this method should *only* be | |
| 40 // called from the UI thread. | |
| 41 static const std::string ApplicationLocale(); | |
| 42 | |
| 43 const std::string country_code() const { return country_code_; } | |
| 44 const string16 name() const { return name_; } | |
| 45 const string16 postal_code_label() const { return postal_code_label_; } | |
| 46 const string16 state_label() const { return state_label_; } | |
| 47 | |
| 48 private: | |
| 49 AutofillCountry(const std::string& country_code, | |
| 50 const string16& name, | |
| 51 const string16& postal_code_label, | |
| 52 const string16& state_label); | |
| 53 | |
| 54 // The two-letter ISO-3166 country code. | |
| 55 std::string country_code_; | |
| 56 | |
| 57 // The country's name, localized to the app locale. | |
| 58 string16 name_; | |
| 59 | |
| 60 // The localized label for the postal code (or zip code) field. | |
| 61 string16 postal_code_label_; | |
| 62 | |
| 63 // The localized label for the state (or province, district, etc.) field. | |
| 64 string16 state_label_; | |
| 65 | |
| 66 DISALLOW_COPY_AND_ASSIGN(AutofillCountry); | |
| 67 }; | |
| 68 | |
| 69 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_COUNTRY_H_ | |
| OLD | NEW |