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

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

Issue 7670063: Move multiprofile pref migration preference. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 9 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/ui/browser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/background_contents_service.h" 9 #include "chrome/browser/background/background_contents_service.h"
10 #include "chrome/browser/background/background_mode_manager.h" 10 #include "chrome/browser/background/background_mode_manager.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 #include "chrome/browser/chromeos/preferences.h" 86 #include "chrome/browser/chromeos/preferences.h"
87 #include "chrome/browser/chromeos/status/input_method_menu.h" 87 #include "chrome/browser/chromeos/status/input_method_menu.h"
88 #include "chrome/browser/chromeos/status/network_menu_button.h" 88 #include "chrome/browser/chromeos/status/network_menu_button.h"
89 #include "chrome/browser/chromeos/user_cros_settings_provider.h" 89 #include "chrome/browser/chromeos/user_cros_settings_provider.h"
90 #endif 90 #endif
91 91
92 namespace browser { 92 namespace browser {
93 93
94 void RegisterLocalState(PrefService* local_state) { 94 void RegisterLocalState(PrefService* local_state) {
95 // Prefs in Local State 95 // Prefs in Local State
96 local_state->RegisterIntegerPref(prefs::kMultipleProfilePrefMigration, 0);
96 AppsPromo::RegisterPrefs(local_state); 97 AppsPromo::RegisterPrefs(local_state);
97 Browser::RegisterPrefs(local_state); 98 Browser::RegisterPrefs(local_state);
98 FlagsUI::RegisterPrefs(local_state); 99 FlagsUI::RegisterPrefs(local_state);
99 WebCacheManager::RegisterPrefs(local_state); 100 WebCacheManager::RegisterPrefs(local_state);
100 ExternalProtocolHandler::RegisterPrefs(local_state); 101 ExternalProtocolHandler::RegisterPrefs(local_state);
101 GoogleURLTracker::RegisterPrefs(local_state); 102 GoogleURLTracker::RegisterPrefs(local_state);
102 IntranetRedirectDetector::RegisterPrefs(local_state); 103 IntranetRedirectDetector::RegisterPrefs(local_state);
103 KeywordEditorController::RegisterPrefs(local_state); 104 KeywordEditorController::RegisterPrefs(local_state);
104 MetricsLog::RegisterPrefs(local_state); 105 MetricsLog::RegisterPrefs(local_state);
105 MetricsService::RegisterPrefs(local_state); 106 MetricsService::RegisterPrefs(local_state);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 188
188 void MigrateBrowserPrefs(PrefService* user_prefs, PrefService* local_state) { 189 void MigrateBrowserPrefs(PrefService* user_prefs, PrefService* local_state) {
189 // Copy pref values which have been migrated to user_prefs from local_state, 190 // Copy pref values which have been migrated to user_prefs from local_state,
190 // or remove them from local_state outright, if copying is not required. 191 // or remove them from local_state outright, if copying is not required.
191 int current_version = 192 int current_version =
192 local_state->GetInteger(prefs::kMultipleProfilePrefMigration); 193 local_state->GetInteger(prefs::kMultipleProfilePrefMigration);
193 194
194 if ((current_version & WINDOWS_PREFS) == 0) { 195 if ((current_version & WINDOWS_PREFS) == 0) {
195 // Migrate the devtools split location preference. 196 // Migrate the devtools split location preference.
196 local_state->RegisterIntegerPref(prefs::kDevToolsSplitLocation, -1); 197 local_state->RegisterIntegerPref(prefs::kDevToolsSplitLocation, -1);
197 DCHECK(user_prefs->FindPreference(prefs::kDevToolsSplitLocation));
198 if (local_state->HasPrefPath(prefs::kDevToolsSplitLocation)) { 198 if (local_state->HasPrefPath(prefs::kDevToolsSplitLocation)) {
199 user_prefs->SetInteger(prefs::kDevToolsSplitLocation, 199 user_prefs->SetInteger(prefs::kDevToolsSplitLocation,
200 local_state->GetInteger(prefs::kDevToolsSplitLocation)); 200 local_state->GetInteger(prefs::kDevToolsSplitLocation));
201 } 201 }
202 local_state->ClearPref(prefs::kDevToolsSplitLocation); 202 local_state->ClearPref(prefs::kDevToolsSplitLocation);
203 203
204 // Migrate the browser window placement preference. 204 // Migrate the browser window placement preference.
205 local_state->RegisterDictionaryPref(prefs::kBrowserWindowPlacement); 205 local_state->RegisterDictionaryPref(prefs::kBrowserWindowPlacement);
206 DCHECK(user_prefs->FindPreference(prefs::kBrowserWindowPlacement));
207 if (local_state->HasPrefPath(prefs::kBrowserWindowPlacement)) { 206 if (local_state->HasPrefPath(prefs::kBrowserWindowPlacement)) {
208 const PrefService::Preference* pref = 207 const PrefService::Preference* pref =
209 local_state->FindPreference(prefs::kBrowserWindowPlacement); 208 local_state->FindPreference(prefs::kBrowserWindowPlacement);
210 DCHECK(pref); 209 DCHECK(pref);
211 user_prefs->Set(prefs::kBrowserWindowPlacement, *(pref->GetValue())); 210 user_prefs->Set(prefs::kBrowserWindowPlacement, *(pref->GetValue()));
212 } 211 }
213 local_state->ClearPref(prefs::kBrowserWindowPlacement); 212 local_state->ClearPref(prefs::kBrowserWindowPlacement);
214 213
215 local_state->SetInteger(prefs::kMultipleProfilePrefMigration, 214 local_state->SetInteger(prefs::kMultipleProfilePrefMigration,
216 current_version | WINDOWS_PREFS); 215 current_version | WINDOWS_PREFS);
217 } 216 }
218 } 217 }
219 218
220 } // namespace browser 219 } // namespace browser
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698