| 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_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/prefs/public/pref_member.h" | 10 #include "base/prefs/public/pref_member.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 PrefRegistrySyncable::UNSYNCABLE_PREF); | 87 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 88 registry->RegisterStringPref(prefs::kSyncKeystoreEncryptionBootstrapToken, | 88 registry->RegisterStringPref(prefs::kSyncKeystoreEncryptionBootstrapToken, |
| 89 "", | 89 "", |
| 90 PrefRegistrySyncable::UNSYNCABLE_PREF); | 90 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 91 #if defined(OS_CHROMEOS) | 91 #if defined(OS_CHROMEOS) |
| 92 registry->RegisterStringPref(prefs::kSyncSpareBootstrapToken, | 92 registry->RegisterStringPref(prefs::kSyncSpareBootstrapToken, |
| 93 "", | 93 "", |
| 94 PrefRegistrySyncable::UNSYNCABLE_PREF); | 94 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 95 #endif | 95 #endif |
| 96 | 96 |
| 97 registry->RegisterStringPref(prefs::kSyncSessionsGUID, |
| 98 "", |
| 99 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 100 |
| 97 // We will start prompting people about new data types after the launch of | 101 // We will start prompting people about new data types after the launch of |
| 98 // SESSIONS - all previously launched data types are treated as if they are | 102 // SESSIONS - all previously launched data types are treated as if they are |
| 99 // already acknowledged. | 103 // already acknowledged. |
| 100 syncer::ModelTypeSet model_set; | 104 syncer::ModelTypeSet model_set; |
| 101 model_set.Put(syncer::BOOKMARKS); | 105 model_set.Put(syncer::BOOKMARKS); |
| 102 model_set.Put(syncer::PREFERENCES); | 106 model_set.Put(syncer::PREFERENCES); |
| 103 model_set.Put(syncer::PASSWORDS); | 107 model_set.Put(syncer::PASSWORDS); |
| 104 model_set.Put(syncer::AUTOFILL_PROFILE); | 108 model_set.Put(syncer::AUTOFILL_PROFILE); |
| 105 model_set.Put(syncer::AUTOFILL); | 109 model_set.Put(syncer::AUTOFILL); |
| 106 model_set.Put(syncer::THEMES); | 110 model_set.Put(syncer::THEMES); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 pref_service_ ? | 278 pref_service_ ? |
| 275 pref_service_->GetString(prefs::kSyncKeystoreEncryptionBootstrapToken) : | 279 pref_service_->GetString(prefs::kSyncKeystoreEncryptionBootstrapToken) : |
| 276 ""; | 280 ""; |
| 277 } | 281 } |
| 278 | 282 |
| 279 void SyncPrefs::SetKeystoreEncryptionBootstrapToken(const std::string& token) { | 283 void SyncPrefs::SetKeystoreEncryptionBootstrapToken(const std::string& token) { |
| 280 DCHECK(CalledOnValidThread()); | 284 DCHECK(CalledOnValidThread()); |
| 281 pref_service_->SetString(prefs::kSyncKeystoreEncryptionBootstrapToken, token); | 285 pref_service_->SetString(prefs::kSyncKeystoreEncryptionBootstrapToken, token); |
| 282 } | 286 } |
| 283 | 287 |
| 288 std::string SyncPrefs::GetSyncSessionsGUID() const { |
| 289 DCHECK(CalledOnValidThread()); |
| 290 return |
| 291 pref_service_ ? |
| 292 pref_service_->GetString(prefs::kSyncSessionsGUID) : ""; |
| 293 } |
| 294 |
| 295 void SyncPrefs::SetSyncSessionsGUID(const std::string& guid) { |
| 296 DCHECK(CalledOnValidThread()); |
| 297 pref_service_->SetString(prefs::kSyncSessionsGUID, guid); |
| 298 } |
| 299 |
| 284 // static | 300 // static |
| 285 const char* SyncPrefs::GetPrefNameForDataType(syncer::ModelType data_type) { | 301 const char* SyncPrefs::GetPrefNameForDataType(syncer::ModelType data_type) { |
| 286 switch (data_type) { | 302 switch (data_type) { |
| 287 case syncer::BOOKMARKS: | 303 case syncer::BOOKMARKS: |
| 288 return prefs::kSyncBookmarks; | 304 return prefs::kSyncBookmarks; |
| 289 case syncer::PASSWORDS: | 305 case syncer::PASSWORDS: |
| 290 return prefs::kSyncPasswords; | 306 return prefs::kSyncPasswords; |
| 291 case syncer::PREFERENCES: | 307 case syncer::PREFERENCES: |
| 292 return prefs::kSyncPreferences; | 308 return prefs::kSyncPreferences; |
| 293 case syncer::AUTOFILL: | 309 case syncer::AUTOFILL: |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 for (PrefGroupsMap::const_iterator i = pref_groups_.begin(); | 477 for (PrefGroupsMap::const_iterator i = pref_groups_.begin(); |
| 462 i != pref_groups_.end(); ++i) { | 478 i != pref_groups_.end(); ++i) { |
| 463 if (types.Has(i->first)) | 479 if (types.Has(i->first)) |
| 464 types_with_groups.PutAll(i->second); | 480 types_with_groups.PutAll(i->second); |
| 465 } | 481 } |
| 466 types_with_groups.RetainAll(registered_types); | 482 types_with_groups.RetainAll(registered_types); |
| 467 return types_with_groups; | 483 return types_with_groups; |
| 468 } | 484 } |
| 469 | 485 |
| 470 } // namespace browser_sync | 486 } // namespace browser_sync |
| OLD | NEW |