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

Side by Side Diff: components/sync_driver/sync_prefs.cc

Issue 919383002: Remove some dead code about "acknowledged types" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 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
« no previous file with comments | « components/sync_driver/sync_prefs.h ('k') | components/sync_driver/sync_prefs_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/sync_driver/sync_prefs.h" 5 #include "components/sync_driver/sync_prefs.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/prefs/pref_member.h" 8 #include "base/prefs/pref_member.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 registry->RegisterBooleanPref( 114 registry->RegisterBooleanPref(
115 prefs::kSyncHasAuthError, 115 prefs::kSyncHasAuthError,
116 false, 116 false,
117 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 117 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
118 118
119 registry->RegisterStringPref( 119 registry->RegisterStringPref(
120 prefs::kSyncSessionsGUID, 120 prefs::kSyncSessionsGUID,
121 std::string(), 121 std::string(),
122 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 122 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
123 123
124 // We will start prompting people about new data types after the launch of
125 // SESSIONS - all previously launched data types are treated as if they are
126 // already acknowledged.
127 syncer::ModelTypeSet model_set;
128 model_set.Put(syncer::BOOKMARKS);
129 model_set.Put(syncer::PREFERENCES);
130 model_set.Put(syncer::PASSWORDS);
131 model_set.Put(syncer::AUTOFILL_PROFILE);
132 model_set.Put(syncer::AUTOFILL_WALLET_DATA);
133 model_set.Put(syncer::AUTOFILL);
134 model_set.Put(syncer::THEMES);
135 model_set.Put(syncer::EXTENSIONS);
136 model_set.Put(syncer::NIGORI);
137 model_set.Put(syncer::SEARCH_ENGINES);
138 model_set.Put(syncer::APPS);
139 model_set.Put(syncer::APP_LIST);
140 model_set.Put(syncer::TYPED_URLS);
141 model_set.Put(syncer::SESSIONS);
142 model_set.Put(syncer::ARTICLES);
143 model_set.Put(syncer::WIFI_CREDENTIALS);
144 registry->RegisterListPref(prefs::kSyncAcknowledgedSyncTypes,
145 syncer::ModelTypeSetToValue(model_set),
146 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
147
148 registry->RegisterIntegerPref( 124 registry->RegisterIntegerPref(
149 prefs::kSyncRemainingRollbackTries, 0, 125 prefs::kSyncRemainingRollbackTries, 0,
150 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 126 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
151 } 127 }
152 128
153 void SyncPrefs::AddSyncPrefObserver(SyncPrefObserver* sync_pref_observer) { 129 void SyncPrefs::AddSyncPrefObserver(SyncPrefObserver* sync_pref_observer) {
154 DCHECK(CalledOnValidThread()); 130 DCHECK(CalledOnValidThread());
155 sync_pref_observers_.AddObserver(sync_pref_observer); 131 sync_pref_observers_.AddObserver(sync_pref_observer);
156 } 132 }
157 133
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 DCHECK(CalledOnValidThread()); 341 DCHECK(CalledOnValidThread());
366 return pref_service_->GetString(prefs::kSyncSpareBootstrapToken); 342 return pref_service_->GetString(prefs::kSyncSpareBootstrapToken);
367 } 343 }
368 344
369 void SyncPrefs::SetSpareBootstrapToken(const std::string& token) { 345 void SyncPrefs::SetSpareBootstrapToken(const std::string& token) {
370 DCHECK(CalledOnValidThread()); 346 DCHECK(CalledOnValidThread());
371 pref_service_->SetString(prefs::kSyncSpareBootstrapToken, token); 347 pref_service_->SetString(prefs::kSyncSpareBootstrapToken, token);
372 } 348 }
373 #endif 349 #endif
374 350
375 void SyncPrefs::AcknowledgeSyncedTypes(syncer::ModelTypeSet types) {
376 DCHECK(CalledOnValidThread());
377 // Add the types to the current set of acknowledged
378 // types, and then store the resulting set in prefs.
379 const syncer::ModelTypeSet acknowledged_types =
380 Union(types,
381 syncer::ModelTypeSetFromValue(
382 *pref_service_->GetList(prefs::kSyncAcknowledgedSyncTypes)));
383
384 scoped_ptr<base::ListValue> value(
385 syncer::ModelTypeSetToValue(acknowledged_types));
386 pref_service_->Set(prefs::kSyncAcknowledgedSyncTypes, *value);
387 }
388
389 int SyncPrefs::GetRemainingRollbackTries() const { 351 int SyncPrefs::GetRemainingRollbackTries() const {
390 return pref_service_->GetInteger(prefs::kSyncRemainingRollbackTries); 352 return pref_service_->GetInteger(prefs::kSyncRemainingRollbackTries);
391 } 353 }
392 354
393 void SyncPrefs::SetRemainingRollbackTries(int times) { 355 void SyncPrefs::SetRemainingRollbackTries(int times) {
394 pref_service_->SetInteger(prefs::kSyncRemainingRollbackTries, times); 356 pref_service_->SetInteger(prefs::kSyncRemainingRollbackTries, times);
395 } 357 }
396 358
397 void SyncPrefs::OnSyncManagedPrefChanged() { 359 void SyncPrefs::OnSyncManagedPrefChanged() {
398 DCHECK(CalledOnValidThread()); 360 DCHECK(CalledOnValidThread());
399 FOR_EACH_OBSERVER(SyncPrefObserver, 361 FOR_EACH_OBSERVER(SyncPrefObserver,
400 sync_pref_observers_, 362 sync_pref_observers_,
401 OnSyncManagedPrefChange(*pref_sync_managed_)); 363 OnSyncManagedPrefChange(*pref_sync_managed_));
402 } 364 }
403 365
404 void SyncPrefs::SetManagedForTest(bool is_managed) { 366 void SyncPrefs::SetManagedForTest(bool is_managed) {
405 DCHECK(CalledOnValidThread()); 367 DCHECK(CalledOnValidThread());
406 pref_service_->SetBoolean(prefs::kSyncManaged, is_managed); 368 pref_service_->SetBoolean(prefs::kSyncManaged, is_managed);
407 } 369 }
408 370
409 syncer::ModelTypeSet SyncPrefs::GetAcknowledgeSyncedTypesForTest() const {
410 DCHECK(CalledOnValidThread());
411 return syncer::ModelTypeSetFromValue(
412 *pref_service_->GetList(prefs::kSyncAcknowledgedSyncTypes));
413 }
414
415 void SyncPrefs::RegisterPrefGroups() { 371 void SyncPrefs::RegisterPrefGroups() {
416 pref_groups_[syncer::APPS].Put(syncer::APP_NOTIFICATIONS); 372 pref_groups_[syncer::APPS].Put(syncer::APP_NOTIFICATIONS);
417 pref_groups_[syncer::APPS].Put(syncer::APP_SETTINGS); 373 pref_groups_[syncer::APPS].Put(syncer::APP_SETTINGS);
418 pref_groups_[syncer::APPS].Put(syncer::APP_LIST); 374 pref_groups_[syncer::APPS].Put(syncer::APP_LIST);
419 375
420 pref_groups_[syncer::AUTOFILL].Put(syncer::AUTOFILL_PROFILE); 376 pref_groups_[syncer::AUTOFILL].Put(syncer::AUTOFILL_PROFILE);
421 pref_groups_[syncer::AUTOFILL].Put(syncer::AUTOFILL_WALLET_DATA); 377 pref_groups_[syncer::AUTOFILL].Put(syncer::AUTOFILL_WALLET_DATA);
422 378
423 pref_groups_[syncer::EXTENSIONS].Put(syncer::EXTENSION_SETTINGS); 379 pref_groups_[syncer::EXTENSIONS].Put(syncer::EXTENSION_SETTINGS);
424 380
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 472
517 void SyncPrefs::SetFirstSyncTime(base::Time time) { 473 void SyncPrefs::SetFirstSyncTime(base::Time time) {
518 pref_service_->SetInt64(prefs::kSyncFirstSyncTime, time.ToInternalValue()); 474 pref_service_->SetInt64(prefs::kSyncFirstSyncTime, time.ToInternalValue());
519 } 475 }
520 476
521 void SyncPrefs::ClearFirstSyncTime() { 477 void SyncPrefs::ClearFirstSyncTime() {
522 pref_service_->ClearPref(prefs::kSyncFirstSyncTime); 478 pref_service_->ClearPref(prefs::kSyncFirstSyncTime);
523 } 479 }
524 480
525 } // namespace sync_driver 481 } // namespace sync_driver
OLDNEW
« no previous file with comments | « components/sync_driver/sync_prefs.h ('k') | components/sync_driver/sync_prefs_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698