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/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 pref_service_->GetBoolean(prefs::kSyncKeepEverythingSynced); | 113 pref_service_->GetBoolean(prefs::kSyncKeepEverythingSynced); |
114 } | 114 } |
115 | 115 |
116 void SyncPrefs::SetKeepEverythingSynced(bool keep_everything_synced) { | 116 void SyncPrefs::SetKeepEverythingSynced(bool keep_everything_synced) { |
117 DCHECK(CalledOnValidThread()); | 117 DCHECK(CalledOnValidThread()); |
118 CHECK(pref_service_); | 118 CHECK(pref_service_); |
119 pref_service_->SetBoolean(prefs::kSyncKeepEverythingSynced, | 119 pref_service_->SetBoolean(prefs::kSyncKeepEverythingSynced, |
120 keep_everything_synced); | 120 keep_everything_synced); |
121 } | 121 } |
122 | 122 |
| 123 // TODO(akalin): If encryption is turned on for all data types, |
| 124 // history delete directives are useless and so we shouldn't bother |
| 125 // enabling them. |
| 126 |
123 syncer::ModelTypeSet SyncPrefs::GetPreferredDataTypes( | 127 syncer::ModelTypeSet SyncPrefs::GetPreferredDataTypes( |
124 syncer::ModelTypeSet registered_types) const { | 128 syncer::ModelTypeSet registered_types) const { |
125 DCHECK(CalledOnValidThread()); | 129 DCHECK(CalledOnValidThread()); |
126 if (!pref_service_) { | 130 if (!pref_service_) { |
127 return syncer::ModelTypeSet(); | 131 return syncer::ModelTypeSet(); |
128 } | 132 } |
129 | 133 |
130 // First remove any datatypes that are inconsistent with the current policies | 134 // First remove any datatypes that are inconsistent with the current policies |
131 // on the client (so that "keep everything synced" doesn't include them). | 135 // on the client (so that "keep everything synced" doesn't include them). |
132 if (pref_service_->HasPrefPath(prefs::kSavingBrowserHistoryDisabled) && | 136 if (pref_service_->HasPrefPath(prefs::kSavingBrowserHistoryDisabled) && |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 case syncer::APP_SETTINGS: | 219 case syncer::APP_SETTINGS: |
216 return prefs::kSyncAppSettings; | 220 return prefs::kSyncAppSettings; |
217 case syncer::APPS: | 221 case syncer::APPS: |
218 return prefs::kSyncApps; | 222 return prefs::kSyncApps; |
219 case syncer::SEARCH_ENGINES: | 223 case syncer::SEARCH_ENGINES: |
220 return prefs::kSyncSearchEngines; | 224 return prefs::kSyncSearchEngines; |
221 case syncer::SESSIONS: | 225 case syncer::SESSIONS: |
222 return prefs::kSyncSessions; | 226 return prefs::kSyncSessions; |
223 case syncer::APP_NOTIFICATIONS: | 227 case syncer::APP_NOTIFICATIONS: |
224 return prefs::kSyncAppNotifications; | 228 return prefs::kSyncAppNotifications; |
| 229 case syncer::HISTORY_DELETE_DIRECTIVES: |
| 230 return prefs::kSyncHistoryDeleteDirectives; |
225 default: | 231 default: |
226 break; | 232 break; |
227 } | 233 } |
228 NOTREACHED(); | 234 NOTREACHED(); |
229 return NULL; | 235 return NULL; |
230 } | 236 } |
231 | 237 |
232 #if defined(OS_CHROMEOS) | 238 #if defined(OS_CHROMEOS) |
233 std::string SyncPrefs::GetSpareBootstrapToken() const { | 239 std::string SyncPrefs::GetSpareBootstrapToken() const { |
234 DCHECK(CalledOnValidThread()); | 240 DCHECK(CalledOnValidThread()); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 if (types.Has(i->first)) | 439 if (types.Has(i->first)) |
434 types_with_groups.PutAll(i->second); | 440 types_with_groups.PutAll(i->second); |
435 else | 441 else |
436 types_with_groups.RemoveAll(i->second); | 442 types_with_groups.RemoveAll(i->second); |
437 } | 443 } |
438 types_with_groups.RetainAll(registered_types); | 444 types_with_groups.RetainAll(registered_types); |
439 return types_with_groups; | 445 return types_with_groups; |
440 } | 446 } |
441 | 447 |
442 } // namespace browser_sync | 448 } // namespace browser_sync |
OLD | NEW |