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

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

Issue 5976005: show notification on locale change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: infobar -> SystemNotification 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 708f2e4ba98b9ca6235ca34bf02197bcad872a6c..8ab5fbd3272ebb943b9ec6b32131813f955f3e2d 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -330,25 +330,51 @@ void LoginUtilsImpl::FetchTokens(
}
void LoginUtilsImpl::RespectLocalePreference(PrefService* pref) {
+ std::string pref_locale_override =
whywhat 2011/01/12 16:33:16 Add DCHECK for pref?
Denis Lagno 2011/01/12 20:27:34 Done.
+ pref->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 = pref->GetString(prefs::kApplicationLocale);
- if (pref_locale.empty()) {
- // 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 =
- pref->GetString(prefs::kApplicationLocaleBackup);
- if (pref_locale_backup.empty()) {
- pref->SetString(prefs::kApplicationLocaleBackup,
- g_browser_process->GetApplicationLocale());
- return;
+ if (!pref_locale.empty()) {
+ if (pref->GetString(prefs::kApplicationLocaleAccepted) == pref_locale) {
+ // If locale is accepted then we do not want to show LocaleChangeInfoBar.
whywhat 2011/01/12 16:33:16 Info Bar -> notification?
Denis Lagno 2011/01/12 20:27:34 Done.
+ // LocaleChangeInfoBar is triggered by different values of
+ // kApplicationLocaleBackup and kApplicationLocale preferences,
+ // so make them identical.
+ pref->SetString(prefs::kApplicationLocaleBackup, pref_locale);
} else {
- pref_locale.swap(pref_locale_backup);
- pref->SetString(prefs::kApplicationLocale, pref_locale);
+ std::string pref_locale_backup =
+ pref->GetString(prefs::kApplicationLocaleBackup);
+ if (pref_locale_backup != cur_locale) {
+ if (pref_locale_backup == pref_locale || pref_locale_backup.empty()) {
+ pref->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 =
+ pref->GetString(prefs::kApplicationLocaleBackup);
+ pref->SetString(prefs::kApplicationLocaleBackup, cur_locale);
+ pref->ScheduleSavePersistentPrefs();
+ if (!pref_locale_backup.empty()) {
+ pref->SetString(prefs::kApplicationLocale, pref_locale_backup);
+ pref->ScheduleSavePersistentPrefs();
+ LanguageSwitchMenu::SwitchLanguage(pref_locale_backup);
}
- LanguageSwitchMenu::SwitchLanguage(pref_locale);
}
void LoginUtilsImpl::CompleteOffTheRecordLogin(const GURL& start_url) {

Powered by Google App Engine
This is Rietveld 408576698