summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/login/login_utils.cc23
-rw-r--r--chrome/browser/profiles/profile.cc1
-rw-r--r--chrome/browser/sync/glue/data_type_manager.h2
-rw-r--r--chrome/common/pref_names.cc8
-rw-r--r--chrome/common/pref_names.h3
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[];