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

Side by Side Diff: chrome/browser/sync/profile_sync_service.cc

Issue 12315053: Fix prefs registration in SyncPrefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment change. Created 7 years, 10 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/sync/profile_sync_service.h" 5 #include "chrome/browser/sync/profile_sync_service.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 return; 243 return;
244 244
245 // There was a bug where OnUserChoseDatatypes was not properly called on 245 // There was a bug where OnUserChoseDatatypes was not properly called on
246 // configuration (see crbug.com/154940). We detect this by checking whether 246 // configuration (see crbug.com/154940). We detect this by checking whether
247 // kSyncKeepEverythingSynced has a default value. If so, and sync setup has 247 // kSyncKeepEverythingSynced has a default value. If so, and sync setup has
248 // completed, it means sync was not properly configured, so we manually 248 // completed, it means sync was not properly configured, so we manually
249 // set kSyncKeepEverythingSynced. 249 // set kSyncKeepEverythingSynced.
250 PrefService* const pref_service = profile_->GetPrefs(); 250 PrefService* const pref_service = profile_->GetPrefs();
251 if (!pref_service) 251 if (!pref_service)
252 return; 252 return;
253 if (sync_prefs_.HasKeepEverythingSynced())
254 return;
255 const syncer::ModelTypeSet registered_types = GetRegisteredDataTypes(); 253 const syncer::ModelTypeSet registered_types = GetRegisteredDataTypes();
256 if (sync_prefs_.GetPreferredDataTypes(registered_types).Size() > 1) 254 if (sync_prefs_.GetPreferredDataTypes(registered_types).Size() > 1)
257 return; 255 return;
258 256
259 const PrefService::Preference* keep_everything_synced = 257 const PrefService::Preference* keep_everything_synced =
260 pref_service->FindPreference(prefs::kSyncKeepEverythingSynced); 258 pref_service->FindPreference(prefs::kSyncKeepEverythingSynced);
261 // This will be false if the preference was properly set or if it's controlled 259 // This will be false if the preference was properly set or if it's controlled
262 // by policy. 260 // by policy.
263 if (!keep_everything_synced->IsDefaultValue()) 261 if (!keep_everything_synced->IsDefaultValue())
264 return; 262 return;
(...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru. 1972 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru.
1975 ProfileSyncService* old_this = this; 1973 ProfileSyncService* old_this = this;
1976 this->~ProfileSyncService(); 1974 this->~ProfileSyncService();
1977 new(old_this) ProfileSyncService( 1975 new(old_this) ProfileSyncService(
1978 new ProfileSyncComponentsFactoryImpl(profile, 1976 new ProfileSyncComponentsFactoryImpl(profile,
1979 CommandLine::ForCurrentProcess()), 1977 CommandLine::ForCurrentProcess()),
1980 profile, 1978 profile,
1981 signin, 1979 signin,
1982 behavior); 1980 behavior);
1983 } 1981 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698