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 1a6a57fc5f8f056e169957621d366df714e40a0c..8d3107ef0d0a19e221f542a267f03c64f1c3314f 100644 |
--- a/chrome/browser/android/preferences/pref_service_bridge.cc |
+++ b/chrome/browser/android/preferences/pref_service_bridge.cc |
@@ -1136,7 +1136,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] = {}; |
@@ -1174,29 +1174,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 |