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

Unified Diff: components/sync/engine_impl/model_type_worker.h

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
Index: components/sync/engine_impl/model_type_worker.h
diff --git a/components/sync/engine_impl/model_type_worker.h b/components/sync/engine_impl/model_type_worker.h
index 4d480415e6d4a96e9119fb49e70a73e7abd0ba2c..aefaaee6cfcd9374025b09be3ba51fcc3f3fb4f0 100644
--- a/components/sync/engine_impl/model_type_worker.h
+++ b/components/sync/engine_impl/model_type_worker.h
@@ -88,6 +88,10 @@ class ModelTypeWorker : public UpdateHandler,
std::unique_ptr<CommitContribution> GetContribution(
size_t max_entries) override;
+ // An alternative way to drive sending data to the processor, that should be
+ // called when a new encryption mechanism is ready.
+ void EncryptionAcceptedApplyUpdates();
+
// Callback for when our contribution gets a response.
void OnCommitResponse(CommitResponseDataList* response_list);
@@ -109,6 +113,10 @@ class ModelTypeWorker : public UpdateHandler,
// settings in a good state.
bool CanCommitItems() const;
+ // Returns true if this type should stop communicating because of outstanding
+ // encryption issues and must wait for keys to be updated.
+ bool BlockForEncryption() const;
+
// Takes |commit_entity| populated from fields of WorkerEntityTracker and
// adjusts some fields before committing to server. Adjustments include
// generating client-assigned ID, encrypting data, etc.
@@ -120,6 +128,17 @@ class ModelTypeWorker : public UpdateHandler,
// keys to the processor to trigger re-encryption if necessary.
void OnCryptographerUpdated();
+ // Updates the encryption key name stored in |model_type_state_| if it differs
+ // from the default encryption key name in |cryptographer_|. Returns whether
+ // an update occured.
+ bool UpdateEncryptionKeyName();
+
+ // Iterates through all elements in |entities_| and tries to decrypt anything
+ // that has encrypted data. Also updates |has_encrypted_updates_| to reflect
+ // whether anything in |entities_| was not decryptable by |cryptographer_|.
+ // Should only be called during a GetUpdates cycle.
+ void DecryptedStoredEntities();
+
// Attempts to decrypt the given specifics and return them in the |out|
// parameter. Assumes cryptographer_->CanDecrypt(specifics) returned true.
//
@@ -173,6 +192,9 @@ class ModelTypeWorker : public UpdateHandler,
// they can all be sent to the processor at once.
UpdateResponseDataList pending_updates_;
+ // Whether there are outstanding encrypted updates in |entities_|.
+ bool has_encrypted_updates_ = false;
+
base::ThreadChecker thread_checker_;
base::WeakPtrFactory<ModelTypeWorker> weak_ptr_factory_;
};
« no previous file with comments | « components/sync/engine_impl/model_type_registry.cc ('k') | components/sync/engine_impl/model_type_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698