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

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

Issue 2294913009: Fill the un-encrypted metadata field in password specifics. (Closed)
Patch Set: rebased Created 4 years, 2 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 | « components/sync/syncable/base_transaction.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/syncable/write_node.cc
diff --git a/components/sync/syncable/write_node.cc b/components/sync/syncable/write_node.cc
index ea5fb7763f3b1bcfdc1c342fa8a39c3d33f5dc22..51a430bab261bd22fb426a2ba46ddafa48fc093e 100644
--- a/components/sync/syncable/write_node.cc
+++ b/components/sync/syncable/write_node.cc
@@ -10,6 +10,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "components/sync/base/cryptographer.h"
+#include "components/sync/base/sync_features.h"
#include "components/sync/engine/engine_util.h"
#include "components/sync/protocol/bookmark_specifics.pb.h"
#include "components/sync/protocol/typed_url_specifics.pb.h"
@@ -136,6 +137,14 @@ void WriteNode::SetPasswordSpecifics(
}
sync_pb::PasswordSpecifics* password_specifics =
entity_specifics.mutable_password();
+
+ const std::string metadata_url(data.signon_realm());
+ if (!IsExplicitPassphrase(GetTransaction()->GetPassphraseType()) &&
+ base::FeatureList::IsEnabled(kFillPasswordMetadata) &&
+ password_specifics->unencrypted_metadata().url() != metadata_url) {
+ password_specifics->mutable_unencrypted_metadata()->set_url(metadata_url);
+ }
+
// This will only update password_specifics if the underlying unencrypted blob
// was different from |data| or was not encrypted with the proper passphrase.
if (!cryptographer->Encrypt(data, password_specifics->mutable_encrypted())) {
« no previous file with comments | « components/sync/syncable/base_transaction.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698