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

Side by Side Diff: chrome/browser/prefs/browser_prefs.cc

Issue 6905044: Refactor preference syncing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review Created 9 years, 7 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/prefs/browser_prefs.h" 5 #include "chrome/browser/prefs/browser_prefs.h"
6 6
7 #include "chrome/browser/about_flags.h" 7 #include "chrome/browser/about_flags.h"
8 #include "chrome/browser/autofill/autofill_manager.h" 8 #include "chrome/browser/autofill/autofill_manager.h"
9 #include "chrome/browser/background_contents_service.h" 9 #include "chrome/browser/background_contents_service.h"
10 #include "chrome/browser/background_mode_manager.h" 10 #include "chrome/browser/background_mode_manager.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } 169 }
170 170
171 void MigrateBrowserPrefs(PrefService* user_prefs, PrefService* local_state) { 171 void MigrateBrowserPrefs(PrefService* user_prefs, PrefService* local_state) {
172 // Copy pref values which have been migrated to user_prefs from local_state, 172 // Copy pref values which have been migrated to user_prefs from local_state,
173 // or remove them from local_state outright, if copying is not required. 173 // or remove them from local_state outright, if copying is not required.
174 int current_version = 174 int current_version =
175 local_state->GetInteger(prefs::kMultipleProfilePrefMigration); 175 local_state->GetInteger(prefs::kMultipleProfilePrefMigration);
176 176
177 if ((current_version & WINDOWS_PREFS) == 0) { 177 if ((current_version & WINDOWS_PREFS) == 0) {
178 // Migrate the devtools split location preference. 178 // Migrate the devtools split location preference.
179 local_state->RegisterIntegerPref(prefs::kDevToolsSplitLocation, -1); 179 local_state->RegisterIntegerPref(prefs::kDevToolsSplitLocation,
180 -1,
181 false /* don't sync pref */);
180 DCHECK(user_prefs->FindPreference(prefs::kDevToolsSplitLocation)); 182 DCHECK(user_prefs->FindPreference(prefs::kDevToolsSplitLocation));
181 if (local_state->HasPrefPath(prefs::kDevToolsSplitLocation)) { 183 if (local_state->HasPrefPath(prefs::kDevToolsSplitLocation)) {
182 user_prefs->SetInteger(prefs::kDevToolsSplitLocation, 184 user_prefs->SetInteger(prefs::kDevToolsSplitLocation,
183 local_state->GetInteger(prefs::kDevToolsSplitLocation)); 185 local_state->GetInteger(prefs::kDevToolsSplitLocation));
184 } 186 }
185 local_state->ClearPref(prefs::kDevToolsSplitLocation); 187 local_state->ClearPref(prefs::kDevToolsSplitLocation);
186 188
187 // Migrate the browser window placement preference. 189 // Migrate the browser window placement preference.
188 local_state->RegisterDictionaryPref(prefs::kBrowserWindowPlacement); 190 local_state->RegisterDictionaryPref(prefs::kBrowserWindowPlacement,
191 false /* don't sync pref */);
189 DCHECK(user_prefs->FindPreference(prefs::kBrowserWindowPlacement)); 192 DCHECK(user_prefs->FindPreference(prefs::kBrowserWindowPlacement));
190 if (local_state->HasPrefPath(prefs::kBrowserWindowPlacement)) { 193 if (local_state->HasPrefPath(prefs::kBrowserWindowPlacement)) {
191 const PrefService::Preference* pref = 194 const PrefService::Preference* pref =
192 local_state->FindPreference(prefs::kBrowserWindowPlacement); 195 local_state->FindPreference(prefs::kBrowserWindowPlacement);
193 DCHECK(pref); 196 DCHECK(pref);
194 user_prefs->Set(prefs::kBrowserWindowPlacement, *(pref->GetValue())); 197 user_prefs->Set(prefs::kBrowserWindowPlacement, *(pref->GetValue()));
195 } 198 }
196 local_state->ClearPref(prefs::kBrowserWindowPlacement); 199 local_state->ClearPref(prefs::kBrowserWindowPlacement);
197 200
198 local_state->SetInteger(prefs::kMultipleProfilePrefMigration, 201 local_state->SetInteger(prefs::kMultipleProfilePrefMigration,
199 current_version | WINDOWS_PREFS); 202 current_version | WINDOWS_PREFS);
200 } 203 }
201 } 204 }
202 205
203 } // namespace browser 206 } // namespace browser
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698