Commit 955aa1f9 authored by Victor Hugo Vianna Silva's avatar Victor Hugo Vianna Silva Committed by Commit Bot

Remove SyncEncryptHandler::OnEncryptionComplete

The method is unused. SyncEnums::ENCRYPTION_COMPLETE also becomes unused
and is deprecated.

Bug: 1033040
Change-Id: I100ed858d43151d437076947c1cf5fcf5831af3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2479164
Commit-Queue: Victor Vianna <victorvianna@google.com>
Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#818187}
parent ea36d5e4
...@@ -25,7 +25,6 @@ cr.define('chrome.sync', function() { ...@@ -25,7 +25,6 @@ cr.define('chrome.sync', function() {
'onChangesComplete', 'onChangesComplete',
'onConnectionStatusChange', 'onConnectionStatusChange',
'onEncryptedTypesChanged', 'onEncryptedTypesChanged',
'onEncryptionComplete',
'onInitializationComplete', 'onInitializationComplete',
'onPassphraseAccepted', 'onPassphraseAccepted',
'onPassphraseRequired', 'onPassphraseRequired',
......
...@@ -138,13 +138,6 @@ class SyncEncryptionObserverProxy : public SyncEncryptionHandler::Observer { ...@@ -138,13 +138,6 @@ class SyncEncryptionObserverProxy : public SyncEncryptionHandler::Observer {
observer_, encrypted_types, encrypt_everything)); observer_, encrypted_types, encrypt_everything));
} }
void OnEncryptionComplete() override {
task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&SyncEncryptionHandler::Observer::OnEncryptionComplete,
observer_));
}
void OnCryptographerStateChanged(Cryptographer* cryptographer, void OnCryptographerStateChanged(Cryptographer* cryptographer,
bool has_pending_keys) override { bool has_pending_keys) override {
task_runner_->PostTask( task_runner_->PostTask(
...@@ -549,17 +542,6 @@ void SyncServiceCrypto::OnEncryptedTypesChanged(ModelTypeSet encrypted_types, ...@@ -549,17 +542,6 @@ void SyncServiceCrypto::OnEncryptedTypesChanged(ModelTypeSet encrypted_types,
notify_observers_.Run(); notify_observers_.Run();
} }
void SyncServiceCrypto::OnEncryptionComplete() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DVLOG(1) << "Encryption complete";
if (state_.encryption_pending && state_.encrypt_everything) {
state_.encryption_pending = false;
// This is to nudge the integration tests when encryption is
// finished.
notify_observers_.Run();
}
}
void SyncServiceCrypto::OnCryptographerStateChanged( void SyncServiceCrypto::OnCryptographerStateChanged(
Cryptographer* cryptographer, Cryptographer* cryptographer,
bool has_pending_keys) { bool has_pending_keys) {
......
...@@ -79,7 +79,6 @@ class SyncServiceCrypto : public SyncEncryptionHandler::Observer, ...@@ -79,7 +79,6 @@ class SyncServiceCrypto : public SyncEncryptionHandler::Observer,
BootstrapTokenType type) override; BootstrapTokenType type) override;
void OnEncryptedTypesChanged(ModelTypeSet encrypted_types, void OnEncryptedTypesChanged(ModelTypeSet encrypted_types,
bool encrypt_everything) override; bool encrypt_everything) override;
void OnEncryptionComplete() override;
void OnCryptographerStateChanged(Cryptographer* cryptographer, void OnCryptographerStateChanged(Cryptographer* cryptographer,
bool has_pending_keys) override; bool has_pending_keys) override;
void OnPassphraseTypeChanged(PassphraseType type, void OnPassphraseTypeChanged(PassphraseType type,
......
...@@ -80,9 +80,8 @@ class SyncEncryptionHandler { ...@@ -80,9 +80,8 @@ class SyncEncryptionHandler {
BootstrapTokenType type) = 0; BootstrapTokenType type) = 0;
// Called when the set of encrypted types or the encrypt // Called when the set of encrypted types or the encrypt
// everything flag has been changed. Note that encryption isn't // everything flag has been changed. Note that this doesn't imply the
// complete until the OnEncryptionComplete() notification has been // encryption is complete.
// sent (see below).
// //
// |encrypted_types| will always be a superset of // |encrypted_types| will always be a superset of
// AlwaysEncryptedUserTypes(). If |encrypt_everything| is // AlwaysEncryptedUserTypes(). If |encrypt_everything| is
...@@ -94,10 +93,6 @@ class SyncEncryptionHandler { ...@@ -94,10 +93,6 @@ class SyncEncryptionHandler {
virtual void OnEncryptedTypesChanged(ModelTypeSet encrypted_types, virtual void OnEncryptedTypesChanged(ModelTypeSet encrypted_types,
bool encrypt_everything) = 0; bool encrypt_everything) = 0;
// Called after we finish encrypting the current set of encrypted
// types.
virtual void OnEncryptionComplete() = 0;
// The cryptographer has been updated and/or the presence of pending keys // The cryptographer has been updated and/or the presence of pending keys
// changed. // changed.
virtual void OnCryptographerStateChanged(Cryptographer* cryptographer, virtual void OnCryptographerStateChanged(Cryptographer* cryptographer,
......
...@@ -102,11 +102,6 @@ void DebugInfoEventListener::OnEncryptedTypesChanged( ...@@ -102,11 +102,6 @@ void DebugInfoEventListener::OnEncryptedTypesChanged(
CreateAndAddEvent(sync_pb::SyncEnums::ENCRYPTED_TYPES_CHANGED); CreateAndAddEvent(sync_pb::SyncEnums::ENCRYPTED_TYPES_CHANGED);
} }
void DebugInfoEventListener::OnEncryptionComplete() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
CreateAndAddEvent(sync_pb::SyncEnums::ENCRYPTION_COMPLETE);
}
void DebugInfoEventListener::OnCryptographerStateChanged( void DebugInfoEventListener::OnCryptographerStateChanged(
Cryptographer* cryptographer, Cryptographer* cryptographer,
bool has_pending_keys) { bool has_pending_keys) {
......
...@@ -63,7 +63,6 @@ class DebugInfoEventListener : public SyncManager::Observer, ...@@ -63,7 +63,6 @@ class DebugInfoEventListener : public SyncManager::Observer,
BootstrapTokenType type) override; BootstrapTokenType type) override;
void OnEncryptedTypesChanged(ModelTypeSet encrypted_types, void OnEncryptedTypesChanged(ModelTypeSet encrypted_types,
bool encrypt_everything) override; bool encrypt_everything) override;
void OnEncryptionComplete() override;
void OnCryptographerStateChanged(Cryptographer* cryptographer, void OnCryptographerStateChanged(Cryptographer* cryptographer,
bool has_pending_keys) override; bool has_pending_keys) override;
void OnPassphraseTypeChanged(PassphraseType type, void OnPassphraseTypeChanged(PassphraseType type,
......
...@@ -13,20 +13,20 @@ using DebugInfoEventListenerTest = testing::Test; ...@@ -13,20 +13,20 @@ using DebugInfoEventListenerTest = testing::Test;
TEST_F(DebugInfoEventListenerTest, VerifyEventsAdded) { TEST_F(DebugInfoEventListenerTest, VerifyEventsAdded) {
DebugInfoEventListener debug_info_event_listener; DebugInfoEventListener debug_info_event_listener;
debug_info_event_listener.CreateAndAddEvent( debug_info_event_listener.CreateAndAddEvent(
sync_pb::SyncEnums::ENCRYPTION_COMPLETE); sync_pb::SyncEnums::INITIALIZATION_COMPLETE);
ASSERT_EQ(debug_info_event_listener.events_.size(), 1U); ASSERT_EQ(debug_info_event_listener.events_.size(), 1U);
const sync_pb::DebugEventInfo& debug_info = const sync_pb::DebugEventInfo& debug_info =
debug_info_event_listener.events_.back(); debug_info_event_listener.events_.back();
ASSERT_TRUE(debug_info.has_singleton_event()); ASSERT_TRUE(debug_info.has_singleton_event());
ASSERT_EQ(debug_info.singleton_event(), ASSERT_EQ(debug_info.singleton_event(),
sync_pb::SyncEnums::ENCRYPTION_COMPLETE); sync_pb::SyncEnums::INITIALIZATION_COMPLETE);
} }
TEST_F(DebugInfoEventListenerTest, VerifyQueueSize) { TEST_F(DebugInfoEventListenerTest, VerifyQueueSize) {
DebugInfoEventListener debug_info_event_listener; DebugInfoEventListener debug_info_event_listener;
for (unsigned int i = 0; i < 2 * kMaxEntries; ++i) { for (unsigned int i = 0; i < 2 * kMaxEntries; ++i) {
debug_info_event_listener.CreateAndAddEvent( debug_info_event_listener.CreateAndAddEvent(
sync_pb::SyncEnums::ENCRYPTION_COMPLETE); sync_pb::SyncEnums::INITIALIZATION_COMPLETE);
} }
sync_pb::DebugInfo debug_info = debug_info_event_listener.GetDebugInfo(); sync_pb::DebugInfo debug_info = debug_info_event_listener.GetDebugInfo();
debug_info_event_listener.ClearDebugInfo(); debug_info_event_listener.ClearDebugInfo();
...@@ -37,20 +37,20 @@ TEST_F(DebugInfoEventListenerTest, VerifyQueueSize) { ...@@ -37,20 +37,20 @@ TEST_F(DebugInfoEventListenerTest, VerifyQueueSize) {
TEST_F(DebugInfoEventListenerTest, VerifyGetEvents) { TEST_F(DebugInfoEventListenerTest, VerifyGetEvents) {
DebugInfoEventListener debug_info_event_listener; DebugInfoEventListener debug_info_event_listener;
debug_info_event_listener.CreateAndAddEvent( debug_info_event_listener.CreateAndAddEvent(
sync_pb::SyncEnums::ENCRYPTION_COMPLETE); sync_pb::SyncEnums::INITIALIZATION_COMPLETE);
ASSERT_EQ(debug_info_event_listener.events_.size(), 1U); ASSERT_EQ(debug_info_event_listener.events_.size(), 1U);
sync_pb::DebugInfo debug_info = debug_info_event_listener.GetDebugInfo(); sync_pb::DebugInfo debug_info = debug_info_event_listener.GetDebugInfo();
ASSERT_EQ(debug_info_event_listener.events_.size(), 1U); ASSERT_EQ(debug_info_event_listener.events_.size(), 1U);
ASSERT_EQ(debug_info.events_size(), 1); ASSERT_EQ(debug_info.events_size(), 1);
ASSERT_TRUE(debug_info.events(0).has_singleton_event()); ASSERT_TRUE(debug_info.events(0).has_singleton_event());
ASSERT_EQ(debug_info.events(0).singleton_event(), ASSERT_EQ(debug_info.events(0).singleton_event(),
sync_pb::SyncEnums::ENCRYPTION_COMPLETE); sync_pb::SyncEnums::INITIALIZATION_COMPLETE);
} }
TEST_F(DebugInfoEventListenerTest, VerifyClearEvents) { TEST_F(DebugInfoEventListenerTest, VerifyClearEvents) {
DebugInfoEventListener debug_info_event_listener; DebugInfoEventListener debug_info_event_listener;
debug_info_event_listener.CreateAndAddEvent( debug_info_event_listener.CreateAndAddEvent(
sync_pb::SyncEnums::ENCRYPTION_COMPLETE); sync_pb::SyncEnums::INITIALIZATION_COMPLETE);
ASSERT_EQ(debug_info_event_listener.events_.size(), 1U); ASSERT_EQ(debug_info_event_listener.events_.size(), 1U);
debug_info_event_listener.ClearDebugInfo(); debug_info_event_listener.ClearDebugInfo();
ASSERT_EQ(debug_info_event_listener.events_.size(), 0U); ASSERT_EQ(debug_info_event_listener.events_.size(), 0U);
......
...@@ -87,14 +87,6 @@ void JsSyncEncryptionHandlerObserver::OnEncryptedTypesChanged( ...@@ -87,14 +87,6 @@ void JsSyncEncryptionHandlerObserver::OnEncryptedTypesChanged(
HandleJsEvent(FROM_HERE, "onEncryptedTypesChanged", JsEventDetails(&details)); HandleJsEvent(FROM_HERE, "onEncryptedTypesChanged", JsEventDetails(&details));
} }
void JsSyncEncryptionHandlerObserver::OnEncryptionComplete() {
if (!event_handler_.IsInitialized()) {
return;
}
base::DictionaryValue details;
HandleJsEvent(FROM_HERE, "onEncryptionComplete", JsEventDetails());
}
void JsSyncEncryptionHandlerObserver::OnCryptographerStateChanged( void JsSyncEncryptionHandlerObserver::OnCryptographerStateChanged(
Cryptographer* cryptographer, Cryptographer* cryptographer,
bool has_pending_keys) { bool has_pending_keys) {
......
...@@ -41,7 +41,6 @@ class JsSyncEncryptionHandlerObserver : public SyncEncryptionHandler::Observer { ...@@ -41,7 +41,6 @@ class JsSyncEncryptionHandlerObserver : public SyncEncryptionHandler::Observer {
BootstrapTokenType type) override; BootstrapTokenType type) override;
void OnEncryptedTypesChanged(ModelTypeSet encrypted_types, void OnEncryptedTypesChanged(ModelTypeSet encrypted_types,
bool encrypt_everything) override; bool encrypt_everything) override;
void OnEncryptionComplete() override;
void OnCryptographerStateChanged(Cryptographer* cryptographer, void OnCryptographerStateChanged(Cryptographer* cryptographer,
bool has_pending_keys) override; bool has_pending_keys) override;
void OnPassphraseTypeChanged(PassphraseType type, void OnPassphraseTypeChanged(PassphraseType type,
......
...@@ -45,17 +45,6 @@ class JsSyncEncryptionHandlerObserverTest : public testing::Test { ...@@ -45,17 +45,6 @@ class JsSyncEncryptionHandlerObserverTest : public testing::Test {
void PumpLoop() { base::RunLoop().RunUntilIdle(); } void PumpLoop() { base::RunLoop().RunUntilIdle(); }
}; };
TEST_F(JsSyncEncryptionHandlerObserverTest, NoArgNotifiations) {
InSequence dummy;
EXPECT_CALL(
mock_js_event_handler_,
HandleJsEvent("onEncryptionComplete", HasDetails(JsEventDetails())));
js_sync_encryption_handler_observer_.OnEncryptionComplete();
PumpLoop();
}
TEST_F(JsSyncEncryptionHandlerObserverTest, OnPassphraseRequired) { TEST_F(JsSyncEncryptionHandlerObserverTest, OnPassphraseRequired) {
InSequence dummy; InSequence dummy;
......
...@@ -209,8 +209,6 @@ void ModelTypeRegistry::OnEncryptedTypesChanged(ModelTypeSet encrypted_types, ...@@ -209,8 +209,6 @@ void ModelTypeRegistry::OnEncryptedTypesChanged(ModelTypeSet encrypted_types,
OnEncryptionStateChanged(); OnEncryptionStateChanged();
} }
void ModelTypeRegistry::OnEncryptionComplete() {}
void ModelTypeRegistry::OnCryptographerStateChanged( void ModelTypeRegistry::OnCryptographerStateChanged(
Cryptographer* cryptographer, Cryptographer* cryptographer,
bool has_pending_keys) { bool has_pending_keys) {
......
...@@ -58,7 +58,6 @@ class ModelTypeRegistry : public ModelTypeConnector, ...@@ -58,7 +58,6 @@ class ModelTypeRegistry : public ModelTypeConnector,
BootstrapTokenType type) override; BootstrapTokenType type) override;
void OnEncryptedTypesChanged(ModelTypeSet encrypted_types, void OnEncryptedTypesChanged(ModelTypeSet encrypted_types,
bool encrypt_everything) override; bool encrypt_everything) override;
void OnEncryptionComplete() override;
void OnCryptographerStateChanged(Cryptographer* cryptographer, void OnCryptographerStateChanged(Cryptographer* cryptographer,
bool has_pending_keys) override; bool has_pending_keys) override;
void OnPassphraseTypeChanged(PassphraseType type, void OnPassphraseTypeChanged(PassphraseType type,
......
...@@ -276,10 +276,6 @@ void SyncManagerImpl::OnEncryptedTypesChanged(ModelTypeSet encrypted_types, ...@@ -276,10 +276,6 @@ void SyncManagerImpl::OnEncryptedTypesChanged(ModelTypeSet encrypted_types,
allstatus_.SetEncryptedTypes(encrypted_types); allstatus_.SetEncryptedTypes(encrypted_types);
} }
void SyncManagerImpl::OnEncryptionComplete() {
// Does nothing.
}
void SyncManagerImpl::OnCryptographerStateChanged(Cryptographer* cryptographer, void SyncManagerImpl::OnCryptographerStateChanged(Cryptographer* cryptographer,
bool has_pending_keys) { bool has_pending_keys) {
allstatus_.SetCryptographerCanEncrypt(cryptographer->CanEncrypt()); allstatus_.SetCryptographerCanEncrypt(cryptographer->CanEncrypt());
......
...@@ -95,7 +95,6 @@ class SyncManagerImpl ...@@ -95,7 +95,6 @@ class SyncManagerImpl
BootstrapTokenType type) override; BootstrapTokenType type) override;
void OnEncryptedTypesChanged(ModelTypeSet encrypted_types, void OnEncryptedTypesChanged(ModelTypeSet encrypted_types,
bool encrypt_everything) override; bool encrypt_everything) override;
void OnEncryptionComplete() override;
void OnCryptographerStateChanged(Cryptographer* cryptographer, void OnCryptographerStateChanged(Cryptographer* cryptographer,
bool has_pending_keys) override; bool has_pending_keys) override;
void OnPassphraseTypeChanged(PassphraseType type, void OnPassphraseTypeChanged(PassphraseType type,
......
...@@ -122,7 +122,6 @@ class SyncEncryptionHandlerObserverMock ...@@ -122,7 +122,6 @@ class SyncEncryptionHandlerObserverMock
MOCK_METHOD2(OnBootstrapTokenUpdated, MOCK_METHOD2(OnBootstrapTokenUpdated,
void(const std::string&, BootstrapTokenType type)); // NOLINT void(const std::string&, BootstrapTokenType type)); // NOLINT
MOCK_METHOD2(OnEncryptedTypesChanged, void(ModelTypeSet, bool)); // NOLINT MOCK_METHOD2(OnEncryptedTypesChanged, void(ModelTypeSet, bool)); // NOLINT
MOCK_METHOD0(OnEncryptionComplete, void()); // NOLINT
MOCK_METHOD2(OnCryptographerStateChanged, MOCK_METHOD2(OnCryptographerStateChanged,
void(Cryptographer*, bool)); // NOLINT void(Cryptographer*, bool)); // NOLINT
MOCK_METHOD2(OnPassphraseTypeChanged, MOCK_METHOD2(OnPassphraseTypeChanged,
......
...@@ -397,12 +397,6 @@ class NigoriSyncBridgeImpl::BroadcastingObserver ...@@ -397,12 +397,6 @@ class NigoriSyncBridgeImpl::BroadcastingObserver
} }
} }
void OnEncryptionComplete() override {
for (auto& observer : observers_) {
observer.OnEncryptionComplete();
}
}
void OnCryptographerStateChanged(Cryptographer* cryptographer, void OnCryptographerStateChanged(Cryptographer* cryptographer,
bool has_pending_keys) override { bool has_pending_keys) override {
for (auto& observer : observers_) { for (auto& observer : observers_) {
......
...@@ -306,7 +306,6 @@ class MockObserver : public SyncEncryptionHandler::Observer { ...@@ -306,7 +306,6 @@ class MockObserver : public SyncEncryptionHandler::Observer {
MOCK_METHOD2(OnBootstrapTokenUpdated, MOCK_METHOD2(OnBootstrapTokenUpdated,
void(const std::string&, BootstrapTokenType type)); void(const std::string&, BootstrapTokenType type));
MOCK_METHOD2(OnEncryptedTypesChanged, void(ModelTypeSet, bool)); MOCK_METHOD2(OnEncryptedTypesChanged, void(ModelTypeSet, bool));
MOCK_METHOD0(OnEncryptionComplete, void());
MOCK_METHOD2(OnCryptographerStateChanged, MOCK_METHOD2(OnCryptographerStateChanged,
void(Cryptographer*, bool has_pending_keys)); void(Cryptographer*, bool has_pending_keys));
MOCK_METHOD2(OnPassphraseTypeChanged, void(PassphraseType, base::Time)); MOCK_METHOD2(OnPassphraseTypeChanged, void(PassphraseType, base::Time));
......
...@@ -282,7 +282,7 @@ const char* ProtoEnumToString( ...@@ -282,7 +282,7 @@ const char* ProtoEnumToString(
ENUM_CASE(sync_pb::SyncEnums, PASSPHRASE_ACCEPTED); ENUM_CASE(sync_pb::SyncEnums, PASSPHRASE_ACCEPTED);
ENUM_CASE(sync_pb::SyncEnums, INITIALIZATION_COMPLETE); ENUM_CASE(sync_pb::SyncEnums, INITIALIZATION_COMPLETE);
ENUM_CASE(sync_pb::SyncEnums, STOP_SYNCING_PERMANENTLY); ENUM_CASE(sync_pb::SyncEnums, STOP_SYNCING_PERMANENTLY);
ENUM_CASE(sync_pb::SyncEnums, ENCRYPTION_COMPLETE); ENUM_CASE(sync_pb::SyncEnums, DEPRECATED_ENCRYPTION_COMPLETE);
ENUM_CASE(sync_pb::SyncEnums, ACTIONABLE_ERROR); ENUM_CASE(sync_pb::SyncEnums, ACTIONABLE_ERROR);
ENUM_CASE(sync_pb::SyncEnums, ENCRYPTED_TYPES_CHANGED); ENUM_CASE(sync_pb::SyncEnums, ENCRYPTED_TYPES_CHANGED);
ENUM_CASE(sync_pb::SyncEnums, PASSPHRASE_TYPE_CHANGED); ENUM_CASE(sync_pb::SyncEnums, PASSPHRASE_TYPE_CHANGED);
......
...@@ -34,7 +34,7 @@ message SyncEnums { ...@@ -34,7 +34,7 @@ message SyncEnums {
// the server in the absence of bugs. // the server in the absence of bugs.
STOP_SYNCING_PERMANENTLY = 6; STOP_SYNCING_PERMANENTLY = 6;
// Client has finished encrypting all data. // Client has finished encrypting all data.
ENCRYPTION_COMPLETE = 7; DEPRECATED_ENCRYPTION_COMPLETE = 7 [deprecated = true];
// Client received an actionable error. // Client received an actionable error.
ACTIONABLE_ERROR = 8; ACTIONABLE_ERROR = 8;
// Set of encrypted types has changed. // Set of encrypted types has changed.
......
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