| 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/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/prefs/public/pref_member.h" | 9 #include "base/prefs/public/pref_member.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 PrefRegistrySyncable::UNSYNCABLE_PREF); | 93 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 94 registry->RegisterStringPref(prefs::kSyncKeystoreEncryptionBootstrapToken, | 94 registry->RegisterStringPref(prefs::kSyncKeystoreEncryptionBootstrapToken, |
| 95 "", | 95 "", |
| 96 PrefRegistrySyncable::UNSYNCABLE_PREF); | 96 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 97 #if defined(OS_CHROMEOS) | 97 #if defined(OS_CHROMEOS) |
| 98 registry->RegisterStringPref(prefs::kSyncSpareBootstrapToken, | 98 registry->RegisterStringPref(prefs::kSyncSpareBootstrapToken, |
| 99 "", | 99 "", |
| 100 PrefRegistrySyncable::UNSYNCABLE_PREF); | 100 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 101 #endif | 101 #endif |
| 102 | 102 |
| 103 registry->RegisterStringPref(prefs::kSyncSessionsGUID, |
| 104 "", |
| 105 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 106 |
| 103 // We will start prompting people about new data types after the launch of | 107 // We will start prompting people about new data types after the launch of |
| 104 // SESSIONS - all previously launched data types are treated as if they are | 108 // SESSIONS - all previously launched data types are treated as if they are |
| 105 // already acknowledged. | 109 // already acknowledged. |
| 106 syncer::ModelTypeSet model_set; | 110 syncer::ModelTypeSet model_set; |
| 107 model_set.Put(syncer::BOOKMARKS); | 111 model_set.Put(syncer::BOOKMARKS); |
| 108 model_set.Put(syncer::PREFERENCES); | 112 model_set.Put(syncer::PREFERENCES); |
| 109 model_set.Put(syncer::PASSWORDS); | 113 model_set.Put(syncer::PASSWORDS); |
| 110 model_set.Put(syncer::AUTOFILL_PROFILE); | 114 model_set.Put(syncer::AUTOFILL_PROFILE); |
| 111 model_set.Put(syncer::AUTOFILL); | 115 model_set.Put(syncer::AUTOFILL); |
| 112 model_set.Put(syncer::THEMES); | 116 model_set.Put(syncer::THEMES); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 pref_service_ ? | 284 pref_service_ ? |
| 281 pref_service_->GetString(prefs::kSyncKeystoreEncryptionBootstrapToken) : | 285 pref_service_->GetString(prefs::kSyncKeystoreEncryptionBootstrapToken) : |
| 282 ""; | 286 ""; |
| 283 } | 287 } |
| 284 | 288 |
| 285 void SyncPrefs::SetKeystoreEncryptionBootstrapToken(const std::string& token) { | 289 void SyncPrefs::SetKeystoreEncryptionBootstrapToken(const std::string& token) { |
| 286 DCHECK(CalledOnValidThread()); | 290 DCHECK(CalledOnValidThread()); |
| 287 pref_service_->SetString(prefs::kSyncKeystoreEncryptionBootstrapToken, token); | 291 pref_service_->SetString(prefs::kSyncKeystoreEncryptionBootstrapToken, token); |
| 288 } | 292 } |
| 289 | 293 |
| 294 std::string SyncPrefs::GetSyncSessionsGUID() const { |
| 295 DCHECK(CalledOnValidThread()); |
| 296 return |
| 297 pref_service_ ? |
| 298 pref_service_->GetString(prefs::kSyncSessionsGUID) : ""; |
| 299 } |
| 300 |
| 301 void SyncPrefs::SetSyncSessionsGUID(const std::string& guid) { |
| 302 DCHECK(CalledOnValidThread()); |
| 303 pref_service_->SetString(prefs::kSyncSessionsGUID, guid); |
| 304 } |
| 305 |
| 290 // static | 306 // static |
| 291 const char* SyncPrefs::GetPrefNameForDataType(syncer::ModelType data_type) { | 307 const char* SyncPrefs::GetPrefNameForDataType(syncer::ModelType data_type) { |
| 292 switch (data_type) { | 308 switch (data_type) { |
| 293 case syncer::BOOKMARKS: | 309 case syncer::BOOKMARKS: |
| 294 return prefs::kSyncBookmarks; | 310 return prefs::kSyncBookmarks; |
| 295 case syncer::PASSWORDS: | 311 case syncer::PASSWORDS: |
| 296 return prefs::kSyncPasswords; | 312 return prefs::kSyncPasswords; |
| 297 case syncer::PREFERENCES: | 313 case syncer::PREFERENCES: |
| 298 return prefs::kSyncPreferences; | 314 return prefs::kSyncPreferences; |
| 299 case syncer::AUTOFILL: | 315 case syncer::AUTOFILL: |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 if (types.Has(i->first)) | 469 if (types.Has(i->first)) |
| 454 types_with_groups.PutAll(i->second); | 470 types_with_groups.PutAll(i->second); |
| 455 else | 471 else |
| 456 types_with_groups.RemoveAll(i->second); | 472 types_with_groups.RemoveAll(i->second); |
| 457 } | 473 } |
| 458 types_with_groups.RetainAll(registered_types); | 474 types_with_groups.RetainAll(registered_types); |
| 459 return types_with_groups; | 475 return types_with_groups; |
| 460 } | 476 } |
| 461 | 477 |
| 462 } // namespace browser_sync | 478 } // namespace browser_sync |
| OLD | NEW |