Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(646)

Unified Diff: android_webview/browser/aw_content_browser_client.cc

Issue 2496183002: Use GetDefaultLocaleListString for returning LocaleList (Closed)
Patch Set: change locales to localelist in AWContents.java Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | android_webview/browser/aw_locale_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/browser/aw_content_browser_client.cc
diff --git a/android_webview/browser/aw_content_browser_client.cc b/android_webview/browser/aw_content_browser_client.cc
index 5f695eac250afdf2930dc842556e68bf3916387b..dd9de56cd6350e59c4b4b423f122163655aeb6a2 100644
--- a/android_webview/browser/aw_content_browser_client.cc
+++ b/android_webview/browser/aw_content_browser_client.cc
@@ -158,17 +158,18 @@ AwLocaleManager* g_locale_manager = NULL;
} // anonymous namespace
+// TODO(yirui): can use similar logic as in PrependToAcceptLanguagesIfNecessary
+// in chrome/browser/android/preferences/pref_service_bridge.cc
// static
std::string AwContentBrowserClient::GetAcceptLangsImpl() {
- // Start with the current locale.
- std::string langs = g_locale_manager->GetLocale();
+ // Start with the current locale(s) in BCP47 format.
+ std::string locales_string = g_locale_manager->GetLocaleList();
- // If we're not en-US, add in en-US which will be
+ // If accept languages do not contain en-US, add in en-US which will be
// used with a lower q-value.
- if (base::ToLowerASCII(langs) != "en-us") {
- langs += ",en-US";
- }
- return langs;
+ if (locales_string.find("en-US") == std::string::npos)
+ locales_string += ",en-US";
+ return locales_string;
}
// static
« no previous file with comments | « no previous file | android_webview/browser/aw_locale_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698