| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 166 |
| 167 std::string SyncPrefs::GetEncryptionBootstrapToken() const { | 167 std::string SyncPrefs::GetEncryptionBootstrapToken() const { |
| 168 DCHECK(non_thread_safe_.CalledOnValidThread()); | 168 DCHECK(non_thread_safe_.CalledOnValidThread()); |
| 169 return | 169 return |
| 170 pref_service_ ? | 170 pref_service_ ? |
| 171 pref_service_->GetString(prefs::kSyncEncryptionBootstrapToken) : ""; | 171 pref_service_->GetString(prefs::kSyncEncryptionBootstrapToken) : ""; |
| 172 } | 172 } |
| 173 | 173 |
| 174 void SyncPrefs::SetEncryptionBootstrapToken(const std::string& token) { | 174 void SyncPrefs::SetEncryptionBootstrapToken(const std::string& token) { |
| 175 DCHECK(non_thread_safe_.CalledOnValidThread()); | 175 DCHECK(non_thread_safe_.CalledOnValidThread()); |
| 176 CHECK(pref_service_); | |
| 177 pref_service_->SetString(prefs::kSyncEncryptionBootstrapToken, token); | 176 pref_service_->SetString(prefs::kSyncEncryptionBootstrapToken, token); |
| 178 } | 177 } |
| 179 | 178 |
| 179 #if defined(OS_CHROMEOS) |
| 180 std::string SyncPrefs::GetSpareBootstrapToken() const { |
| 181 DCHECK(non_thread_safe_.CalledOnValidThread()); |
| 182 return pref_service_ ? |
| 183 pref_service_->GetString(prefs::kSyncSpareBootstrapToken) : ""; |
| 184 } |
| 185 |
| 186 void SyncPrefs::SetSpareBootstrapToken(const std::string& token) { |
| 187 DCHECK(non_thread_safe_.CalledOnValidThread()); |
| 188 pref_service_->SetString(prefs::kSyncSpareBootstrapToken, token); |
| 189 } |
| 190 #endif |
| 191 |
| 180 sync_notifier::InvalidationVersionMap SyncPrefs::GetAllMaxVersions() const { | 192 sync_notifier::InvalidationVersionMap SyncPrefs::GetAllMaxVersions() const { |
| 181 DCHECK(non_thread_safe_.CalledOnValidThread()); | 193 DCHECK(non_thread_safe_.CalledOnValidThread()); |
| 182 if (!pref_service_) { | 194 if (!pref_service_) { |
| 183 return sync_notifier::InvalidationVersionMap(); | 195 return sync_notifier::InvalidationVersionMap(); |
| 184 } | 196 } |
| 185 // Complicated gross code to convert from a string -> string | 197 // Complicated gross code to convert from a string -> string |
| 186 // DictionaryValue to a ModelType -> int64 map. | 198 // DictionaryValue to a ModelType -> int64 map. |
| 187 const base::DictionaryValue* max_versions_dict = | 199 const base::DictionaryValue* max_versions_dict = |
| 188 pref_service_->GetDictionary(prefs::kSyncMaxInvalidationVersions); | 200 pref_service_->GetDictionary(prefs::kSyncMaxInvalidationVersions); |
| 189 CHECK(max_versions_dict); | 201 CHECK(max_versions_dict); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 } | 403 } |
| 392 RegisterDataTypePreferredPref(type, enable_by_default); | 404 RegisterDataTypePreferredPref(type, enable_by_default); |
| 393 } | 405 } |
| 394 | 406 |
| 395 pref_service_->RegisterBooleanPref(prefs::kSyncManaged, | 407 pref_service_->RegisterBooleanPref(prefs::kSyncManaged, |
| 396 false, | 408 false, |
| 397 PrefService::UNSYNCABLE_PREF); | 409 PrefService::UNSYNCABLE_PREF); |
| 398 pref_service_->RegisterStringPref(prefs::kSyncEncryptionBootstrapToken, | 410 pref_service_->RegisterStringPref(prefs::kSyncEncryptionBootstrapToken, |
| 399 "", | 411 "", |
| 400 PrefService::UNSYNCABLE_PREF); | 412 PrefService::UNSYNCABLE_PREF); |
| 413 #if defined(OS_CHROMEOS) |
| 414 pref_service_->RegisterStringPref(prefs::kSyncSpareBootstrapToken, |
| 415 "", |
| 416 PrefService::UNSYNCABLE_PREF); |
| 417 #endif |
| 401 | 418 |
| 402 // We will start prompting people about new data types after the launch of | 419 // We will start prompting people about new data types after the launch of |
| 403 // SESSIONS - all previously launched data types are treated as if they are | 420 // SESSIONS - all previously launched data types are treated as if they are |
| 404 // already acknowledged. | 421 // already acknowledged. |
| 405 syncable::ModelTypeSet model_set; | 422 syncable::ModelTypeSet model_set; |
| 406 model_set.Put(syncable::BOOKMARKS); | 423 model_set.Put(syncable::BOOKMARKS); |
| 407 model_set.Put(syncable::PREFERENCES); | 424 model_set.Put(syncable::PREFERENCES); |
| 408 model_set.Put(syncable::PASSWORDS); | 425 model_set.Put(syncable::PASSWORDS); |
| 409 model_set.Put(syncable::AUTOFILL_PROFILE); | 426 model_set.Put(syncable::AUTOFILL_PROFILE); |
| 410 model_set.Put(syncable::AUTOFILL); | 427 model_set.Put(syncable::AUTOFILL); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 if (types.Has(i->first)) | 489 if (types.Has(i->first)) |
| 473 types_with_groups.PutAll(i->second); | 490 types_with_groups.PutAll(i->second); |
| 474 else | 491 else |
| 475 types_with_groups.RemoveAll(i->second); | 492 types_with_groups.RemoveAll(i->second); |
| 476 } | 493 } |
| 477 types_with_groups.RetainAll(registered_types); | 494 types_with_groups.RetainAll(registered_types); |
| 478 return types_with_groups; | 495 return types_with_groups; |
| 479 } | 496 } |
| 480 | 497 |
| 481 } // namespace browser_sync | 498 } // namespace browser_sync |
| OLD | NEW |