| 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 #ifndef SYNC_SYNCABLE_TEST_FAKE_SYNC_ENCRYPTION_HANDLER_H_ | 5 #ifndef SYNC_SYNCABLE_TEST_FAKE_SYNC_ENCRYPTION_HANDLER_H_ |
| 6 #define SYNC_SYNCABLE_TEST_FAKE_SYNC_ENCRYPTION_HANDLER_H_ | 6 #define SYNC_SYNCABLE_TEST_FAKE_SYNC_ENCRYPTION_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // (setting pending keys, installing keys). | 22 // (setting pending keys, installing keys). |
| 23 // Note: NOT thread safe. If threads attempt to check encryption state | 23 // Note: NOT thread safe. If threads attempt to check encryption state |
| 24 // while another thread is modifying it, races can occur. | 24 // while another thread is modifying it, races can occur. |
| 25 class FakeSyncEncryptionHandler : public SyncEncryptionHandler, | 25 class FakeSyncEncryptionHandler : public SyncEncryptionHandler, |
| 26 public syncable::NigoriHandler { | 26 public syncable::NigoriHandler { |
| 27 public: | 27 public: |
| 28 FakeSyncEncryptionHandler(); | 28 FakeSyncEncryptionHandler(); |
| 29 virtual ~FakeSyncEncryptionHandler(); | 29 virtual ~FakeSyncEncryptionHandler(); |
| 30 | 30 |
| 31 // SyncEncryptionHandler implementation. | 31 // SyncEncryptionHandler implementation. |
| 32 virtual void AddObserver(Observer* observer) OVERRIDE; | 32 virtual void AddObserver(Observer* observer) override; |
| 33 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 33 virtual void RemoveObserver(Observer* observer) override; |
| 34 virtual void Init() OVERRIDE; | 34 virtual void Init() override; |
| 35 virtual void SetEncryptionPassphrase(const std::string& passphrase, | 35 virtual void SetEncryptionPassphrase(const std::string& passphrase, |
| 36 bool is_explicit) OVERRIDE; | 36 bool is_explicit) override; |
| 37 virtual void SetDecryptionPassphrase(const std::string& passphrase) OVERRIDE; | 37 virtual void SetDecryptionPassphrase(const std::string& passphrase) override; |
| 38 virtual void EnableEncryptEverything() OVERRIDE; | 38 virtual void EnableEncryptEverything() override; |
| 39 virtual bool EncryptEverythingEnabled() const OVERRIDE; | 39 virtual bool EncryptEverythingEnabled() const override; |
| 40 virtual PassphraseType GetPassphraseType() const OVERRIDE; | 40 virtual PassphraseType GetPassphraseType() const override; |
| 41 | 41 |
| 42 // NigoriHandler implemenation. | 42 // NigoriHandler implemenation. |
| 43 virtual void ApplyNigoriUpdate( | 43 virtual void ApplyNigoriUpdate( |
| 44 const sync_pb::NigoriSpecifics& nigori, | 44 const sync_pb::NigoriSpecifics& nigori, |
| 45 syncable::BaseTransaction* const trans) OVERRIDE; | 45 syncable::BaseTransaction* const trans) override; |
| 46 virtual void UpdateNigoriFromEncryptedTypes( | 46 virtual void UpdateNigoriFromEncryptedTypes( |
| 47 sync_pb::NigoriSpecifics* nigori, | 47 sync_pb::NigoriSpecifics* nigori, |
| 48 syncable::BaseTransaction* const trans) const OVERRIDE; | 48 syncable::BaseTransaction* const trans) const override; |
| 49 virtual bool NeedKeystoreKey( | 49 virtual bool NeedKeystoreKey( |
| 50 syncable::BaseTransaction* const trans) const OVERRIDE; | 50 syncable::BaseTransaction* const trans) const override; |
| 51 virtual bool SetKeystoreKeys( | 51 virtual bool SetKeystoreKeys( |
| 52 const google::protobuf::RepeatedPtrField<google::protobuf::string>& keys, | 52 const google::protobuf::RepeatedPtrField<google::protobuf::string>& keys, |
| 53 syncable::BaseTransaction* const trans) OVERRIDE; | 53 syncable::BaseTransaction* const trans) override; |
| 54 virtual ModelTypeSet GetEncryptedTypes( | 54 virtual ModelTypeSet GetEncryptedTypes( |
| 55 syncable::BaseTransaction* const trans) const OVERRIDE; | 55 syncable::BaseTransaction* const trans) const override; |
| 56 | 56 |
| 57 Cryptographer* cryptographer() { return &cryptographer_; } | 57 Cryptographer* cryptographer() { return &cryptographer_; } |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 ObserverList<SyncEncryptionHandler::Observer> observers_; | 60 ObserverList<SyncEncryptionHandler::Observer> observers_; |
| 61 ModelTypeSet encrypted_types_; | 61 ModelTypeSet encrypted_types_; |
| 62 bool encrypt_everything_; | 62 bool encrypt_everything_; |
| 63 PassphraseType passphrase_type_; | 63 PassphraseType passphrase_type_; |
| 64 | 64 |
| 65 FakeEncryptor encryptor_; | 65 FakeEncryptor encryptor_; |
| 66 Cryptographer cryptographer_; | 66 Cryptographer cryptographer_; |
| 67 std::string keystore_key_; | 67 std::string keystore_key_; |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 } // namespace syncer | 70 } // namespace syncer |
| 71 | 71 |
| 72 #endif // SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_SYNC_ENCRYPTION_HANDLER_H_ | 72 #endif // SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_SYNC_ENCRYPTION_HANDLER_H_ |
| OLD | NEW |