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

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

Issue 8245018: Remove race condition when installing default apps into a new profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Reworked CL, much simpler Created 9 years, 2 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/background_mode_manager.h" 9 #include "chrome/browser/background/background_mode_manager.h"
10 #include "chrome/browser/bookmarks/bookmark_model.h" 10 #include "chrome/browser/bookmarks/bookmark_model.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 #if defined(OS_CHROMEOS) 80 #if defined(OS_CHROMEOS)
81 #include "chrome/browser/chromeos/audio_mixer_alsa.h" 81 #include "chrome/browser/chromeos/audio_mixer_alsa.h"
82 #include "chrome/browser/chromeos/customization_document.h" 82 #include "chrome/browser/chromeos/customization_document.h"
83 #include "chrome/browser/chromeos/login/signed_settings_temp_storage.h" 83 #include "chrome/browser/chromeos/login/signed_settings_temp_storage.h"
84 #include "chrome/browser/chromeos/login/user_manager.h" 84 #include "chrome/browser/chromeos/login/user_manager.h"
85 #include "chrome/browser/chromeos/login/wizard_controller.h" 85 #include "chrome/browser/chromeos/login/wizard_controller.h"
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 #else
91 #include "chrome/browser/extensions/default_apps_provider.h"
90 #endif 92 #endif
91 93
92 namespace browser { 94 namespace browser {
93 95
94 void RegisterLocalState(PrefService* local_state) { 96 void RegisterLocalState(PrefService* local_state) {
95 // Prefs in Local State 97 // Prefs in Local State
96 local_state->RegisterIntegerPref(prefs::kMultipleProfilePrefMigration, 0); 98 local_state->RegisterIntegerPref(prefs::kMultipleProfilePrefMigration, 0);
97 AppsPromo::RegisterPrefs(local_state); 99 AppsPromo::RegisterPrefs(local_state);
98 Browser::RegisterPrefs(local_state); 100 Browser::RegisterPrefs(local_state);
99 FlagsUI::RegisterPrefs(local_state); 101 FlagsUI::RegisterPrefs(local_state);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 ProtocolHandlerRegistry::RegisterPrefs(user_prefs); 179 ProtocolHandlerRegistry::RegisterPrefs(user_prefs);
178 FirewallTraversalObserver::RegisterUserPrefs(user_prefs); 180 FirewallTraversalObserver::RegisterUserPrefs(user_prefs);
179 #if defined(OS_MACOSX) 181 #if defined(OS_MACOSX)
180 PresentationModePrefs::RegisterUserPrefs(user_prefs); 182 PresentationModePrefs::RegisterUserPrefs(user_prefs);
181 #endif 183 #endif
182 #if defined(ENABLE_CONFIGURATION_POLICY) 184 #if defined(ENABLE_CONFIGURATION_POLICY)
183 policy::URLBlacklistManager::RegisterPrefs(user_prefs); 185 policy::URLBlacklistManager::RegisterPrefs(user_prefs);
184 #endif 186 #endif
185 SyncPromoUI::RegisterUserPrefs(user_prefs); 187 SyncPromoUI::RegisterUserPrefs(user_prefs);
186 chrome_browser_net::HttpServerPropertiesManager::RegisterPrefs(user_prefs); 188 chrome_browser_net::HttpServerPropertiesManager::RegisterPrefs(user_prefs);
189 #if !defined(OS_CHROMEOS)
190 DefaultAppsProvider::RegisterUserPrefs(user_prefs);
191 #endif
187 } 192 }
188 193
189 void MigrateBrowserPrefs(PrefService* user_prefs, PrefService* local_state) { 194 void MigrateBrowserPrefs(PrefService* user_prefs, PrefService* local_state) {
190 // Copy pref values which have been migrated to user_prefs from local_state, 195 // Copy pref values which have been migrated to user_prefs from local_state,
191 // or remove them from local_state outright, if copying is not required. 196 // or remove them from local_state outright, if copying is not required.
192 int current_version = 197 int current_version =
193 local_state->GetInteger(prefs::kMultipleProfilePrefMigration); 198 local_state->GetInteger(prefs::kMultipleProfilePrefMigration);
194 199
195 if ((current_version & WINDOWS_PREFS) == 0) { 200 if ((current_version & WINDOWS_PREFS) == 0) {
196 // Migrate the devtools split location preference. 201 // Migrate the devtools split location preference.
(...skipping 13 matching lines...) Expand all
210 user_prefs->Set(prefs::kBrowserWindowPlacement, *(pref->GetValue())); 215 user_prefs->Set(prefs::kBrowserWindowPlacement, *(pref->GetValue()));
211 } 216 }
212 local_state->ClearPref(prefs::kBrowserWindowPlacement); 217 local_state->ClearPref(prefs::kBrowserWindowPlacement);
213 218
214 local_state->SetInteger(prefs::kMultipleProfilePrefMigration, 219 local_state->SetInteger(prefs::kMultipleProfilePrefMigration,
215 current_version | WINDOWS_PREFS); 220 current_version | WINDOWS_PREFS);
216 } 221 }
217 } 222 }
218 223
219 } // namespace browser 224 } // namespace browser
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698