diff options
author | dilmah@chromium.org <dilmah@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-20 14:48:41 +0000 |
---|---|---|
committer | dilmah@chromium.org <dilmah@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-20 14:48:41 +0000 |
commit | a64b24b14002208b9a20574c4da7584ae9b6bb8f (patch) | |
tree | f5b28e3b3e67b853f5d0d1a7cf858574c6498fbe /chrome | |
parent | cb7126f004840ea93b601644b49f483234373eab (diff) | |
download | chromium_src-a64b24b14002208b9a20574c4da7584ae9b6bb8f.zip chromium_src-a64b24b14002208b9a20574c4da7584ae9b6bb8f.tar.gz chromium_src-a64b24b14002208b9a20574c4da7584ae9b6bb8f.tar.bz2 |
Respect synced locale settings.
BUG=chromium-os:9164
TEST=Manual
Review URL: http://codereview.chromium.org/6000001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69709 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/chromeos/login/login_utils.cc | 23 | ||||
-rw-r--r-- | chrome/browser/profiles/profile.cc | 1 | ||||
-rw-r--r-- | chrome/browser/sync/glue/data_type_manager.h | 2 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 8 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 3 |
5 files changed, 29 insertions, 8 deletions
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc index 19cf68d..82d8e13 100644 --- a/chrome/browser/chromeos/login/login_utils.cc +++ b/chrome/browser/chromeos/login/login_utils.cc @@ -332,14 +332,23 @@ void LoginUtilsImpl::FetchTokens( void LoginUtilsImpl::RespectLocalePreference(PrefService* pref) { std::string pref_locale = pref->GetString(prefs::kApplicationLocale); if (pref_locale.empty()) { - // TODO(dilmah): current code will clobber existing setting in case - // language preference was set via another device - // but still not synced yet. Profile is not synced at this point yet. - pref->SetString(prefs::kApplicationLocale, - g_browser_process->GetApplicationLocale()); - } else { - LanguageSwitchMenu::SwitchLanguage(pref_locale); + // 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; + } else { + pref_locale.swap(pref_locale_backup); + pref->SetString(prefs::kApplicationLocale, pref_locale); + } } + LanguageSwitchMenu::SwitchLanguage(pref_locale); } void LoginUtilsImpl::CompleteOffTheRecordLogin(const GURL& start_url) { diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc index 7f6a5fd..1e2bba4 100644 --- a/chrome/browser/profiles/profile.cc +++ b/chrome/browser/profiles/profile.cc @@ -109,6 +109,7 @@ void Profile::RegisterUserPrefs(PrefService* prefs) { // In the future we may want to maintain kApplicationLocale // in user's profile for other platforms as well. prefs->RegisterStringPref(prefs::kApplicationLocale, ""); + prefs->RegisterStringPref(prefs::kApplicationLocaleBackup, ""); #endif } diff --git a/chrome/browser/sync/glue/data_type_manager.h b/chrome/browser/sync/glue/data_type_manager.h index 24049f2..e904452 100644 --- a/chrome/browser/sync/glue/data_type_manager.h +++ b/chrome/browser/sync/glue/data_type_manager.h @@ -51,7 +51,7 @@ class DataTypeManager { // current state. A SYNC_CONFIGURE_START notification will be sent // to the UI thread when configuration is started and a // SYNC_CONFIGURE_DONE notification will be sent (with a - // ConfigurationResult detail) when configuration is complete. + // ConfigureResult detail) when configuration is complete. // // Note that you may call Configure() while configuration is in // progress. Configuration will be complete only when the diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 11a25fc..11203d8 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -41,7 +41,15 @@ const char kRestoreOnStartup[] = "session.restore_on_startup"; const char kURLsToRestoreOnStartup[] = "session.urls_to_restore_on_startup"; // The application locale. +// For OS_CHROMEOS we maintain kApplicationLocale property in both local state +// and user's profile. Global property determines locale of login screen, +// while user's profile determines his personal locale preference. const char kApplicationLocale[] = "intl.app_locale"; +#if defined(OS_CHROMEOS) +// Non-syncable item. Used for two-step initialization of locale in ChromeOS +// because synchronization of kApplicationLocale is not instant. +const char kApplicationLocaleBackup[] = "intl.app_locale_backup"; +#endif // The default character encoding to assume for a web page in the // absence of MIME charset specification diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 6299465..4dcaad5 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -25,6 +25,9 @@ extern const char kURLsToRestoreOnStartup[]; // and user's profile. Global property determines locale of login screen, // while user's profile determines his personal locale preference. extern const char kApplicationLocale[]; +#if defined(OS_CHROMEOS) +extern const char kApplicationLocaleBackup[]; +#endif extern const char kDefaultCharset[]; extern const char kAcceptLanguages[]; |