[cros] Use ScheduleSavePersistentPrefs instead of SavePersistentPrefs.

We had to use SavePersistentPref() since prefs were not saved during normal shutdown.
See http://crosbug.com/19491 which tracks that, now fixed.

Leaving SavePersistentPrefs() in WizardController and DetermineAndSaveHardwareKeyboard since those OOBE settings are very important to be saved right away and persist even if Chrome crashes.

BUG=chromium-os:20938
TEST=Manual. OOBE: switch language, reboot. Remove user, reboot.

Review URL: http://codereview.chromium.org/8341105

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107737 0039d316-1c4b-4281-b951-d872f2087c98
parent fe7074c6
......@@ -93,11 +93,7 @@ void EnableAccessibility(bool enabled, WebUI* login_web_ui) {
g_browser_process->local_state()->SetBoolean(
prefs::kAccessibilityEnabled, enabled);
// Explicitly call SavePersistentPrefs instead of ScheduleSavePersistentPrefs
// so that this change gets written immediately, in case the user shuts
// down right now. TODO(dmazzoni) switch this back to
// ScheduleSavePersistentPrefs once http://crosbug.com/19491 is fixed.
g_browser_process->local_state()->SavePersistentPrefs();
g_browser_process->local_state()->ScheduleSavePersistentPrefs();
ExtensionAccessibilityEventRouter::GetInstance()->
SetAccessibilityEnabled(enabled);
......
......@@ -122,7 +122,7 @@ bool LanguageSwitchMenu::SwitchLanguage(const std::string& locale) {
// shutdown from login screen. http://crosbug.com/20747
PrefService* prefs = g_browser_process->local_state();
prefs->SetString(prefs::kApplicationLocale, locale);
prefs->SavePersistentPrefs();
prefs->ScheduleSavePersistentPrefs();
return true;
}
......
......@@ -227,7 +227,7 @@ void UserManager::SaveImageToLocalState(const std::string& username,
new base::FundamentalValue(image_index));
images_update->SetWithoutPathExpansion(username, image_properties);
DVLOG(1) << "Saving path to user image in Local State.";
local_state->SavePersistentPrefs();
local_state->ScheduleSavePersistentPrefs();
NotifyLocalStateChanged();
content::NotificationService::current()->Notify(
......@@ -434,7 +434,7 @@ void UserManager::UserLoggedIn(const std::string& email) {
logged_in_user_ = *it;
}
}
prefs->SavePersistentPrefs();
prefs->ScheduleSavePersistentPrefs();
NotifyOnLogin();
if (current_user_is_new_) {
SetDefaultUserImage(email);
......@@ -518,7 +518,7 @@ void UserManager::RemoveUserFromList(const std::string& email) {
prefs_oauth_update->GetIntegerWithoutPathExpansion(email, &oauth_status);
prefs_oauth_update->RemoveWithoutPathExpansion(email, NULL);
prefs->SavePersistentPrefs();
prefs->ScheduleSavePersistentPrefs();
int default_image_id = kDefaultImagesCount;
if (!IsDefaultImagePath(image_path_string, &default_image_id)) {
......@@ -600,7 +600,7 @@ void UserManager::SaveUserOAuthStatus(const std::string& username,
oauth_status_update->SetWithoutPathExpansion(username,
new base::FundamentalValue(static_cast<int>(oauth_token_status)));
DVLOG(1) << "Saving user OAuth token status in Local State.";
local_state->SavePersistentPrefs();
local_state->ScheduleSavePersistentPrefs();
}
UserManager::OAuthTokenStatus UserManager::GetUserOAuthStatus(
......
......@@ -433,7 +433,7 @@ void InputMethodMenu::PreferenceUpdateNeeded(
if (g_browser_process && g_browser_process->local_state()) {
g_browser_process->local_state()->SetString(
language_prefs::kPreferredKeyboardLayout, current_input_method.id());
g_browser_process->local_state()->SavePersistentPrefs();
g_browser_process->local_state()->ScheduleSavePersistentPrefs();
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment