Commit e97ebd1c authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Remove prefs::kSyncSpareBootstrapToken which is never set

The pref was read by ProfileSyncService, but never actually set.

Bug: 938869
Change-Id: Ie924712e82f97c4c2459329e4830aa50e3cfc57d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1556795
Auto-Submit: Marc Treib <treib@chromium.org>
Reviewed-by: default avatarMohamed Amir Yosef <mamir@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#648617}
parent cbc1f2da
...@@ -1016,4 +1016,9 @@ void MigrateObsoleteProfilePrefs(Profile* profile) { ...@@ -1016,4 +1016,9 @@ void MigrateObsoleteProfilePrefs(Profile* profile) {
profile_prefs->ClearPref(kDismissedAssetDownloadSuggestions); profile_prefs->ClearPref(kDismissedAssetDownloadSuggestions);
profile_prefs->ClearPref(kDismissedOfflinePageDownloadSuggestions); profile_prefs->ClearPref(kDismissedOfflinePageDownloadSuggestions);
#endif // defined(OS_ANDROID) #endif // defined(OS_ANDROID)
#if defined(OS_CHROMEOS)
// Added 4/2019.
syncer::ClearObsoleteSyncSpareBootstrapToken(profile_prefs);
#endif // defined(OS_CHROMEOS)
} }
...@@ -88,12 +88,6 @@ const char kSyncEncryptionBootstrapToken[] = "sync.encryption_bootstrap_token"; ...@@ -88,12 +88,6 @@ const char kSyncEncryptionBootstrapToken[] = "sync.encryption_bootstrap_token";
const char kSyncKeystoreEncryptionBootstrapToken[] = const char kSyncKeystoreEncryptionBootstrapToken[] =
"sync.keystore_encryption_bootstrap_token"; "sync.keystore_encryption_bootstrap_token";
#if defined(OS_CHROMEOS)
// A string that is used to store first-time sync startup after once sync is
// disabled. This will be refreshed every sign-in.
const char kSyncSpareBootstrapToken[] = "sync.spare_bootstrap_token";
#endif // defined(OS_CHROMEOS)
const char kSyncCacheGuid[] = "sync.cache_guid"; const char kSyncCacheGuid[] = "sync.cache_guid";
const char kSyncBirthday[] = "sync.birthday"; const char kSyncBirthday[] = "sync.birthday";
const char kSyncBagOfChips[] = "sync.bag_of_chips"; const char kSyncBagOfChips[] = "sync.bag_of_chips";
......
...@@ -67,10 +67,6 @@ extern const char kSyncCacheGuid[]; ...@@ -67,10 +67,6 @@ extern const char kSyncCacheGuid[];
extern const char kSyncBirthday[]; extern const char kSyncBirthday[];
extern const char kSyncBagOfChips[]; extern const char kSyncBagOfChips[];
#if defined(OS_CHROMEOS)
extern const char kSyncSpareBootstrapToken[];
#endif // defined(OS_CHROMEOS)
extern const char kSyncPassphrasePrompted[]; extern const char kSyncPassphrasePrompted[];
extern const char kSyncMemoryPressureWarningCount[]; extern const char kSyncMemoryPressureWarningCount[];
......
...@@ -36,6 +36,11 @@ const char kSyncFirstSyncTime[] = "sync.first_sync_time"; ...@@ -36,6 +36,11 @@ const char kSyncFirstSyncTime[] = "sync.first_sync_time";
// Obsolete pref that used to store long poll intervals received by the server. // Obsolete pref that used to store long poll intervals received by the server.
const char kSyncLongPollIntervalSeconds[] = "sync.long_poll_interval"; const char kSyncLongPollIntervalSeconds[] = "sync.long_poll_interval";
#if defined(OS_CHROMEOS)
// Obsolete pref.
const char kSyncSpareBootstrapToken[] = "sync.spare_bootstrap_token";
#endif // defined(OS_CHROMEOS)
// Groups of prefs that always have the same value as a "master" pref. // Groups of prefs that always have the same value as a "master" pref.
// For example, the APPS group has {APP_LIST, APP_SETTINGS} // For example, the APPS group has {APP_LIST, APP_SETTINGS}
// (as well as APPS, but that is implied), so // (as well as APPS, but that is implied), so
...@@ -166,10 +171,6 @@ void SyncPrefs::RegisterProfilePrefs( ...@@ -166,10 +171,6 @@ void SyncPrefs::RegisterProfilePrefs(
std::string()); std::string());
registry->RegisterStringPref(prefs::kSyncKeystoreEncryptionBootstrapToken, registry->RegisterStringPref(prefs::kSyncKeystoreEncryptionBootstrapToken,
std::string()); std::string());
#if defined(OS_CHROMEOS)
// TODO(crbug.com/938869): Remove this pref.
registry->RegisterStringPref(prefs::kSyncSpareBootstrapToken, "");
#endif
registry->RegisterBooleanPref(prefs::kSyncPassphrasePrompted, false); registry->RegisterBooleanPref(prefs::kSyncPassphrasePrompted, false);
registry->RegisterIntegerPref(prefs::kSyncMemoryPressureWarningCount, -1); registry->RegisterIntegerPref(prefs::kSyncMemoryPressureWarningCount, -1);
registry->RegisterBooleanPref(prefs::kSyncShutdownCleanly, false); registry->RegisterBooleanPref(prefs::kSyncShutdownCleanly, false);
...@@ -187,6 +188,9 @@ void SyncPrefs::RegisterProfilePrefs( ...@@ -187,6 +188,9 @@ void SyncPrefs::RegisterProfilePrefs(
registry->RegisterBooleanPref(kSyncHasAuthError, false); registry->RegisterBooleanPref(kSyncHasAuthError, false);
registry->RegisterInt64Pref(kSyncFirstSyncTime, 0); registry->RegisterInt64Pref(kSyncFirstSyncTime, 0);
registry->RegisterInt64Pref(kSyncLongPollIntervalSeconds, 0); registry->RegisterInt64Pref(kSyncLongPollIntervalSeconds, 0);
#if defined(OS_CHROMEOS)
registry->RegisterStringPref(kSyncSpareBootstrapToken, "");
#endif
} }
void SyncPrefs::AddSyncPrefObserver(SyncPrefObserver* sync_pref_observer) { void SyncPrefs::AddSyncPrefObserver(SyncPrefObserver* sync_pref_observer) {
...@@ -436,18 +440,6 @@ const char* SyncPrefs::GetPrefNameForDataType(ModelType type) { ...@@ -436,18 +440,6 @@ const char* SyncPrefs::GetPrefNameForDataType(ModelType type) {
return nullptr; return nullptr;
} }
#if defined(OS_CHROMEOS)
std::string SyncPrefs::GetSpareBootstrapToken() const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return pref_service_->GetString(prefs::kSyncSpareBootstrapToken);
}
void SyncPrefs::SetSpareBootstrapToken(const std::string& token) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
pref_service_->SetString(prefs::kSyncSpareBootstrapToken, token);
}
#endif
void SyncPrefs::OnSyncManagedPrefChanged() { void SyncPrefs::OnSyncManagedPrefChanged() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
for (SyncPrefObserver& observer : sync_pref_observers_) for (SyncPrefObserver& observer : sync_pref_observers_)
...@@ -643,4 +635,10 @@ void ClearObsoleteSyncLongPollIntervalSeconds(PrefService* pref_service) { ...@@ -643,4 +635,10 @@ void ClearObsoleteSyncLongPollIntervalSeconds(PrefService* pref_service) {
pref_service->ClearPref(kSyncLongPollIntervalSeconds); pref_service->ClearPref(kSyncLongPollIntervalSeconds);
} }
#if defined(OS_CHROMEOS)
void ClearObsoleteSyncSpareBootstrapToken(PrefService* pref_service) {
pref_service->ClearPref(kSyncSpareBootstrapToken);
}
#endif // defined(OS_CHROMEOS)
} // namespace syncer } // namespace syncer
...@@ -142,13 +142,6 @@ class SyncPrefs : public CryptoSyncPrefs, ...@@ -142,13 +142,6 @@ class SyncPrefs : public CryptoSyncPrefs,
// Maps |type| to its corresponding preference name. // Maps |type| to its corresponding preference name.
static const char* GetPrefNameForDataType(ModelType type); static const char* GetPrefNameForDataType(ModelType type);
#if defined(OS_CHROMEOS)
// Use this spare bootstrap token only when setting up sync for the first
// time.
std::string GetSpareBootstrapToken() const;
void SetSpareBootstrapToken(const std::string& token);
#endif
// Copy of various fields historically owned and persisted by the Directory. // Copy of various fields historically owned and persisted by the Directory.
// This is a future-proof approach to ultimately replace the Directory once // This is a future-proof approach to ultimately replace the Directory once
// most users have populated prefs and the Directory is about to be removed. // most users have populated prefs and the Directory is about to be removed.
...@@ -238,6 +231,9 @@ void ClearObsoleteClearServerDataPrefs(PrefService* pref_service); ...@@ -238,6 +231,9 @@ void ClearObsoleteClearServerDataPrefs(PrefService* pref_service);
void ClearObsoleteAuthErrorPrefs(PrefService* pref_service); void ClearObsoleteAuthErrorPrefs(PrefService* pref_service);
void ClearObsoleteFirstSyncTime(PrefService* pref_service); void ClearObsoleteFirstSyncTime(PrefService* pref_service);
void ClearObsoleteSyncLongPollIntervalSeconds(PrefService* pref_service); void ClearObsoleteSyncLongPollIntervalSeconds(PrefService* pref_service);
#if defined(OS_CHROMEOS)
void ClearObsoleteSyncSpareBootstrapToken(PrefService* pref_service);
#endif // defined(OS_CHROMEOS)
} // namespace syncer } // namespace syncer
......
...@@ -208,14 +208,6 @@ ProfileSyncService::ProfileSyncService(InitParams init_params) ...@@ -208,14 +208,6 @@ ProfileSyncService::ProfileSyncService(InitParams init_params)
if (identity_manager_) if (identity_manager_)
identity_manager_->AddObserver(this); identity_manager_->AddObserver(this);
#if defined(OS_CHROMEOS)
std::string bootstrap_token = sync_prefs_.GetEncryptionBootstrapToken();
if (bootstrap_token.empty()) {
sync_prefs_.SetEncryptionBootstrapToken(
sync_prefs_.GetSpareBootstrapToken());
}
#endif
memory_pressure_listener_ = std::make_unique<base::MemoryPressureListener>( memory_pressure_listener_ = std::make_unique<base::MemoryPressureListener>(
base::BindRepeating(&ProfileSyncService::OnMemoryPressure, base::BindRepeating(&ProfileSyncService::OnMemoryPressure,
sync_enabled_weak_factory_.GetWeakPtr())); sync_enabled_weak_factory_.GetWeakPtr()));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment