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

Unified Diff: chrome/browser/chromeos/login/screens/chrome_user_selection_screen.cc

Issue 483523005: Default to current UI locale when recommended locales are invalid (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months 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 | chrome/browser/chromeos/login/screens/user_selection_screen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/screens/user_selection_screen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698