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 #pragma once |
| 8 |
| 9 #include <string> |
| 10 #include <vector> |
| 11 |
| 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 explicit AutoFillCountry(const std::string& country_code); |
| 21 |
| 22 // Returns the default country code based on the app locale. Returns "US" as a |
| 23 // fallback if no mapping from the locale is available. |
| 24 static std::string DefaultCountryCode(); |
| 25 |
| 26 // Fills |countries| with a list of the available countries. |
| 27 static void GetAvailableCountries(std::vector<AutoFillCountry>* countries); |
| 28 |
| 29 // Returns the country code corresponding to |country|, which should be a |
| 30 // localized country name. |
| 31 static std::string GetCountryCode(const string16& country); |
| 32 |
| 33 std::string country_code() const { return country_code_; } |
| 34 string16 name() const { return name_; } |
| 35 string16 postal_code_label() const { return postal_code_label_; } |
| 36 string16 state_label() const { return state_label_; } |
| 37 |
| 38 private: |
| 39 AutoFillCountry(const std::string& country_code, |
| 40 const string16& name_, |
| 41 const string16& postal_code_label_, |
| 42 const string16& state_label_); |
| 43 |
| 44 // The two-letter ISO-3166 country code. |
| 45 std::string country_code_; |
| 46 |
| 47 // The country's name, localized to the app locale. |
| 48 string16 name_; |
| 49 |
| 50 // The localized label for the postal code (or zip code) field. |
| 51 string16 postal_code_label_; |
| 52 |
| 53 // The localized label for the state (or province, district, etc.) field. |
| 54 string16 state_label_; |
| 55 }; |
| 56 |
| 57 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_COUNTRY_H_ |
OLD | NEW |