Index: components/sync/syncable/nigori_util.cc |
diff --git a/components/sync/syncable/nigori_util.cc b/components/sync/syncable/nigori_util.cc |
index 96e687d0351dc7f0a63e8264fce11454ada10d58..c9e95492c0a4925f24c4a04264d5bbf0f45f6205 100644 |
--- a/components/sync/syncable/nigori_util.cc |
+++ b/components/sync/syncable/nigori_util.cc |
@@ -13,6 +13,7 @@ |
#include "base/json/json_writer.h" |
#include "components/sync/base/cryptographer.h" |
+#include "components/sync/base/passphrase_type.h" |
#include "components/sync/syncable/directory.h" |
#include "components/sync/syncable/entry.h" |
#include "components/sync/syncable/mutable_entry.h" |
@@ -147,6 +148,14 @@ bool VerifyDataTypeEncryptionForTest(BaseTransaction* const trans, |
bool UpdateEntryWithEncryption(BaseTransaction* const trans, |
const sync_pb::EntitySpecifics& new_specifics, |
syncable::MutableEntry* entry) { |
+ return UpdateEntryWithEncryption(trans, new_specifics, entry, |
+ syncer::PassphraseType::UNDEFINED); |
+} |
+ |
+bool UpdateEntryWithEncryption(BaseTransaction* const trans, |
+ const sync_pb::EntitySpecifics& new_specifics, |
+ syncable::MutableEntry* entry, |
+ PassphraseType passphrase_type) { |
NigoriHandler* nigori_handler = trans->directory()->GetNigoriHandler(); |
Cryptographer* cryptographer = trans->directory()->GetCryptographer(trans); |
ModelType type = GetModelTypeFromSpecifics(new_specifics); |
@@ -225,6 +234,13 @@ bool UpdateEntryWithEncryption(BaseTransaction* const trans, |
bookmark_specifics->set_title(kEncryptedString); |
} |
} |
+ |
+ if (type == PASSWORDS && IsExplicitPassphrase(passphrase_type)) { |
+ sync_pb::PasswordSpecifics* password_specifics = |
+ generated_specifics.mutable_password(); |
+ password_specifics->clear_unencrypted_metadata(); |
+ } |
+ |
entry->PutSpecifics(generated_specifics); |
DVLOG(1) << "Overwriting specifics of type " << ModelTypeToString(type) |
<< " and marking for syncing."; |