| 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 #include "components/autofill/core/browser/autofill_country.h" | 5 #include "components/autofill/core/browser/autofill_country.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 } | 927 } |
| 928 | 928 |
| 929 CountryNames::~CountryNames() { | 929 CountryNames::~CountryNames() { |
| 930 STLDeleteContainerPairSecondPointers(collators_.begin(), | 930 STLDeleteContainerPairSecondPointers(collators_.begin(), |
| 931 collators_.end()); | 931 collators_.end()); |
| 932 } | 932 } |
| 933 | 933 |
| 934 const std::string CountryNames::GetCountryCode(const base::string16& country, | 934 const std::string CountryNames::GetCountryCode(const base::string16& country, |
| 935 const std::string& locale) { | 935 const std::string& locale) { |
| 936 // First, check common country names, including 2- and 3-letter country codes. | 936 // First, check common country names, including 2- and 3-letter country codes. |
| 937 std::string country_utf8 = | 937 std::string country_utf8 = base::UTF16ToUTF8(StringToUpperASCII(country)); |
| 938 base::UTF16ToUTF8(base::StringToUpperASCII(country)); | |
| 939 std::map<std::string, std::string>::const_iterator result = | 938 std::map<std::string, std::string>::const_iterator result = |
| 940 common_names_.find(country_utf8); | 939 common_names_.find(country_utf8); |
| 941 if (result != common_names_.end()) | 940 if (result != common_names_.end()) |
| 942 return result->second; | 941 return result->second; |
| 943 | 942 |
| 944 // Next, check country names localized to |locale|. | 943 // Next, check country names localized to |locale|. |
| 945 std::string country_code = GetCountryCodeForLocalizedName(country, locale); | 944 std::string country_code = GetCountryCodeForLocalizedName(country, locale); |
| 946 if (!country_code.empty()) | 945 if (!country_code.empty()) |
| 947 return country_code; | 946 return country_code; |
| 948 | 947 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 const base::string16& name, | 1108 const base::string16& name, |
| 1110 const base::string16& postal_code_label, | 1109 const base::string16& postal_code_label, |
| 1111 const base::string16& state_label) | 1110 const base::string16& state_label) |
| 1112 : country_code_(country_code), | 1111 : country_code_(country_code), |
| 1113 name_(name), | 1112 name_(name), |
| 1114 postal_code_label_(postal_code_label), | 1113 postal_code_label_(postal_code_label), |
| 1115 state_label_(state_label) { | 1114 state_label_(state_label) { |
| 1116 } | 1115 } |
| 1117 | 1116 |
| 1118 } // namespace autofill | 1117 } // namespace autofill |
| OLD | NEW |