Index: chrome/browser/chromeos/login/screens/user_selection_screen.cc |
diff --git a/chrome/browser/chromeos/login/screens/user_selection_screen.cc b/chrome/browser/chromeos/login/screens/user_selection_screen.cc |
index e96958985d4731076a09d317110efb56aebb8adb..bc79fee481a02c13be36e2e978d7a453394bab9f 100644 |
--- a/chrome/browser/chromeos/login/screens/user_selection_screen.cc |
+++ b/chrome/browser/chromeos/login/screens/user_selection_screen.cc |
@@ -4,8 +4,6 @@ |
#include "chrome/browser/chromeos/login/screens/user_selection_screen.h" |
-#include <vector> |
- |
#include "ash/shell.h" |
#include "base/location.h" |
#include "base/logging.h" |
@@ -70,19 +68,23 @@ void AddPublicSessionDetailsToUserDictionaryEntry( |
public_session_recommended_locales ? |
public_session_recommended_locales : &kEmptyRecommendedLocales; |
- // Set |kKeyInitialLocales| to the list of available locales. This list |
- // consists of the recommended locales, followed by all others. |
- user_dict->Set( |
- kKeyInitialLocales, |
- GetUILanguageList(recommended_locales, std::string()).release()); |
- |
- // Set |kKeyInitialLocale| to the initially selected locale. If the list of |
- // recommended locales is not empty, select its first entry. Otherwise, |
- // select the current UI locale. |
- user_dict->SetString(kKeyInitialLocale, |
- recommended_locales->empty() ? |
- g_browser_process->GetApplicationLocale() : |
- recommended_locales->front()); |
+ // Construct the list of available locales. This list consists of the |
+ // recommended locales, followed by all others. |
+ scoped_ptr<base::ListValue> available_locales = |
+ GetUILanguageList(recommended_locales, std::string()); |
+ |
+ // Select the the first recommended locale that is actually available or the |
+ // current UI locale if none of them are available. |
+ const std::string selected_locale = FindMostRelevantLocale( |
+ recommended_locales, |
+ *available_locales.get(), |
+ g_browser_process->GetApplicationLocale()); |
+ |
+ // Set |kKeyInitialLocales| to the list of available locales. |
+ user_dict->Set(kKeyInitialLocales, available_locales.release()); |
+ |
+ // Set |kKeyInitialLocale| to the initially selected locale. |
+ user_dict->SetString(kKeyInitialLocale, selected_locale); |
// Set |kKeyInitialMultipleRecommendedLocales| to indicate whether the list |
// of recommended locales contains at least two entries. This is used to |