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

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: Rebase 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
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..6e1f7152fdb2da5afda5ab4fdbd580b3b258730d 100644
--- a/chrome/browser/sync/internal_api/write_node.cc
+++ b/chrome/browser/sync/internal_api/write_node.cc
@@ -56,8 +56,9 @@ bool WriteNode::UpdateEntryWithEncryption(
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.
+ new_specifics.has_encrypted() ||
+ !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 +71,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())) {

Powered by Google App Engine
This is Rietveld 408576698