Index: chrome/browser/chromeos/login/screens/chrome_user_selection_screen.cc |
diff --git a/chrome/browser/chromeos/login/screens/chrome_user_selection_screen.cc b/chrome/browser/chromeos/login/screens/chrome_user_selection_screen.cc |
index 4eecbd97ca22f54944e4b5c9eb7ba08dbcd64749..ac58a0d9e71e1e38bd6a1673c29698ebf50110db 100644 |
--- a/chrome/browser/chromeos/login/screens/chrome_user_selection_screen.cc |
+++ b/chrome/browser/chromeos/login/screens/chrome_user_selection_screen.cc |
@@ -170,13 +170,15 @@ void ChromeUserSelectionScreen::SetPublicSessionLocales( |
// Construct the list of available locales. This list consists of the |
// recommended locales, followed by all others. |
- scoped_ptr<base::ListValue> locales = |
+ scoped_ptr<base::ListValue> available_locales = |
GetUILanguageList(recommended_locales, std::string()); |
- // Set the initially selected locale. If the list of recommended locales is |
- // not empty, select its first entry. Otherwise, select the current UI locale. |
- const std::string& default_locale = recommended_locales->empty() ? |
- g_browser_process->GetApplicationLocale() : recommended_locales->front(); |
+ // Set the initially selected locale to the first recommended locale that is |
+ // actually available or the current UI locale if none of them are available. |
+ const std::string default_locale = FindMostRelevantLocale( |
+ recommended_locales, |
+ *available_locales.get(), |
+ g_browser_process->GetApplicationLocale()); |
// Set a flag to indicate whether the list of recommended locales contains at |
// least two entries. This is used to decide whether the public session pod |
@@ -186,7 +188,7 @@ void ChromeUserSelectionScreen::SetPublicSessionLocales( |
// Notify the UI. |
handler_->SetPublicSessionLocales(user_id, |
- locales.Pass(), |
+ available_locales.Pass(), |
default_locale, |
two_or_more_recommended_locales); |
} |