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

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: Rebase + comments 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 167 }
168 168
169 void MigrateBrowserPrefs(PrefService* user_prefs, PrefService* local_state) { 169 void MigrateBrowserPrefs(PrefService* user_prefs, PrefService* local_state) {
170 // Copy pref values which have been migrated to user_prefs from local_state, 170 // Copy pref values which have been migrated to user_prefs from local_state,
171 // or remove them from local_state outright, if copying is not required. 171 // or remove them from local_state outright, if copying is not required.
172 int current_version = 172 int current_version =
173 local_state->GetInteger(prefs::kMultipleProfilePrefMigration); 173 local_state->GetInteger(prefs::kMultipleProfilePrefMigration);
174 174
175 if ((current_version & WINDOWS_PREFS) == 0) { 175 if ((current_version & WINDOWS_PREFS) == 0) {
176 // Migrate the devtools split location preference. 176 // Migrate the devtools split location preference.
177 local_state->RegisterIntegerPref(prefs::kDevToolsSplitLocation, -1); 177 local_state->RegisterIntegerPref(prefs::kDevToolsSplitLocation,
178 -1,
179 false /* don't sync pref */);
178 DCHECK(user_prefs->FindPreference(prefs::kDevToolsSplitLocation)); 180 DCHECK(user_prefs->FindPreference(prefs::kDevToolsSplitLocation));
179 if (local_state->HasPrefPath(prefs::kDevToolsSplitLocation)) { 181 if (local_state->HasPrefPath(prefs::kDevToolsSplitLocation)) {
180 user_prefs->SetInteger(prefs::kDevToolsSplitLocation, 182 user_prefs->SetInteger(prefs::kDevToolsSplitLocation,
181 local_state->GetInteger(prefs::kDevToolsSplitLocation)); 183 local_state->GetInteger(prefs::kDevToolsSplitLocation));
182 } 184 }
183 local_state->ClearPref(prefs::kDevToolsSplitLocation); 185 local_state->ClearPref(prefs::kDevToolsSplitLocation);
184 186
185 // Migrate the browser window placement preference. 187 // Migrate the browser window placement preference.
186 local_state->RegisterDictionaryPref(prefs::kBrowserWindowPlacement); 188 local_state->RegisterDictionaryPref(prefs::kBrowserWindowPlacement,
189 false /* don't sync pref */);
187 DCHECK(user_prefs->FindPreference(prefs::kBrowserWindowPlacement)); 190 DCHECK(user_prefs->FindPreference(prefs::kBrowserWindowPlacement));
188 if (local_state->HasPrefPath(prefs::kBrowserWindowPlacement)) { 191 if (local_state->HasPrefPath(prefs::kBrowserWindowPlacement)) {
189 const PrefService::Preference* pref = 192 const PrefService::Preference* pref =
190 local_state->FindPreference(prefs::kBrowserWindowPlacement); 193 local_state->FindPreference(prefs::kBrowserWindowPlacement);
191 DCHECK(pref); 194 DCHECK(pref);
192 user_prefs->Set(prefs::kBrowserWindowPlacement, *(pref->GetValue())); 195 user_prefs->Set(prefs::kBrowserWindowPlacement, *(pref->GetValue()));
193 } 196 }
194 local_state->ClearPref(prefs::kBrowserWindowPlacement); 197 local_state->ClearPref(prefs::kBrowserWindowPlacement);
195 198
196 local_state->SetInteger(prefs::kMultipleProfilePrefMigration, 199 local_state->SetInteger(prefs::kMultipleProfilePrefMigration,
197 current_version | WINDOWS_PREFS); 200 current_version | WINDOWS_PREFS);
198 } 201 }
199 } 202 }
200 203
201 } // namespace browser 204 } // namespace browser
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698