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

Side by Side Diff: chrome/browser/chromeos/locale_change_guard.cc

Issue 8198007: Remove PrefService::ScheduleSavePersistentPrefs and SavePersistentPrefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 12 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/locale_change_guard.h" 5 #include "chrome/browser/chromeos/locale_change_guard.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 if (UserManager::Get()->current_user_is_owner()) { 100 if (UserManager::Get()->current_user_is_owner()) {
101 PrefService* local_state = g_browser_process->local_state(); 101 PrefService* local_state = g_browser_process->local_state();
102 if (local_state) { 102 if (local_state) {
103 PrefService* prefs = profile_->GetPrefs(); 103 PrefService* prefs = profile_->GetPrefs();
104 if (prefs == NULL) { 104 if (prefs == NULL) {
105 NOTREACHED(); 105 NOTREACHED();
106 return; 106 return;
107 } 107 }
108 std::string owner_locale = 108 std::string owner_locale =
109 prefs->GetString(prefs::kApplicationLocale); 109 prefs->GetString(prefs::kApplicationLocale);
110 if (!owner_locale.empty()) { 110 if (!owner_locale.empty())
111 local_state->SetString(prefs::kOwnerLocale, owner_locale); 111 local_state->SetString(prefs::kOwnerLocale, owner_locale);
112 local_state->ScheduleSavePersistentPrefs();
113 }
114 } 112 }
115 } 113 }
116 break; 114 break;
117 } 115 }
118 default: { 116 default: {
119 NOTREACHED(); 117 NOTREACHED();
120 break; 118 break;
121 } 119 }
122 } 120 }
123 } 121 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 PrefService* prefs = profile_->GetPrefs(); 189 PrefService* prefs = profile_->GetPrefs();
192 if (prefs == NULL) { 190 if (prefs == NULL) {
193 NOTREACHED(); 191 NOTREACHED();
194 return; 192 return;
195 } 193 }
196 if (prefs->GetString(prefs::kApplicationLocale) != to_locale_) 194 if (prefs->GetString(prefs::kApplicationLocale) != to_locale_)
197 return; 195 return;
198 content::RecordAction(UserMetricsAction("LanguageChange_Accept")); 196 content::RecordAction(UserMetricsAction("LanguageChange_Accept"));
199 prefs->SetString(prefs::kApplicationLocaleBackup, to_locale_); 197 prefs->SetString(prefs::kApplicationLocaleBackup, to_locale_);
200 prefs->SetString(prefs::kApplicationLocaleAccepted, to_locale_); 198 prefs->SetString(prefs::kApplicationLocaleAccepted, to_locale_);
201 prefs->ScheduleSavePersistentPrefs();
202 } 199 }
203 200
204 void LocaleChangeGuard::PrepareChangingLocale( 201 void LocaleChangeGuard::PrepareChangingLocale(
205 const std::string& from_locale, const std::string& to_locale) { 202 const std::string& from_locale, const std::string& to_locale) {
206 std::string cur_locale = g_browser_process->GetApplicationLocale(); 203 std::string cur_locale = g_browser_process->GetApplicationLocale();
207 if (!from_locale.empty()) 204 if (!from_locale.empty())
208 from_locale_ = from_locale; 205 from_locale_ = from_locale;
209 if (!to_locale.empty()) 206 if (!to_locale.empty())
210 to_locale_ = to_locale; 207 to_locale_ = to_locale;
211 208
(...skipping 16 matching lines...) Expand all
228 if (by_user) 225 if (by_user)
229 master_->AcceptLocaleChange(); 226 master_->AcceptLocaleChange();
230 } 227 }
231 228
232 std::string LocaleChangeGuard::Delegate::id() const { 229 std::string LocaleChangeGuard::Delegate::id() const {
233 // Arbitrary unique Id. 230 // Arbitrary unique Id.
234 return "8c386938-1e3f-11e0-ac7b-18a90520e2e5"; 231 return "8c386938-1e3f-11e0-ac7b-18a90520e2e5";
235 } 232 }
236 233
237 } // namespace chromeos 234 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/audio_mixer_alsa.cc ('k') | chrome/browser/chromeos/login/base_login_display_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698