OLD | NEW |
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 #include "chrome/browser/search_engines/template_url_model.h" | 48 #include "chrome/browser/search_engines/template_url_model.h" |
49 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 49 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
50 #include "chrome/browser/ssl/ssl_manager.h" | 50 #include "chrome/browser/ssl/ssl_manager.h" |
51 #include "chrome/browser/sync/signin_manager.h" | 51 #include "chrome/browser/sync/signin_manager.h" |
52 #include "chrome/browser/tab_contents/tab_contents.h" | 52 #include "chrome/browser/tab_contents/tab_contents.h" |
53 #include "chrome/browser/tabs/pinned_tab_codec.h" | 53 #include "chrome/browser/tabs/pinned_tab_codec.h" |
54 #include "chrome/browser/task_manager/task_manager.h" | 54 #include "chrome/browser/task_manager/task_manager.h" |
55 #include "chrome/browser/translate/translate_prefs.h" | 55 #include "chrome/browser/translate/translate_prefs.h" |
56 #include "chrome/browser/ui/browser.h" | 56 #include "chrome/browser/ui/browser.h" |
57 #include "chrome/browser/upgrade_detector.h" | 57 #include "chrome/browser/upgrade_detector.h" |
58 #include "chrome/common/pref_names.h" | |
59 | 58 |
60 #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 |
61 #include "chrome/browser/ui/views/browser_actions_container.h" | 60 #include "chrome/browser/ui/views/browser_actions_container.h" |
62 #include "chrome/browser/ui/views/frame/browser_view.h" | 61 #include "chrome/browser/ui/views/frame/browser_view.h" |
63 #endif | 62 #endif |
64 | 63 |
65 #if defined(TOOLKIT_GTK) | 64 #if defined(TOOLKIT_GTK) |
66 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 65 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
67 #endif | 66 #endif |
68 | 67 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 chromeos::Preferences::RegisterUserPrefs(user_prefs); | 152 chromeos::Preferences::RegisterUserPrefs(user_prefs); |
154 #endif | 153 #endif |
155 BackgroundContentsService::RegisterUserPrefs(user_prefs); | 154 BackgroundContentsService::RegisterUserPrefs(user_prefs); |
156 SigninManager::RegisterUserPrefs(user_prefs); | 155 SigninManager::RegisterUserPrefs(user_prefs); |
157 TemplateURLModel::RegisterUserPrefs(user_prefs); | 156 TemplateURLModel::RegisterUserPrefs(user_prefs); |
158 InstantController::RegisterUserPrefs(user_prefs); | 157 InstantController::RegisterUserPrefs(user_prefs); |
159 NetPrefObserver::RegisterPrefs(user_prefs); | 158 NetPrefObserver::RegisterPrefs(user_prefs); |
160 policy::ProfilePolicyContext::RegisterUserPrefs(user_prefs); | 159 policy::ProfilePolicyContext::RegisterUserPrefs(user_prefs); |
161 } | 160 } |
162 | 161 |
163 void MigrateBrowserPrefs(PrefService* user_prefs, PrefService* local_state) { | |
164 // Copy pref values which have been migrated to user_prefs from local_state, | |
165 // or remove them from local_state outright, if copying is not required. | |
166 int current_version = | |
167 local_state->GetInteger(prefs::kMultipleProfilePrefMigration); | |
168 | |
169 if ((current_version & WINDOWS_PREFS) == 0) { | |
170 // Migrate the devtools split location preference. | |
171 local_state->RegisterIntegerPref(prefs::kDevToolsSplitLocation, -1); | |
172 DCHECK(user_prefs->FindPreference(prefs::kDevToolsSplitLocation)); | |
173 if (local_state->HasPrefPath(prefs::kDevToolsSplitLocation)) { | |
174 user_prefs->SetInteger(prefs::kDevToolsSplitLocation, | |
175 local_state->GetInteger(prefs::kDevToolsSplitLocation)); | |
176 } | |
177 local_state->ClearPref(prefs::kDevToolsSplitLocation); | |
178 | |
179 // Migrate the browser window placement preference. | |
180 local_state->RegisterDictionaryPref(prefs::kBrowserWindowPlacement); | |
181 DCHECK(user_prefs->FindPreference(prefs::kBrowserWindowPlacement)); | |
182 if (local_state->HasPrefPath(prefs::kBrowserWindowPlacement)) { | |
183 user_prefs->Set(prefs::kBrowserWindowPlacement, | |
184 *(local_state->FindPreference(prefs::kBrowserWindowPlacement)-> | |
185 GetValue()->DeepCopy())); | |
186 } | |
187 local_state->ClearPref(prefs::kBrowserWindowPlacement); | |
188 | |
189 local_state->SetInteger(prefs::kMultipleProfilePrefMigration, | |
190 current_version | WINDOWS_PREFS); | |
191 } | |
192 } | |
193 | |
194 } // namespace browser | 162 } // namespace browser |
OLD | NEW |