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

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

Issue 5915006: Remove user-related data from local_state and add to user_preferences, i... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: svn pset Created 9 years, 11 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "chrome/browser/search_engines/template_url_model.h" 47 #include "chrome/browser/search_engines/template_url_model.h"
48 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" 48 #include "chrome/browser/search_engines/template_url_prepopulate_data.h"
49 #include "chrome/browser/ssl/ssl_manager.h" 49 #include "chrome/browser/ssl/ssl_manager.h"
50 #include "chrome/browser/sync/signin_manager.h" 50 #include "chrome/browser/sync/signin_manager.h"
51 #include "chrome/browser/tab_contents/tab_contents.h" 51 #include "chrome/browser/tab_contents/tab_contents.h"
52 #include "chrome/browser/tabs/pinned_tab_codec.h" 52 #include "chrome/browser/tabs/pinned_tab_codec.h"
53 #include "chrome/browser/task_manager/task_manager.h" 53 #include "chrome/browser/task_manager/task_manager.h"
54 #include "chrome/browser/translate/translate_prefs.h" 54 #include "chrome/browser/translate/translate_prefs.h"
55 #include "chrome/browser/ui/browser.h" 55 #include "chrome/browser/ui/browser.h"
56 #include "chrome/browser/upgrade_detector.h" 56 #include "chrome/browser/upgrade_detector.h"
57 #include "chrome/common/pref_names.h"
57 58
58 #if defined(TOOLKIT_VIEWS) // TODO(port): whittle this down as we port 59 #if defined(TOOLKIT_VIEWS) // TODO(port): whittle this down as we port
59 #include "chrome/browser/ui/views/browser_actions_container.h" 60 #include "chrome/browser/ui/views/browser_actions_container.h"
60 #include "chrome/browser/ui/views/frame/browser_view.h" 61 #include "chrome/browser/ui/views/frame/browser_view.h"
61 #endif 62 #endif
62 63
63 #if defined(TOOLKIT_GTK) 64 #if defined(TOOLKIT_GTK)
64 #include "chrome/browser/gtk/browser_window_gtk.h" 65 #include "chrome/browser/gtk/browser_window_gtk.h"
65 #endif 66 #endif
66 67
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 #if defined(OS_CHROMEOS) 149 #if defined(OS_CHROMEOS)
149 chromeos::Preferences::RegisterUserPrefs(user_prefs); 150 chromeos::Preferences::RegisterUserPrefs(user_prefs);
150 #endif 151 #endif
151 BackgroundContentsService::RegisterUserPrefs(user_prefs); 152 BackgroundContentsService::RegisterUserPrefs(user_prefs);
152 SigninManager::RegisterUserPrefs(user_prefs); 153 SigninManager::RegisterUserPrefs(user_prefs);
153 TemplateURLModel::RegisterUserPrefs(user_prefs); 154 TemplateURLModel::RegisterUserPrefs(user_prefs);
154 InstantController::RegisterUserPrefs(user_prefs); 155 InstantController::RegisterUserPrefs(user_prefs);
155 NetPrefObserver::RegisterPrefs(user_prefs); 156 NetPrefObserver::RegisterPrefs(user_prefs);
156 } 157 }
157 158
159 void ClearObsoletePrefs(PrefService* user_prefs, PrefService* local_state) {
160 // Remove prefs which have been moved to user_prefs from local_state.
161 int current_version =
162 user_prefs->GetInteger(prefs::kMultipleProfilePrefMigration);
163 switch (current_version) {
164 case 0:
165 // Remove the dns preferences.
166 local_state->RegisterListPref(prefs::kDnsStartupPrefetchList);
167 local_state->RegisterListPref(prefs::kDnsHostReferralList);
168 local_state->ClearPref(prefs::kDnsStartupPrefetchList);
169 local_state->ClearPref(prefs::kDnsHostReferralList);
170 // FALL THROUGH
171
172 case 1:
173 // Remove the devtools preference.
174 local_state->RegisterIntegerPref(prefs::kDevToolsSplitLocation, -1);
175 local_state->ClearPref(prefs::kDevToolsSplitLocation);
176
177 // Remove the browser preferences.
178 local_state->RegisterDictionaryPref(prefs::kBrowserWindowPlacement);
179 local_state->ClearPref(prefs::kBrowserWindowPlacement);
180 // FALL THROUGH
181
182 // In the last case, set the new state of the preferences migration.
183 user_prefs->SetInteger(prefs::kMultipleProfilePrefMigration, 2);
184 }
185 }
186
158 } // namespace browser 187 } // namespace browser
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698