Index: chrome/browser/android/preferences/pref_service_bridge.cc |
diff --git a/chrome/browser/android/preferences/pref_service_bridge.cc b/chrome/browser/android/preferences/pref_service_bridge.cc |
index dcb62ecb3e2f0dececb066ad88d6fb0b7ae33d40..4a0de4305c09919f435e380296ea88a63eccf24e 100644 |
--- a/chrome/browser/android/preferences/pref_service_bridge.cc |
+++ b/chrome/browser/android/preferences/pref_service_bridge.cc |
@@ -1138,7 +1138,7 @@ void PrefServiceBridge::PrependToAcceptLanguagesIfNecessary( |
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
std::set<std::string> seen_tags; |
- std::vector<std::pair<std::string, std::string>> unique_locale_list; |
+ std::vector<std::string> unique_locale_list; |
for (const std::string& locale_str : locale_list) { |
char locale_ID[ULOC_FULLNAME_CAPACITY] = {}; |
char language_code_buffer[ULOC_LANG_CAPACITY] = {}; |
@@ -1176,29 +1176,13 @@ void PrefServiceBridge::PrependToAcceptLanguagesIfNecessary( |
continue; |
seen_tags.insert(language_tag); |
- unique_locale_list.push_back(std::make_pair(language_code, country_code)); |
- } |
- |
- // If language is not in the accept languages list, also add language |
- // code. A language code should only be inserted after the last |
- // languageTag that contains that language. |
- // This will work with the IDS_ACCEPT_LANGUAGE localized strings bundled |
- // with Chrome but may fail on arbitrary lists of language tags due to |
- // differences in case and whitespace. |
- std::set<std::string> seen_languages; |
- std::vector<std::string> output_list; |
- for (auto it = unique_locale_list.rbegin(); it != unique_locale_list.rend(); |
- ++it) { |
- if (seen_languages.find(it->first) == seen_languages.end()) { |
- output_list.push_back(it->first); |
- seen_languages.insert(it->first); |
+ if (!country_code.empty()) { |
+ unique_locale_list.push_back(language_tag); |
+ } else { |
+ unique_locale_list.push_back(language_code); |
} |
- if (!it->second.empty()) |
- output_list.push_back(it->first + "-" + it->second); |
} |
- |
- std::reverse(output_list.begin(), output_list.end()); |
- *accept_languages = base::JoinString(output_list, ","); |
+ *accept_languages = base::JoinString(unique_locale_list, ","); |
} |
// static |