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

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

Issue 7878005: [Sync] Fix encrypting of sync titles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and add comment Created 9 years, 3 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/syncapi_unittest.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 d26e5cb176799729fdd09a37b1f83d17d3c39a5a..40c243134dcce2f557194a9d78e5405ceb30bd6a 100644
--- a/chrome/browser/sync/internal_api/write_node.cc
+++ b/chrome/browser/sync/internal_api/write_node.cc
@@ -77,7 +77,9 @@ bool WriteNode::UpdateEntryWithEncryption(
}
const sync_pb::EntitySpecifics& old_specifics = entry->Get(SPECIFICS);
- if (AreSpecificsEqual(cryptographer, old_specifics, generated_specifics)) {
+ if (AreSpecificsEqual(cryptographer, old_specifics, generated_specifics) &&
+ (entry->Get(syncable::NON_UNIQUE_NAME) == kEncryptedString ||
+ !generated_specifics.has_encrypted())) {
// Even if the data is the same but the old specifics are encrypted with an
// old key, we should go ahead and re-encrypt with the new key.
if ((!old_specifics.has_encrypted() &&
@@ -128,7 +130,8 @@ void WriteNode::SetTitle(const std::wstring& title) {
return; // Skip redundant changes.
// Only set NON_UNIQUE_NAME to the title if we're not encrypted.
- if (specifics.has_encrypted()) {
+ Cryptographer* cryptographer = GetTransaction()->GetCryptographer();
+ if (cryptographer->GetEncryptedTypes().count(GetModelType()) > 0) {
if (old_name != kEncryptedString)
entry_->Put(syncable::NON_UNIQUE_NAME, kEncryptedString);
} else {
« no previous file with comments | « chrome/browser/sync/internal_api/syncapi_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698