| 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 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 UErrorCode error_ignored = U_ZERO_ERROR; | 49 UErrorCode error_ignored = U_ZERO_ERROR; |
| 50 uloc_addLikelySubtags(locale.c_str(), | 50 uloc_addLikelySubtags(locale.c_str(), |
| 51 base::WriteInto(&likely_locale, kLocaleCapacity), | 51 base::WriteInto(&likely_locale, kLocaleCapacity), |
| 52 kLocaleCapacity, | 52 kLocaleCapacity, |
| 53 &error_ignored); | 53 &error_ignored); |
| 54 | 54 |
| 55 // Extract the country code. | 55 // Extract the country code. |
| 56 std::string country_code = icu::Locale(likely_locale.c_str()).getCountry(); | 56 std::string country_code = icu::Locale(likely_locale.c_str()).getCountry(); |
| 57 | 57 |
| 58 // Default to the United States if we have no better guess. | 58 // Default to the United States if we have no better guess. |
| 59 if (!ContainsValue(CountryDataMap::GetInstance()->country_codes(), | 59 if (!base::ContainsValue(CountryDataMap::GetInstance()->country_codes(), |
| 60 country_code)) { | 60 country_code)) { |
| 61 return "US"; | 61 return "US"; |
| 62 } | 62 } |
| 63 | 63 |
| 64 return country_code; | 64 return country_code; |
| 65 } | 65 } |
| 66 | 66 |
| 67 AutofillCountry::AutofillCountry(const std::string& country_code, | 67 AutofillCountry::AutofillCountry(const std::string& country_code, |
| 68 const base::string16& name, | 68 const base::string16& name, |
| 69 const base::string16& postal_code_label, | 69 const base::string16& postal_code_label, |
| 70 const base::string16& state_label) | 70 const base::string16& state_label) |
| 71 : country_code_(country_code), | 71 : country_code_(country_code), |
| 72 name_(name), | 72 name_(name), |
| 73 postal_code_label_(postal_code_label), | 73 postal_code_label_(postal_code_label), |
| 74 state_label_(state_label) { | 74 state_label_(state_label) { |
| 75 } | 75 } |
| 76 | 76 |
| 77 } // namespace autofill | 77 } // namespace autofill |
| OLD | NEW |