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

Unified Diff: sync/sessions/model_type_registry.cc

Issue 452283003: sync: Finish non-blocking type encryption support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More cryptographer testing Created 6 years, 4 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 | « sync/sessions/model_type_registry.h ('k') | sync/sync.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/sessions/model_type_registry.cc
diff --git a/sync/sessions/model_type_registry.cc b/sync/sessions/model_type_registry.cc
index c2ba5f4cbc900e3c54c2eae49459f452b831735a..a3448464fc5d426367ac5140088ccbb6ef68f1e2 100644
--- a/sync/sessions/model_type_registry.cc
+++ b/sync/sessions/model_type_registry.cc
@@ -111,7 +111,6 @@ ModelTypeRegistry::ModelTypeRegistry(
syncable::Directory* directory,
NudgeHandler* nudge_handler)
: directory_(directory),
- cryptographer_provider_(directory_),
nudge_handler_(nudge_handler),
weak_ptr_factory_(this) {
for (size_t i = 0u; i < workers.size(); ++i) {
@@ -120,7 +119,8 @@ ModelTypeRegistry::ModelTypeRegistry(
}
}
-ModelTypeRegistry::~ModelTypeRegistry() {}
+ModelTypeRegistry::~ModelTypeRegistry() {
+}
void ModelTypeRegistry::SetEnabledDirectoryTypes(
const ModelSafeRoutingInfo& routing_info) {
@@ -198,11 +198,15 @@ void ModelTypeRegistry::ConnectSyncTypeToWorker(
// Initialize Worker -> Proxy communication channel.
scoped_ptr<ModelTypeSyncProxy> proxy(
new ModelTypeSyncProxyWrapper(proxy_impl, type_task_runner));
+ scoped_ptr<Cryptographer> cryptographer_copy;
+ if (encrypted_types_.Has(type))
+ cryptographer_copy.reset(new Cryptographer(*cryptographer_));
+
scoped_ptr<ModelTypeSyncWorkerImpl> worker(
new ModelTypeSyncWorkerImpl(type,
data_type_state,
saved_pending_updates,
- &cryptographer_provider_,
+ cryptographer_copy.Pass(),
nudge_handler_,
proxy.Pass()));
@@ -299,10 +303,54 @@ base::WeakPtr<SyncContext> ModelTypeRegistry::AsWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
}
+void ModelTypeRegistry::OnPassphraseRequired(
+ PassphraseRequiredReason reason,
+ const sync_pb::EncryptedData& pending_keys) {
+}
+
+void ModelTypeRegistry::OnPassphraseAccepted() {
+}
+
+void ModelTypeRegistry::OnBootstrapTokenUpdated(
+ const std::string& bootstrap_token,
+ BootstrapTokenType type) {
+}
+
+void ModelTypeRegistry::OnEncryptedTypesChanged(ModelTypeSet encrypted_types,
+ bool encrypt_everything) {
+ encrypted_types_ = encrypted_types;
+ OnEncryptionStateChanged();
+}
+
+void ModelTypeRegistry::OnEncryptionComplete() {
+}
+
+void ModelTypeRegistry::OnCryptographerStateChanged(
+ Cryptographer* cryptographer) {
+ cryptographer_.reset(new Cryptographer(*cryptographer));
+ OnEncryptionStateChanged();
+}
+
+void ModelTypeRegistry::OnPassphraseTypeChanged(PassphraseType type,
+ base::Time passphrase_time) {
+}
+
ModelTypeSet ModelTypeRegistry::GetEnabledDirectoryTypes() const {
return enabled_directory_types_;
}
+void ModelTypeRegistry::OnEncryptionStateChanged() {
+ for (ScopedVector<ModelTypeSyncWorkerImpl>::iterator it =
+ model_type_sync_workers_.begin();
+ it != model_type_sync_workers_.end();
+ ++it) {
+ if (encrypted_types_.Has((*it)->GetModelType())) {
+ (*it)->UpdateCryptographer(
+ make_scoped_ptr(new Cryptographer(*cryptographer_)));
+ }
+ }
+}
+
ModelTypeSet ModelTypeRegistry::GetEnabledNonBlockingTypes() const {
ModelTypeSet enabled_off_thread_types;
for (ScopedVector<ModelTypeSyncWorkerImpl>::const_iterator it =
« no previous file with comments | « sync/sessions/model_type_registry.h ('k') | sync/sync.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698