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 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 } | 930 } |
931 | 931 |
932 CountryNames::~CountryNames() { | 932 CountryNames::~CountryNames() { |
933 STLDeleteContainerPairSecondPointers(collators_.begin(), | 933 STLDeleteContainerPairSecondPointers(collators_.begin(), |
934 collators_.end()); | 934 collators_.end()); |
935 } | 935 } |
936 | 936 |
937 const std::string CountryNames::GetCountryCode(const base::string16& country, | 937 const std::string CountryNames::GetCountryCode(const base::string16& country, |
938 const std::string& locale) { | 938 const std::string& locale) { |
939 // First, check common country names, including 2- and 3-letter country codes. | 939 // First, check common country names, including 2- and 3-letter country codes. |
940 std::string country_utf8 = base::UTF16ToUTF8(StringToUpperASCII(country)); | 940 std::string country_utf8 = base::UTF16ToUTF8( |
| 941 base::StringToUpperASCII(country)); |
941 std::map<std::string, std::string>::const_iterator result = | 942 std::map<std::string, std::string>::const_iterator result = |
942 common_names_.find(country_utf8); | 943 common_names_.find(country_utf8); |
943 if (result != common_names_.end()) | 944 if (result != common_names_.end()) |
944 return result->second; | 945 return result->second; |
945 | 946 |
946 // Next, check country names localized to |locale|. | 947 // Next, check country names localized to |locale|. |
947 std::string country_code = GetCountryCodeForLocalizedName(country, locale); | 948 std::string country_code = GetCountryCodeForLocalizedName(country, locale); |
948 if (!country_code.empty()) | 949 if (!country_code.empty()) |
949 return country_code; | 950 return country_code; |
950 | 951 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 const base::string16& name, | 1112 const base::string16& name, |
1112 const base::string16& postal_code_label, | 1113 const base::string16& postal_code_label, |
1113 const base::string16& state_label) | 1114 const base::string16& state_label) |
1114 : country_code_(country_code), | 1115 : country_code_(country_code), |
1115 name_(name), | 1116 name_(name), |
1116 postal_code_label_(postal_code_label), | 1117 postal_code_label_(postal_code_label), |
1117 state_label_(state_label) { | 1118 state_label_(state_label) { |
1118 } | 1119 } |
1119 | 1120 |
1120 } // namespace autofill | 1121 } // namespace autofill |
OLD | NEW |