| 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/sync_prefs.h" | 5 #include "chrome/browser/sync/sync_prefs.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/prefs/pref_member.h" | 9 #include "base/prefs/pref_member.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 model_set.Put(syncer::NIGORI); | 125 model_set.Put(syncer::NIGORI); |
| 126 model_set.Put(syncer::SEARCH_ENGINES); | 126 model_set.Put(syncer::SEARCH_ENGINES); |
| 127 model_set.Put(syncer::APPS); | 127 model_set.Put(syncer::APPS); |
| 128 model_set.Put(syncer::TYPED_URLS); | 128 model_set.Put(syncer::TYPED_URLS); |
| 129 model_set.Put(syncer::SESSIONS); | 129 model_set.Put(syncer::SESSIONS); |
| 130 registry->RegisterListPref(prefs::kSyncAcknowledgedSyncTypes, | 130 registry->RegisterListPref(prefs::kSyncAcknowledgedSyncTypes, |
| 131 syncer::ModelTypeSetToValue(model_set), | 131 syncer::ModelTypeSetToValue(model_set), |
| 132 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 132 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 133 } | 133 } |
| 134 | 134 |
| 135 // static | |
| 136 bool SyncPrefs::IsSyncAccessibleOnIOThread(ProfileIOData* io_data) { | |
| 137 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | |
| 138 return ProfileSyncService::IsSyncEnabled() && | |
| 139 !io_data->sync_disabled()->GetValue(); | |
| 140 } | |
| 141 | |
| 142 void SyncPrefs::AddSyncPrefObserver(SyncPrefObserver* sync_pref_observer) { | 135 void SyncPrefs::AddSyncPrefObserver(SyncPrefObserver* sync_pref_observer) { |
| 143 DCHECK(CalledOnValidThread()); | 136 DCHECK(CalledOnValidThread()); |
| 144 sync_pref_observers_.AddObserver(sync_pref_observer); | 137 sync_pref_observers_.AddObserver(sync_pref_observer); |
| 145 } | 138 } |
| 146 | 139 |
| 147 void SyncPrefs::RemoveSyncPrefObserver(SyncPrefObserver* sync_pref_observer) { | 140 void SyncPrefs::RemoveSyncPrefObserver(SyncPrefObserver* sync_pref_observer) { |
| 148 DCHECK(CalledOnValidThread()); | 141 DCHECK(CalledOnValidThread()); |
| 149 sync_pref_observers_.RemoveObserver(sync_pref_observer); | 142 sync_pref_observers_.RemoveObserver(sync_pref_observer); |
| 150 } | 143 } |
| 151 | 144 |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 for (PrefGroupsMap::const_iterator i = pref_groups_.begin(); | 489 for (PrefGroupsMap::const_iterator i = pref_groups_.begin(); |
| 497 i != pref_groups_.end(); ++i) { | 490 i != pref_groups_.end(); ++i) { |
| 498 if (types.Has(i->first)) | 491 if (types.Has(i->first)) |
| 499 types_with_groups.PutAll(i->second); | 492 types_with_groups.PutAll(i->second); |
| 500 } | 493 } |
| 501 types_with_groups.RetainAll(registered_types); | 494 types_with_groups.RetainAll(registered_types); |
| 502 return types_with_groups; | 495 return types_with_groups; |
| 503 } | 496 } |
| 504 | 497 |
| 505 } // namespace browser_sync | 498 } // namespace browser_sync |
| OLD | NEW |