Chromium Code Reviews| Index: chrome/browser/android/preferences/autofill/autofill_profile_bridge.cc |
| diff --git a/chrome/browser/android/preferences/autofill/autofill_profile_bridge.cc b/chrome/browser/android/preferences/autofill/autofill_profile_bridge.cc |
| index d284d5d06f1dce9e0da59c304057c6f9f270dabf..e052c6752781bc1508d86355f4cba8c5750e3a80 100644 |
| --- a/chrome/browser/android/preferences/autofill/autofill_profile_bridge.cc |
| +++ b/chrome/browser/android/preferences/autofill/autofill_profile_bridge.cc |
| @@ -10,6 +10,7 @@ |
| #include "base/android/jni_array.h" |
| #include "base/android/jni_string.h" |
| #include "base/bind.h" |
| +#include "base/strings/utf_string_conversions.h" |
| #include "chrome/browser/browser_process.h" |
| #include "components/autofill/core/browser/autofill_country.h" |
| #include "jni/AutofillProfileBridge_jni.h" |
| @@ -59,21 +60,25 @@ static void GetSupportedCountries(JNIEnv* env, |
| jobject j_country_name_list) { |
| std::vector<std::string> country_codes = |
| ::i18n::addressinput::GetRegionCodes(); |
| + std::vector<std::string> known_country_codes; |
| std::vector<base::string16> country_names; |
| std::string locale = g_browser_process->GetApplicationLocale(); |
| for (auto country_code : country_codes) { |
| - country_names.push_back(l10n_util::GetDisplayNameForCountry(country_code, |
| - locale)); |
| + const base::string16& country_name = |
| + l10n_util::GetDisplayNameForCountry(country_code, locale); |
| + // Don't display a country code for which a name is not known yet. |
| + if (country_name != base::UTF8ToUTF16(country_code)) { |
| + known_country_codes.push_back(country_code); |
| + country_names.push_back(country_name); |
|
newt (away)
2015/02/25 18:49:27
suggestion: renaming this to known_country_names m
please use gerrit instead
2015/02/25 19:38:00
Good idea! Done.
|
| + } |
| } |
| - Java_AutofillProfileBridge_stringArrayToList(env, |
| - ToJavaArrayOfStrings( |
| - env, country_codes).obj(), |
| - j_country_code_list); |
| - Java_AutofillProfileBridge_stringArrayToList(env, |
| - ToJavaArrayOfStrings( |
| - env, country_names).obj(), |
| - j_country_name_list); |
| + Java_AutofillProfileBridge_stringArrayToList( |
| + env, ToJavaArrayOfStrings(env, known_country_codes).obj(), |
| + j_country_code_list); |
| + Java_AutofillProfileBridge_stringArrayToList( |
| + env, ToJavaArrayOfStrings(env, country_names).obj(), |
| + j_country_name_list); |
| } |
| static jstring GetAddressUiComponents(JNIEnv* env, |