OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_INTERNAL_API_SYNC_ENCRYPTION_HANDLER_IMPL_H_ | 5 #ifndef SYNC_INTERNAL_API_SYNC_ENCRYPTION_HANDLER_IMPL_H_ |
6 #define SYNC_INTERNAL_API_SYNC_ENCRYPTION_HANDLER_IMPL_H_ | 6 #define SYNC_INTERNAL_API_SYNC_ENCRYPTION_HANDLER_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // thread unless explicitly noted otherwise. | 44 // thread unless explicitly noted otherwise. |
45 class SYNC_EXPORT_PRIVATE SyncEncryptionHandlerImpl | 45 class SYNC_EXPORT_PRIVATE SyncEncryptionHandlerImpl |
46 : public SyncEncryptionHandler, | 46 : public SyncEncryptionHandler, |
47 public syncable::NigoriHandler { | 47 public syncable::NigoriHandler { |
48 public: | 48 public: |
49 SyncEncryptionHandlerImpl( | 49 SyncEncryptionHandlerImpl( |
50 UserShare* user_share, | 50 UserShare* user_share, |
51 Encryptor* encryptor, | 51 Encryptor* encryptor, |
52 const std::string& restored_key_for_bootstrapping, | 52 const std::string& restored_key_for_bootstrapping, |
53 const std::string& restored_keystore_key_for_bootstrapping); | 53 const std::string& restored_keystore_key_for_bootstrapping); |
54 virtual ~SyncEncryptionHandlerImpl(); | 54 ~SyncEncryptionHandlerImpl() override; |
55 | 55 |
56 // SyncEncryptionHandler implementation. | 56 // SyncEncryptionHandler implementation. |
57 virtual void AddObserver(Observer* observer) override; | 57 void AddObserver(Observer* observer) override; |
58 virtual void RemoveObserver(Observer* observer) override; | 58 void RemoveObserver(Observer* observer) override; |
59 virtual void Init() override; | 59 void Init() override; |
60 virtual void SetEncryptionPassphrase(const std::string& passphrase, | 60 void SetEncryptionPassphrase(const std::string& passphrase, |
61 bool is_explicit) override; | 61 bool is_explicit) override; |
62 virtual void SetDecryptionPassphrase(const std::string& passphrase) override; | 62 void SetDecryptionPassphrase(const std::string& passphrase) override; |
63 virtual void EnableEncryptEverything() override; | 63 void EnableEncryptEverything() override; |
64 virtual bool EncryptEverythingEnabled() const override; | 64 bool EncryptEverythingEnabled() const override; |
65 virtual PassphraseType GetPassphraseType() const override; | 65 PassphraseType GetPassphraseType() const override; |
66 | 66 |
67 // NigoriHandler implementation. | 67 // NigoriHandler implementation. |
68 // Note: all methods are invoked while the caller holds a transaction. | 68 // Note: all methods are invoked while the caller holds a transaction. |
69 virtual void ApplyNigoriUpdate( | 69 void ApplyNigoriUpdate(const sync_pb::NigoriSpecifics& nigori, |
70 const sync_pb::NigoriSpecifics& nigori, | 70 syncable::BaseTransaction* const trans) override; |
71 syncable::BaseTransaction* const trans) override; | 71 void UpdateNigoriFromEncryptedTypes( |
72 virtual void UpdateNigoriFromEncryptedTypes( | |
73 sync_pb::NigoriSpecifics* nigori, | 72 sync_pb::NigoriSpecifics* nigori, |
74 syncable::BaseTransaction* const trans) const override; | 73 syncable::BaseTransaction* const trans) const override; |
75 virtual bool NeedKeystoreKey( | 74 bool NeedKeystoreKey(syncable::BaseTransaction* const trans) const override; |
76 syncable::BaseTransaction* const trans) const override; | 75 bool SetKeystoreKeys( |
77 virtual bool SetKeystoreKeys( | |
78 const google::protobuf::RepeatedPtrField<google::protobuf::string>& keys, | 76 const google::protobuf::RepeatedPtrField<google::protobuf::string>& keys, |
79 syncable::BaseTransaction* const trans) override; | 77 syncable::BaseTransaction* const trans) override; |
80 // Can be called from any thread. | 78 // Can be called from any thread. |
81 virtual ModelTypeSet GetEncryptedTypes( | 79 ModelTypeSet GetEncryptedTypes( |
82 syncable::BaseTransaction* const trans) const override; | 80 syncable::BaseTransaction* const trans) const override; |
83 | 81 |
84 // Unsafe getters. Use only if sync is not up and running and there is no risk | 82 // Unsafe getters. Use only if sync is not up and running and there is no risk |
85 // of other threads calling this. | 83 // of other threads calling this. |
86 Cryptographer* GetCryptographerUnsafe(); | 84 Cryptographer* GetCryptographerUnsafe(); |
87 ModelTypeSet GetEncryptedTypesUnsafe(); | 85 ModelTypeSet GetEncryptedTypesUnsafe(); |
88 | 86 |
89 bool MigratedToKeystore(); | 87 bool MigratedToKeystore(); |
90 base::Time migration_time() const; | 88 base::Time migration_time() const; |
91 base::Time custom_passphrase_time() const; | 89 base::Time custom_passphrase_time() const; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 base::Time custom_passphrase_time_; | 304 base::Time custom_passphrase_time_; |
307 | 305 |
308 base::WeakPtrFactory<SyncEncryptionHandlerImpl> weak_ptr_factory_; | 306 base::WeakPtrFactory<SyncEncryptionHandlerImpl> weak_ptr_factory_; |
309 | 307 |
310 DISALLOW_COPY_AND_ASSIGN(SyncEncryptionHandlerImpl); | 308 DISALLOW_COPY_AND_ASSIGN(SyncEncryptionHandlerImpl); |
311 }; | 309 }; |
312 | 310 |
313 } // namespace syncer | 311 } // namespace syncer |
314 | 312 |
315 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_IMPL_H_ | 313 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_IMPL_H_ |
OLD | NEW |