Chromium Code Reviews| 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..1e2f0cb5f916fd13bafd8aacaca6ae19029b02da 100644 |
| --- a/android_webview/browser/aw_content_browser_client.cc |
| +++ b/android_webview/browser/aw_content_browser_client.cc |
| @@ -158,17 +158,20 @@ AwLocaleManager* g_locale_manager = NULL; |
| } // anonymous namespace |
| +// TODO(yirui): could use similar logic as in |
| +// PrependToAcceptLanguagesIfNecessary |
|
Bernhard Bauer
2016/11/16 16:20:07
Nit: Don't align comments on subsequent lines.
Yirui Huang
2016/11/17 02:12:53
Done.
|
| +// 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->GetLocales(); |
| - // 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; |
| + size_t found_enUS = locales_string.find("en-US"); |
|
Bernhard Bauer
2016/11/16 16:20:07
Nit: I would probably make this underscore_case, i
Yirui Huang
2016/11/17 02:12:52
Thanks, underscore looks clearer.
Now I changed i
|
| + if (found_enUS == std::string::npos) |
| + locales_string += ",en-US"; |
| + return locales_string; |
| } |
| // static |