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

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

Powered by Google App Engine
This is Rietveld 408576698