summaryrefslogtreecommitdiffstats
path: root/sync/test
diff options
context:
space:
mode:
authorzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-29 23:48:12 +0000
committerzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-29 23:48:12 +0000
commitde71c08fd406870753176a90f9fb84e3dbd645fa (patch)
tree2592190f8f028689a16e96ccf0e2ee2543456b74 /sync/test
parent118cfe57fe9e79b863f53be8500229adaf329334 (diff)
downloadchromium_src-de71c08fd406870753176a90f9fb84e3dbd645fa.zip
chromium_src-de71c08fd406870753176a90f9fb84e3dbd645fa.tar.gz
chromium_src-de71c08fd406870753176a90f9fb84e3dbd645fa.tar.bz2
[Sync] Move keystore key handling to SyncEncryptionHandlerImpl
The cryptographer has no notion of keystore keys, and we now persist the keystore key by reusing the OnBoostrapTokenUpdated method (which now takes an enum as an extra param specifying the type of token). BUG=129665 Review URL: https://chromiumcodereview.appspot.com/10878015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154007 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/test')
-rw-r--r--sync/test/fake_sync_encryption_handler.cc19
-rw-r--r--sync/test/fake_sync_encryption_handler.h6
2 files changed, 25 insertions, 0 deletions
diff --git a/sync/test/fake_sync_encryption_handler.cc b/sync/test/fake_sync_encryption_handler.cc
index fd41a5c..1dbdf8b 100644
--- a/sync/test/fake_sync_encryption_handler.cc
+++ b/sync/test/fake_sync_encryption_handler.cc
@@ -57,6 +57,25 @@ void FakeSyncEncryptionHandler::UpdateNigoriFromEncryptedTypes(
nigori);
}
+bool FakeSyncEncryptionHandler::NeedKeystoreKey(
+ syncable::BaseTransaction* const trans) const {
+ return keystore_key_.empty();
+}
+
+bool FakeSyncEncryptionHandler::SetKeystoreKey(
+ const std::string& key,
+ syncable::BaseTransaction* const trans) {
+ if (!keystore_key_.empty() || key.empty())
+ return false;
+ keystore_key_ = key;
+
+ DVLOG(1) << "Keystore bootstrap token updated.";
+ FOR_EACH_OBSERVER(SyncEncryptionHandler::Observer, observers_,
+ OnBootstrapTokenUpdated(key,
+ KEYSTORE_BOOTSTRAP_TOKEN));
+ return true;
+}
+
ModelTypeSet FakeSyncEncryptionHandler::GetEncryptedTypes(
syncable::BaseTransaction* const trans) const {
return encrypted_types_;
diff --git a/sync/test/fake_sync_encryption_handler.h b/sync/test/fake_sync_encryption_handler.h
index 7899854..082f607 100644
--- a/sync/test/fake_sync_encryption_handler.h
+++ b/sync/test/fake_sync_encryption_handler.h
@@ -46,6 +46,11 @@ class FakeSyncEncryptionHandler : public SyncEncryptionHandler,
virtual void UpdateNigoriFromEncryptedTypes(
sync_pb::NigoriSpecifics* nigori,
syncable::BaseTransaction* const trans) const OVERRIDE;
+ virtual bool NeedKeystoreKey(
+ syncable::BaseTransaction* const trans) const OVERRIDE;
+ virtual bool SetKeystoreKey(
+ const std::string& key,
+ syncable::BaseTransaction* const trans) OVERRIDE;
virtual ModelTypeSet GetEncryptedTypes(
syncable::BaseTransaction* const trans) const OVERRIDE;
@@ -59,6 +64,7 @@ class FakeSyncEncryptionHandler : public SyncEncryptionHandler,
FakeEncryptor encryptor_;
Cryptographer cryptographer_;
+ std::string keystore_key_;
};
} // namespace syncer