Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: components/sync/driver/glue/sync_backend_host_core.cc

Issue 2663783002: [Sync] Split encryption state and logic out of PSS and SBHI. (Closed)
Patch Set: Tweak comment. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/sync/driver/glue/sync_backend_host_core.cc
diff --git a/components/sync/driver/glue/sync_backend_host_core.cc b/components/sync/driver/glue/sync_backend_host_core.cc
index 0751ba27135980815f9b139866e511dc56e74116..97dc6c58799fe5a67082be76dff31178f201b296 100644
--- a/components/sync/driver/glue/sync_backend_host_core.cc
+++ b/components/sync/driver/glue/sync_backend_host_core.cc
@@ -114,7 +114,9 @@ void SyncBackendHostCore::OnInitializationComplete(
// the initializing downloading control types or initializing the encryption
// handler in order to receive notifications triggered during encryption
// startup.
- sync_manager_->GetEncryptionHandler()->AddObserver(this);
+ DCHECK(encryption_observer_proxy_);
+ sync_manager_->GetEncryptionHandler()->AddObserver(
+ encryption_observer_proxy_.get());
// Sync manager initialization is complete, so we can schedule recurring
// SaveChanges.
@@ -175,64 +177,6 @@ void SyncBackendHostCore::OnConnectionStatusChange(ConnectionStatus status) {
status);
}
-void SyncBackendHostCore::OnPassphraseRequired(
- PassphraseRequiredReason reason,
- const sync_pb::EncryptedData& pending_keys) {
- DCHECK(thread_checker_.CalledOnValidThread());
- host_.Call(FROM_HERE, &SyncBackendHostImpl::NotifyPassphraseRequired, reason,
- pending_keys);
-}
-
-void SyncBackendHostCore::OnPassphraseAccepted() {
- DCHECK(thread_checker_.CalledOnValidThread());
- host_.Call(FROM_HERE, &SyncBackendHostImpl::NotifyPassphraseAccepted);
-}
-
-void SyncBackendHostCore::OnBootstrapTokenUpdated(
- const std::string& bootstrap_token,
- BootstrapTokenType type) {
- DCHECK(thread_checker_.CalledOnValidThread());
- host_.Call(FROM_HERE, &SyncBackendHostImpl::PersistEncryptionBootstrapToken,
- bootstrap_token, type);
-}
-
-void SyncBackendHostCore::OnEncryptedTypesChanged(ModelTypeSet encrypted_types,
- bool encrypt_everything) {
- DCHECK(thread_checker_.CalledOnValidThread());
- // NOTE: We're in a transaction.
- host_.Call(FROM_HERE, &SyncBackendHostImpl::NotifyEncryptedTypesChanged,
- encrypted_types, encrypt_everything);
-}
-
-void SyncBackendHostCore::OnEncryptionComplete() {
- DCHECK(thread_checker_.CalledOnValidThread());
- // NOTE: We're in a transaction.
- host_.Call(FROM_HERE, &SyncBackendHostImpl::NotifyEncryptionComplete);
-}
-
-void SyncBackendHostCore::OnCryptographerStateChanged(
- Cryptographer* cryptographer) {
- DCHECK(thread_checker_.CalledOnValidThread());
- // Do nothing.
-}
-
-void SyncBackendHostCore::OnPassphraseTypeChanged(PassphraseType type,
- base::Time passphrase_time) {
- DCHECK(thread_checker_.CalledOnValidThread());
- host_.Call(FROM_HERE,
- &SyncBackendHostImpl::HandlePassphraseTypeChangedOnFrontendLoop,
- type, passphrase_time);
-}
-
-void SyncBackendHostCore::OnLocalSetPassphraseEncryption(
- const SyncEncryptionHandler::NigoriState& nigori_state) {
- DCHECK(thread_checker_.CalledOnValidThread());
- host_.Call(
- FROM_HERE,
- &SyncBackendHostImpl::HandleLocalSetPassphraseEncryptionOnFrontendLoop,
- nigori_state);
-}
-
void SyncBackendHostCore::OnCommitCountersUpdated(
ModelType type,
const CommitCounters& counters) {
@@ -349,8 +293,12 @@ void SyncBackendHostCore::DoInitialize(SyncEngine::InitParams params) {
last_invalidation_versions_ = params.invalidation_versions;
DCHECK(!registrar_);
+ DCHECK(params.registrar);
registrar_ = std::move(params.registrar);
- DCHECK(registrar_);
+
+ DCHECK(!encryption_observer_proxy_);
+ DCHECK(params.encryption_observer_proxy);
+ encryption_observer_proxy_ = std::move(params.encryption_observer_proxy);
sync_manager_ = params.sync_manager_factory->CreateSyncManager(name_);
sync_manager_->AddObserver(this);
« no previous file with comments | « components/sync/driver/glue/sync_backend_host_core.h ('k') | components/sync/driver/glue/sync_backend_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698