Commit 045ed7eb authored by Mikel Astiz's avatar Mikel Astiz Committed by Commit Bot

Rename remaining occurrences of sync Cryptographer is-ready

In the new APIs the notion of readiness (which is more abstract) was
replaced by the cryptographer's CanEncrypt() state. This patch
addresses a TODO to rename some leftovers from earlier patches, as well
as the string in chrome://sync-internals.

Bug: 967417
Change-Id: Ia9c24a756c06fa4036dfedf0475b3d8cb5c3f37d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1826781
Commit-Queue: Mikel Astiz <mastiz@chromium.org>
Reviewed-by: default avatarMaksim Moskvitin <mmoskvitin@google.com>
Cr-Commit-Position: refs/heads/master@{#700285}
parent 66246bd9
......@@ -367,8 +367,8 @@ std::unique_ptr<base::DictionaryValue> ConstructAboutInformation(
section_encryption->AddBoolStat("Explicit Passphrase");
Stat<bool>* is_passphrase_required =
section_encryption->AddBoolStat("Passphrase Required");
Stat<bool>* is_cryptographer_ready =
section_encryption->AddBoolStat("Cryptographer Ready");
Stat<bool>* cryptographer_can_encrypt =
section_encryption->AddBoolStat("Cryptographer Ready To Encrypt");
Stat<bool>* has_pending_keys =
section_encryption->AddBoolStat("Cryptographer Has Pending Keys");
Stat<std::string>* encrypted_types =
......@@ -517,7 +517,7 @@ std::unique_ptr<base::DictionaryValue> ConstructAboutInformation(
"No Passphrase Time"));
}
if (is_status_valid) {
is_cryptographer_ready->Set(full_status.cryptographer_ready);
cryptographer_can_encrypt->Set(full_status.cryptographer_can_encrypt);
has_pending_keys->Set(full_status.crypto_has_pending_keys);
encrypted_types->Set(ModelTypeSetToString(full_status.encrypted_types));
has_keystore_key->Set(full_status.has_keystore_key);
......
......@@ -23,7 +23,7 @@ SyncStatus::SyncStatus()
nudge_source_notification(0),
nudge_source_local(0),
nudge_source_local_refresh(0),
cryptographer_ready(false),
cryptographer_can_encrypt(false),
crypto_has_pending_keys(false),
has_keystore_key(false),
passphrase_type(PassphraseType::kImplicitPassphrase),
......
......@@ -74,7 +74,7 @@ struct SyncStatus {
// Encryption related.
ModelTypeSet encrypted_types;
bool cryptographer_ready;
bool cryptographer_can_encrypt;
bool crypto_has_pending_keys;
bool has_keystore_key;
base::Time keystore_migration_time;
......
......@@ -14,7 +14,7 @@ namespace syncer {
AllStatus::AllStatus() {
status_.notifications_enabled = false;
status_.cryptographer_ready = false;
status_.cryptographer_can_encrypt = false;
status_.crypto_has_pending_keys = false;
}
......@@ -129,9 +129,9 @@ void AllStatus::SetEncryptedTypes(ModelTypeSet types) {
status_.encrypted_types = types;
}
void AllStatus::SetCryptographerReady(bool ready) {
void AllStatus::SetCryptographerCanEncrypt(bool can_encrypt) {
ScopedStatusLock lock(this);
status_.cryptographer_ready = ready;
status_.cryptographer_can_encrypt = can_encrypt;
}
void AllStatus::SetCryptoHasPendingKeys(bool has_pending_keys) {
......
......@@ -53,9 +53,7 @@ class AllStatus : public SyncEngineEventListener {
void IncrementNotificationsReceived();
void SetEncryptedTypes(ModelTypeSet types);
// TODO(crbug.com/967417): Rename Ready->CanEncrypt in consistency with
// Cryptographer's API.
void SetCryptographerReady(bool ready);
void SetCryptographerCanEncrypt(bool can_encrypt);
void SetCryptoHasPendingKeys(bool has_pending_keys);
void SetPassphraseType(PassphraseType type);
void SetHasKeystoreKey(bool has_keystore_key);
......
......@@ -13,7 +13,7 @@ namespace syncer {
DebugInfoEventListener::DebugInfoEventListener()
: events_dropped_(false),
cryptographer_has_pending_keys_(false),
cryptographer_ready_(false) {}
cryptographer_can_encrypt_(false) {}
DebugInfoEventListener::~DebugInfoEventListener() {}
......@@ -103,7 +103,7 @@ void DebugInfoEventListener::OnCryptographerStateChanged(
bool has_pending_keys) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
cryptographer_has_pending_keys_ = has_pending_keys;
cryptographer_ready_ = cryptographer->CanEncrypt();
cryptographer_can_encrypt_ = cryptographer->CanEncrypt();
}
void DebugInfoEventListener::OnPassphraseTypeChanged(
......@@ -142,7 +142,7 @@ void DebugInfoEventListener::GetDebugInfo(sync_pb::DebugInfo* debug_info) {
}
debug_info->set_events_dropped(events_dropped_);
debug_info->set_cryptographer_ready(cryptographer_ready_);
debug_info->set_cryptographer_ready(cryptographer_can_encrypt_);
debug_info->set_cryptographer_has_pending_keys(
cryptographer_has_pending_keys_);
}
......
......@@ -104,8 +104,9 @@ class DebugInfoEventListener : public SyncManager::Observer,
// Cryptographer has keys that are not yet decrypted.
bool cryptographer_has_pending_keys_;
// Cryptographer is initialized and does not have pending keys.
bool cryptographer_ready_;
// Cryptographer is able to encrypt data, which usually means it's initialized
// and does not have pending keys.
bool cryptographer_can_encrypt_;
SEQUENCE_CHECKER(sequence_checker_);
......
......@@ -448,7 +448,7 @@ void SyncManagerImpl::OnEncryptionComplete() {
void SyncManagerImpl::OnCryptographerStateChanged(Cryptographer* cryptographer,
bool has_pending_keys) {
allstatus_.SetCryptographerReady(cryptographer->CanEncrypt());
allstatus_.SetCryptographerCanEncrypt(cryptographer->CanEncrypt());
allstatus_.SetCryptoHasPendingKeys(has_pending_keys);
allstatus_.SetKeystoreMigrationTime(
sync_encryption_handler_->GetKeystoreMigrationTime());
......
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