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 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 } | 921 } |
922 | 922 |
923 CountryNames::~CountryNames() { | 923 CountryNames::~CountryNames() { |
924 STLDeleteContainerPairSecondPointers(collators_.begin(), | 924 STLDeleteContainerPairSecondPointers(collators_.begin(), |
925 collators_.end()); | 925 collators_.end()); |
926 } | 926 } |
927 | 927 |
928 const std::string CountryNames::GetCountryCode(const base::string16& country, | 928 const std::string CountryNames::GetCountryCode(const base::string16& country, |
929 const std::string& locale) { | 929 const std::string& locale) { |
930 // First, check common country names, including 2- and 3-letter country codes. | 930 // First, check common country names, including 2- and 3-letter country codes. |
931 std::string country_utf8 = UTF16ToUTF8(StringToUpperASCII(country)); | 931 std::string country_utf8 = base::UTF16ToUTF8(StringToUpperASCII(country)); |
932 std::map<std::string, std::string>::const_iterator result = | 932 std::map<std::string, std::string>::const_iterator result = |
933 common_names_.find(country_utf8); | 933 common_names_.find(country_utf8); |
934 if (result != common_names_.end()) | 934 if (result != common_names_.end()) |
935 return result->second; | 935 return result->second; |
936 | 936 |
937 // Next, check country names localized to |locale|. | 937 // Next, check country names localized to |locale|. |
938 std::string country_code = GetCountryCodeForLocalizedName(country, locale); | 938 std::string country_code = GetCountryCodeForLocalizedName(country, locale); |
939 if (!country_code.empty()) | 939 if (!country_code.empty()) |
940 return country_code; | 940 return country_code; |
941 | 941 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 const base::string16& name, | 1102 const base::string16& name, |
1103 const base::string16& postal_code_label, | 1103 const base::string16& postal_code_label, |
1104 const base::string16& state_label) | 1104 const base::string16& state_label) |
1105 : country_code_(country_code), | 1105 : country_code_(country_code), |
1106 name_(name), | 1106 name_(name), |
1107 postal_code_label_(postal_code_label), | 1107 postal_code_label_(postal_code_label), |
1108 state_label_(state_label) { | 1108 state_label_(state_label) { |
1109 } | 1109 } |
1110 | 1110 |
1111 } // namespace autofill | 1111 } // namespace autofill |
OLD | NEW |