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

Unified Diff: chrome/browser/chromeos/locale_change_guard.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: rebase 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/login_utils.cc » ('j') | chrome/browser/profiles/profile.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/locale_change_guard.cc
diff --git a/chrome/browser/chromeos/locale_change_guard.cc b/chrome/browser/chromeos/locale_change_guard.cc
index fe9cf9598f57fdb455a97cba7580f9c1d656f2b9..d3b5dc6b07348cb362f765d30a8d5418d690d500 100644
--- a/chrome/browser/chromeos/locale_change_guard.cc
+++ b/chrome/browser/chromeos/locale_change_guard.cc
@@ -66,10 +66,7 @@ void LocaleChangeGuard::RevertLocaleChange(const ListValue* list) {
reverted_ = true;
UserMetrics::RecordAction(UserMetricsAction("LanguageChange_Revert"));
- tab_contents_->profile()->ChangeApplicationLocale(from_locale_, true);
- prefs->SetString(prefs::kApplicationLocaleBackup, from_locale_);
- prefs->ClearPref(prefs::kApplicationLocaleAccepted);
- prefs->ScheduleSavePersistentPrefs();
+ tab_contents_->profile()->ChangeApplicationLocale(from_locale_);
Nikita (slow) 2011/01/25 14:35:31 In this case should we clear LocaleBackup setting?
Denis Lagno 2011/01/25 15:46:43 ChangeApplicationLocale will set both kApplication
Browser* browser = Browser::GetBrowserForController(
&tab_contents_->controller(), NULL);
@@ -88,10 +85,8 @@ void LocaleChangeGuard::CheckLocaleChange(TabContents* tab_contents) {
// (1) we want to exit fast in common case when nothing should be done.
// (2) on ChromeOS this guard may be invoked for a dummy profile first time.
ProfileId cur_profile_id = tab_contents->profile()->GetRuntimeId();
- if (cur_profile_id == profile_id_) {
- // We have already checked this profile, exiting fast.
- return;
- }
+ if (cur_profile_id == profile_id_)
+ return; // We have already checked this profile, exiting fast.
profile_id_ = cur_profile_id;
std::string cur_locale = g_browser_process->GetApplicationLocale();
@@ -104,13 +99,7 @@ void LocaleChangeGuard::CheckLocaleChange(TabContents* tab_contents) {
if (prefs == NULL)
return;
- std::string to_locale = prefs->GetString(prefs::kApplicationLocaleOverride);
- if (!to_locale.empty()) {
- DCHECK(to_locale == cur_locale);
- return;
- }
-
- to_locale = prefs->GetString(prefs::kApplicationLocale);
+ std::string to_locale = prefs->GetString(prefs::kApplicationLocale);
if (to_locale != cur_locale) {
// This conditional branch can occur in case kApplicationLocale
// preference was modified by synchronization.
@@ -118,10 +107,11 @@ void LocaleChangeGuard::CheckLocaleChange(TabContents* tab_contents) {
}
std::string from_locale = prefs->GetString(prefs::kApplicationLocaleBackup);
- if (from_locale.empty() || from_locale == to_locale) {
- // No locale change was detected, just exit.
- return;
- }
+ if (from_locale.empty() || from_locale == to_locale)
+ return; // No locale change was detected, just exit.
+
+ if (prefs->GetString(prefs::kApplicationLocaleAccepted) == to_locale)
Nikita (slow) 2011/01/25 14:35:31 Could you describe case which we're optimizing her
Denis Lagno 2011/01/25 15:46:43 it is not optimization, it is double check. This c
+ return; // Already accepted.
// Locale change detected, showing notification.
from_locale_ = from_locale;
@@ -160,10 +150,6 @@ void LocaleChangeGuard::AcceptLocaleChange() {
PrefService* prefs = tab_contents_->profile()->GetPrefs();
if (prefs == NULL)
return;
- std::string override_locale =
- prefs->GetString(prefs::kApplicationLocaleOverride);
- if (!override_locale.empty())
- return;
if (prefs->GetString(prefs::kApplicationLocale) != to_locale_)
return;
UserMetrics::RecordAction(UserMetricsAction("LanguageChange_Accept"));
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/login_utils.cc » ('j') | chrome/browser/profiles/profile.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698