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

Unified Diff: components/sync/syncable/nigori_util.cc

Issue 2278333002: Supplimentary identifier for passwords specific (Closed)
Patch Set: cleanup Created 4 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: 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.";
« components/sync/core/write_node.cc ('K') | « components/sync/syncable/nigori_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698