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

Unified Diff: sync/test/fake_sync_encryption_handler.cc

Issue 10844005: [Sync] Refactor GetEncryptedTypes usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + add dcheck Created 8 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
« no previous file with comments | « sync/test/fake_sync_encryption_handler.h ('k') | sync/util/cryptographer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/test/fake_sync_encryption_handler.cc
diff --git a/sync/test/fake_sync_encryption_handler.cc b/sync/test/fake_sync_encryption_handler.cc
index b4908622540a7a1b343e7f8ce8086613b226ba43..c589558c4e406eff8f30574dc5bc1bf41dd893db 100644
--- a/sync/test/fake_sync_encryption_handler.cc
+++ b/sync/test/fake_sync_encryption_handler.cc
@@ -6,7 +6,6 @@
#include "sync/protocol/nigori_specifics.pb.h"
#include "sync/syncable/nigori_util.h"
-#include "sync/util/cryptographer.h"
namespace syncer {
@@ -14,7 +13,7 @@ FakeSyncEncryptionHandler::FakeSyncEncryptionHandler()
: encrypted_types_(SensitiveTypes()),
encrypt_everything_(false),
explicit_passphrase_(false),
- cryptographer_(NULL) {
+ cryptographer_(&encryptor_) {
}
FakeSyncEncryptionHandler::~FakeSyncEncryptionHandler() {}
@@ -30,21 +29,18 @@ void FakeSyncEncryptionHandler::ApplyNigoriUpdate(
if (nigori.using_explicit_passphrase())
explicit_passphrase_ = true;
- if (!cryptographer_)
- return;
-
- if (cryptographer_->CanDecrypt(nigori.encrypted()))
- cryptographer_->InstallKeys(nigori.encrypted());
- else
- cryptographer_->SetPendingKeys(nigori.encrypted());
+ if (cryptographer_.CanDecrypt(nigori.encrypted()))
+ cryptographer_.InstallKeys(nigori.encrypted());
+ else if (nigori.has_encrypted())
+ cryptographer_.SetPendingKeys(nigori.encrypted());
- if (cryptographer_->has_pending_keys()) {
+ if (cryptographer_.has_pending_keys()) {
DVLOG(1) << "OnPassPhraseRequired Sent";
- sync_pb::EncryptedData pending_keys = cryptographer_->GetPendingKeys();
+ sync_pb::EncryptedData pending_keys = cryptographer_.GetPendingKeys();
FOR_EACH_OBSERVER(SyncEncryptionHandler::Observer, observers_,
OnPassphraseRequired(REASON_DECRYPTION,
pending_keys));
- } else if (!cryptographer_->is_ready()) {
+ } else if (!cryptographer_.is_ready()) {
DVLOG(1) << "OnPassphraseRequired sent because cryptographer is not "
<< "ready";
FOR_EACH_OBSERVER(SyncEncryptionHandler::Observer, observers_,
@@ -61,6 +57,11 @@ void FakeSyncEncryptionHandler::UpdateNigoriFromEncryptedTypes(
nigori);
}
+ModelTypeSet FakeSyncEncryptionHandler::GetEncryptedTypes(
+ syncable::BaseTransaction* const trans) const {
+ return encrypted_types_;
+}
+
void FakeSyncEncryptionHandler::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
}
@@ -95,10 +96,6 @@ bool FakeSyncEncryptionHandler::EncryptEverythingEnabled() const {
return encrypt_everything_;
}
-ModelTypeSet FakeSyncEncryptionHandler::GetEncryptedTypes() const {
- return encrypted_types_;
-}
-
bool FakeSyncEncryptionHandler::IsUsingExplicitPassphrase() const {
return explicit_passphrase_;
}
« no previous file with comments | « sync/test/fake_sync_encryption_handler.h ('k') | sync/util/cryptographer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698