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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 pref_service_->GetBoolean(prefs::kSyncKeepEverythingSynced); | 207 pref_service_->GetBoolean(prefs::kSyncKeepEverythingSynced); |
208 } | 208 } |
209 | 209 |
210 void SyncPrefs::SetKeepEverythingSynced(bool keep_everything_synced) { | 210 void SyncPrefs::SetKeepEverythingSynced(bool keep_everything_synced) { |
211 DCHECK(CalledOnValidThread()); | 211 DCHECK(CalledOnValidThread()); |
212 CHECK(pref_service_); | 212 CHECK(pref_service_); |
213 pref_service_->SetBoolean(prefs::kSyncKeepEverythingSynced, | 213 pref_service_->SetBoolean(prefs::kSyncKeepEverythingSynced, |
214 keep_everything_synced); | 214 keep_everything_synced); |
215 } | 215 } |
216 | 216 |
217 // TODO(akalin): If encryption is turned on for all data types, | |
218 // history delete directives are useless and so we shouldn't bother | |
219 // enabling them. | |
220 | |
221 syncer::ModelTypeSet SyncPrefs::GetPreferredDataTypes( | 217 syncer::ModelTypeSet SyncPrefs::GetPreferredDataTypes( |
222 syncer::ModelTypeSet registered_types) const { | 218 syncer::ModelTypeSet registered_types) const { |
223 DCHECK(CalledOnValidThread()); | 219 DCHECK(CalledOnValidThread()); |
224 if (!pref_service_) { | 220 if (!pref_service_) { |
225 return syncer::ModelTypeSet(); | 221 return syncer::ModelTypeSet(); |
226 } | 222 } |
227 | 223 |
228 // First remove any datatypes that are inconsistent with the current policies | 224 // First remove any datatypes that are inconsistent with the current policies |
229 // on the client (so that "keep everything synced" doesn't include them). | 225 // on the client (so that "keep everything synced" doesn't include them). |
230 if (pref_service_->HasPrefPath(prefs::kSavingBrowserHistoryDisabled) && | 226 if (pref_service_->HasPrefPath(prefs::kSavingBrowserHistoryDisabled) && |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 for (PrefGroupsMap::const_iterator i = pref_groups_.begin(); | 478 for (PrefGroupsMap::const_iterator i = pref_groups_.begin(); |
483 i != pref_groups_.end(); ++i) { | 479 i != pref_groups_.end(); ++i) { |
484 if (types.Has(i->first)) | 480 if (types.Has(i->first)) |
485 types_with_groups.PutAll(i->second); | 481 types_with_groups.PutAll(i->second); |
486 } | 482 } |
487 types_with_groups.RetainAll(registered_types); | 483 types_with_groups.RetainAll(registered_types); |
488 return types_with_groups; | 484 return types_with_groups; |
489 } | 485 } |
490 | 486 |
491 } // namespace browser_sync | 487 } // namespace browser_sync |
OLD | NEW |