OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_COUNTRY_NAMES_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_COUNTRY_NAMES_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_COUNTRY_NAMES_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_COUNTRY_NAMES_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 15 matching lines...) Expand all Loading... |
26 // corresponding country codes. | 26 // corresponding country codes. |
27 class CountryNames { | 27 class CountryNames { |
28 public: | 28 public: |
29 // The first call to this function, causing the creation of CountryNames, | 29 // The first call to this function, causing the creation of CountryNames, |
30 // is expensive. | 30 // is expensive. |
31 static CountryNames* GetInstance(); | 31 static CountryNames* GetInstance(); |
32 | 32 |
33 // Tells CountryNames, what is the application locale. Only the first supplied | 33 // Tells CountryNames, what is the application locale. Only the first supplied |
34 // value is used, further calls result in no changes. Call this on the UI | 34 // value is used, further calls result in no changes. Call this on the UI |
35 // thread, before first using CountryNames. |locale| must not be empty. | 35 // thread, before first using CountryNames. |locale| must not be empty. |
36 static void SetLocaleString(std::string locale); | 36 static void SetLocaleString(const std::string& locale); |
37 | 37 |
38 // Returns the country code corresponding to |country|, which should be a | 38 // Returns the country code corresponding to |country|, which should be a |
39 // country code or country name localized to |locale_name|. | 39 // country code or country name localized to |locale_name|. |
40 const std::string GetCountryCode(const base::string16& country); | 40 const std::string GetCountryCode(const base::string16& country); |
41 | 41 |
42 protected: | 42 protected: |
43 // Create CountryNames for |locale_name|. Protected for testing. | 43 // Create CountryNames for |locale_name|. Protected for testing. |
44 explicit CountryNames(const std::string& locale_name); | 44 explicit CountryNames(const std::string& locale_name); |
45 | 45 |
46 // Protected for testing. | 46 // Protected for testing. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // The same as |localized_names_| but for the "en_US" locale. Empty if | 87 // The same as |localized_names_| but for the "en_US" locale. Empty if |
88 // "en_US" is the application locale already. | 88 // "en_US" is the application locale already. |
89 const std::map<std::string, std::string> default_localized_names_; | 89 const std::map<std::string, std::string> default_localized_names_; |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(CountryNames); | 91 DISALLOW_COPY_AND_ASSIGN(CountryNames); |
92 }; | 92 }; |
93 | 93 |
94 } // namespace autofill | 94 } // namespace autofill |
95 | 95 |
96 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_COUNTRY_NAMES_H_ | 96 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_COUNTRY_NAMES_H_ |
OLD | NEW |