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

Unified Diff: components/sync/engine_impl/model_type_registry.cc

Issue 2401083003: [Sync] Adding integration tests for USS encryption and fixing a worker bug. (Closed)
Patch Set: Updated for rkaplow@'s comments. Created 4 years, 2 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
« no previous file with comments | « components/sync/engine/sync_encryption_handler.h ('k') | components/sync/engine_impl/model_type_worker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/engine_impl/model_type_registry.cc
diff --git a/components/sync/engine_impl/model_type_registry.cc b/components/sync/engine_impl/model_type_registry.cc
index 9cabe008079c3893c332060342ff7204916ae41a..22051cde62d70dd30cb8e65ec05df9e745243f6f 100644
--- a/components/sync/engine_impl/model_type_registry.cc
+++ b/components/sync/engine_impl/model_type_registry.cc
@@ -260,7 +260,14 @@ void ModelTypeRegistry::OnPassphraseRequired(
PassphraseRequiredReason reason,
const sync_pb::EncryptedData& pending_keys) {}
-void ModelTypeRegistry::OnPassphraseAccepted() {}
+void ModelTypeRegistry::OnPassphraseAccepted() {
+ for (ScopedVector<ModelTypeWorker>::iterator it = model_type_workers_.begin();
+ it != model_type_workers_.end(); ++it) {
+ if (encrypted_types_.Has((*it)->GetModelType())) {
+ (*it)->EncryptionAcceptedApplyUpdates();
+ }
+ }
+}
void ModelTypeRegistry::OnBootstrapTokenUpdated(
const std::string& bootstrap_token,
@@ -268,6 +275,11 @@ void ModelTypeRegistry::OnBootstrapTokenUpdated(
void ModelTypeRegistry::OnEncryptedTypesChanged(ModelTypeSet encrypted_types,
bool encrypt_everything) {
+ // TODO(skym): This does not handle reducing the number of encrypted types
+ // correctly. They're removed from |encrypted_types_| but corresponding
+ // workers never have their Cryptographers removed. This probably is not a use
+ // case that currently needs to be supported, but it should be guarded against
+ // here.
encrypted_types_ = encrypted_types;
OnEncryptionStateChanged();
}
« no previous file with comments | « components/sync/engine/sync_encryption_handler.h ('k') | components/sync/engine_impl/model_type_worker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698