Index: chrome/browser/sync/util/cryptographer.h |
diff --git a/chrome/browser/sync/util/cryptographer.h b/chrome/browser/sync/util/cryptographer.h |
index 992c443900b17b1236bf4813cadac76cd9511fa3..9c2dde408008462869772b8707372c0e732a4f85 100644 |
--- a/chrome/browser/sync/util/cryptographer.h |
+++ b/chrome/browser/sync/util/cryptographer.h |
@@ -103,6 +103,13 @@ class Cryptographer { |
// key. |
bool CanDecryptUsingDefaultKey(const sync_pb::EncryptedData& encrypted) const; |
+ // Same as Encrypt(..), except exits early and returns true if |message| |
+ // matches the decrypted data within |encrypted| and |encrypted| was encrypted |
+ // with the current default key. This avoids unnecessarily modifying |
+ // |encrypted| if the change had no practical effect. |
+ bool EncryptIfDifferent(const ::google::protobuf::MessageLite& message, |
+ sync_pb::EncryptedData* encrypted) const; |
+ |
// Encrypts |message| into |encrypted|. Returns true unless encryption fails. |
// Note that encryption will fail if |message| isn't valid (eg. a required |
// field isn't set). |
@@ -190,6 +197,10 @@ class Cryptographer { |
FRIEND_TEST_ALL_PREFIXES(CryptographerTest, PackUnpack); |
typedef std::map<std::string, linked_ptr<const Nigori> > NigoriMap; |
+ bool EncryptImpl(const std::string& serialized, |
+ const NigoriMap::value_type* nigori, |
+ sync_pb::EncryptedData* encrypted) const; |
+ |
// Merges the given set of encrypted types with the existing set and emits a |
// notification if necessary. |
void MergeEncryptedTypes(const syncable::ModelTypeSet& encrypted_types); |