| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sync/test/fake_sync_encryption_handler.h" | 5 #include "sync/test/fake_sync_encryption_handler.h" |
| 6 | 6 |
| 7 #include "sync/protocol/nigori_specifics.pb.h" | 7 #include "sync/protocol/nigori_specifics.pb.h" |
| 8 #include "sync/syncable/nigori_util.h" | 8 #include "sync/syncable/nigori_util.h" |
| 9 | 9 |
| 10 namespace syncer { | 10 namespace syncer { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 } | 50 } |
| 51 | 51 |
| 52 void FakeSyncEncryptionHandler::UpdateNigoriFromEncryptedTypes( | 52 void FakeSyncEncryptionHandler::UpdateNigoriFromEncryptedTypes( |
| 53 sync_pb::NigoriSpecifics* nigori, | 53 sync_pb::NigoriSpecifics* nigori, |
| 54 syncable::BaseTransaction* const trans) const { | 54 syncable::BaseTransaction* const trans) const { |
| 55 syncable::UpdateNigoriFromEncryptedTypes(encrypted_types_, | 55 syncable::UpdateNigoriFromEncryptedTypes(encrypted_types_, |
| 56 encrypt_everything_, | 56 encrypt_everything_, |
| 57 nigori); | 57 nigori); |
| 58 } | 58 } |
| 59 | 59 |
| 60 bool FakeSyncEncryptionHandler::NeedKeystoreKey( |
| 61 syncable::BaseTransaction* const trans) const { |
| 62 return keystore_key_.empty(); |
| 63 } |
| 64 |
| 65 bool FakeSyncEncryptionHandler::SetKeystoreKey( |
| 66 const std::string& key, |
| 67 syncable::BaseTransaction* const trans) { |
| 68 if (!keystore_key_.empty() || key.empty()) |
| 69 return false; |
| 70 keystore_key_ = key; |
| 71 |
| 72 DVLOG(1) << "Keystore bootstrap token updated."; |
| 73 FOR_EACH_OBSERVER(SyncEncryptionHandler::Observer, observers_, |
| 74 OnBootstrapTokenUpdated(key, |
| 75 KEYSTORE_BOOTSTRAP_TOKEN)); |
| 76 return true; |
| 77 } |
| 78 |
| 60 ModelTypeSet FakeSyncEncryptionHandler::GetEncryptedTypes( | 79 ModelTypeSet FakeSyncEncryptionHandler::GetEncryptedTypes( |
| 61 syncable::BaseTransaction* const trans) const { | 80 syncable::BaseTransaction* const trans) const { |
| 62 return encrypted_types_; | 81 return encrypted_types_; |
| 63 } | 82 } |
| 64 | 83 |
| 65 void FakeSyncEncryptionHandler::AddObserver(Observer* observer) { | 84 void FakeSyncEncryptionHandler::AddObserver(Observer* observer) { |
| 66 observers_.AddObserver(observer); | 85 observers_.AddObserver(observer); |
| 67 } | 86 } |
| 68 | 87 |
| 69 void FakeSyncEncryptionHandler::RemoveObserver(Observer* observer) { | 88 void FakeSyncEncryptionHandler::RemoveObserver(Observer* observer) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 94 | 113 |
| 95 bool FakeSyncEncryptionHandler::EncryptEverythingEnabled() const { | 114 bool FakeSyncEncryptionHandler::EncryptEverythingEnabled() const { |
| 96 return encrypt_everything_; | 115 return encrypt_everything_; |
| 97 } | 116 } |
| 98 | 117 |
| 99 PassphraseState FakeSyncEncryptionHandler::GetPassphraseState() const { | 118 PassphraseState FakeSyncEncryptionHandler::GetPassphraseState() const { |
| 100 return passphrase_state_; | 119 return passphrase_state_; |
| 101 } | 120 } |
| 102 | 121 |
| 103 } // namespace syncer | 122 } // namespace syncer |
| OLD | NEW |