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

Unified Diff: chrome/browser/chromeos/login/login_utils.cc

Issue 6248017: Do not use local override for language settings: always sync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: bs removed Created 9 years, 11 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
Index: chrome/browser/chromeos/login/login_utils.cc
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc
index 42a03ed64495fcffd9929f922dcfc117231627ed..e9032fb991078093758acc40c89c081516dccbeb 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -155,7 +155,7 @@ class LoginUtilsImpl : public LoginUtils {
private:
// Check user's profile for kApplicationLocale setting.
- void RespectLocalePreference(PrefService* pref);
+ void RespectLocalePreference(Profile* pref);
// Indicates if DoBrowserLaunch will actually launch the browser or not.
bool browser_launch_enabled_;
@@ -309,7 +309,7 @@ void LoginUtilsImpl::CompleteLogin(
}
btl->AddLoginTimeMarker("TPMOwned", false);
- RespectLocalePreference(profile->GetPrefs());
+ RespectLocalePreference(profile);
if (first_login) {
SetFirstLoginPrefs(profile->GetPrefs());
@@ -354,53 +354,21 @@ void LoginUtilsImpl::FetchTokens(
}
}
-void LoginUtilsImpl::RespectLocalePreference(PrefService* prefs) {
+void LoginUtilsImpl::RespectLocalePreference(Profile* profile) {
+ DCHECK(profile != NULL);
+ PrefService* prefs = profile->GetPrefs();
DCHECK(prefs != NULL);
- std::string pref_locale_override =
- prefs->GetString(prefs::kApplicationLocaleOverride);
- if (!pref_locale_override.empty()) {
- LanguageSwitchMenu::SwitchLanguage(pref_locale_override);
- return;
- }
-
if (g_browser_process == NULL)
return;
- std::string cur_locale = g_browser_process->GetApplicationLocale();
std::string pref_locale = prefs->GetString(prefs::kApplicationLocale);
- if (!pref_locale.empty()) {
- if (prefs->GetString(prefs::kApplicationLocaleAccepted) == pref_locale) {
- // If locale is accepted then we do not want to show LocaleChange
- // notification. This notification is triggered by different values of
- // kApplicationLocaleBackup and kApplicationLocale preferences,
- // so make them identical.
- prefs->SetString(prefs::kApplicationLocaleBackup, pref_locale);
- } else {
- std::string pref_locale_backup =
- prefs->GetString(prefs::kApplicationLocaleBackup);
- if (pref_locale_backup != cur_locale) {
- if (pref_locale_backup == pref_locale || pref_locale_backup.empty()) {
- prefs->SetString(prefs::kApplicationLocaleBackup, cur_locale);
- }
- }
- }
- LanguageSwitchMenu::SwitchLanguage(pref_locale);
- return;
- }
- // Profile synchronization takes time and is not completed at that moment
- // at first login. So we initialize locale preference in steps:
- // (1) first save it to temporary backup;
- // (2) on next login we assume that synchronization is already completed
- // and we may finalize initialization.
- std::string pref_locale_backup =
- prefs->GetString(prefs::kApplicationLocaleBackup);
- prefs->SetString(prefs::kApplicationLocaleBackup, cur_locale);
- prefs->ScheduleSavePersistentPrefs();
- if (!pref_locale_backup.empty()) {
- prefs->SetString(prefs::kApplicationLocale, pref_locale_backup);
- prefs->ScheduleSavePersistentPrefs();
- LanguageSwitchMenu::SwitchLanguage(pref_locale_backup);
- }
+ if (pref_locale.empty())
+ pref_locale = prefs->GetString(prefs::kApplicationLocaleBackup);
+ if (pref_locale.empty())
+ pref_locale = g_browser_process->GetApplicationLocale();
+ DCHECK(!pref_locale.empty());
+ profile->ChangeAppLocale(pref_locale, Profile::APP_LOCALE_CHANGED_VIA_LOGIN);
+ LanguageSwitchMenu::SwitchLanguage(pref_locale);
}
void LoginUtilsImpl::CompleteOffTheRecordLogin(const GURL& start_url) {
« no previous file with comments | « chrome/browser/chromeos/locale_change_guard.cc ('k') | chrome/browser/dom_ui/options/language_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698