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