OLD | NEW |
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 Loading... |
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 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1964 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. | 1962 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. |
1965 ProfileSyncService* old_this = this; | 1963 ProfileSyncService* old_this = this; |
1966 this->~ProfileSyncService(); | 1964 this->~ProfileSyncService(); |
1967 new(old_this) ProfileSyncService( | 1965 new(old_this) ProfileSyncService( |
1968 new ProfileSyncComponentsFactoryImpl(profile, | 1966 new ProfileSyncComponentsFactoryImpl(profile, |
1969 CommandLine::ForCurrentProcess()), | 1967 CommandLine::ForCurrentProcess()), |
1970 profile, | 1968 profile, |
1971 signin, | 1969 signin, |
1972 behavior); | 1970 behavior); |
1973 } | 1971 } |
OLD | NEW |