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 = base::UTF16ToUTF8(StringToUpperASCII(country)); | 937 std::string country_utf8 = |
| 938 base::UTF16ToUTF8(base::StringToUpperASCII(country)); |
938 std::map<std::string, std::string>::const_iterator result = | 939 std::map<std::string, std::string>::const_iterator result = |
939 common_names_.find(country_utf8); | 940 common_names_.find(country_utf8); |
940 if (result != common_names_.end()) | 941 if (result != common_names_.end()) |
941 return result->second; | 942 return result->second; |
942 | 943 |
943 // Next, check country names localized to |locale|. | 944 // Next, check country names localized to |locale|. |
944 std::string country_code = GetCountryCodeForLocalizedName(country, locale); | 945 std::string country_code = GetCountryCodeForLocalizedName(country, locale); |
945 if (!country_code.empty()) | 946 if (!country_code.empty()) |
946 return country_code; | 947 return country_code; |
947 | 948 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 const base::string16& name, | 1109 const base::string16& name, |
1109 const base::string16& postal_code_label, | 1110 const base::string16& postal_code_label, |
1110 const base::string16& state_label) | 1111 const base::string16& state_label) |
1111 : country_code_(country_code), | 1112 : country_code_(country_code), |
1112 name_(name), | 1113 name_(name), |
1113 postal_code_label_(postal_code_label), | 1114 postal_code_label_(postal_code_label), |
1114 state_label_(state_label) { | 1115 state_label_(state_label) { |
1115 } | 1116 } |
1116 | 1117 |
1117 } // namespace autofill | 1118 } // namespace autofill |
OLD | NEW |