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