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

Unified Diff: chrome/browser/sync/internal_api/write_node.cc

Issue 7795002: [Sync] Gracefully handle writing to a node when the cryptographer is not ready. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reviewer comments Created 9 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 | « chrome/browser/sync/internal_api/sync_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/internal_api/write_node.cc
diff --git a/chrome/browser/sync/internal_api/write_node.cc b/chrome/browser/sync/internal_api/write_node.cc
index 231adefadc9b4e1e1a656aaa25717fa8c14f73c5..d26e5cb176799729fdd09a37b1f83d17d3c39a5a 100644
--- a/chrome/browser/sync/internal_api/write_node.cc
+++ b/chrome/browser/sync/internal_api/write_node.cc
@@ -51,13 +51,10 @@ bool WriteNode::UpdateEntryWithEncryption(
syncable::ModelType type = syncable::GetModelTypeFromSpecifics(new_specifics);
DCHECK_GE(type, syncable::FIRST_REAL_MODEL_TYPE);
syncable::ModelTypeSet encrypted_types = cryptographer->GetEncryptedTypes();
-
sync_pb::EntitySpecifics generated_specifics;
- if (type == syncable::PASSWORDS || // Has own encryption scheme.
- type == syncable::NIGORI || // Encrypted separately.
- encrypted_types.count(type) == 0 ||
- new_specifics.has_encrypted()) {
- // No encryption required.
+ if (!SpecificsNeedsEncryption(encrypted_types, new_specifics) ||
+ !cryptographer->is_initialized()) {
+ // No encryption required or we are unable to encrypt.
generated_specifics.CopyFrom(new_specifics);
} else {
// Encrypt new_specifics into generated_specifics.
@@ -70,8 +67,6 @@ bool WriteNode::UpdateEntryWithEncryption(
<< " with content: "
<< info;
}
- if (!cryptographer->is_initialized())
- return false;
syncable::AddDefaultExtensionValue(type, &generated_specifics);
if (!cryptographer->Encrypt(new_specifics,
generated_specifics.mutable_encrypted())) {
« no previous file with comments | « chrome/browser/sync/internal_api/sync_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698