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_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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 // SyncEncryptionHandler implementation. | 78 // SyncEncryptionHandler implementation. |
79 virtual void AddObserver(Observer* observer) OVERRIDE; | 79 virtual void AddObserver(Observer* observer) OVERRIDE; |
80 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 80 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
81 virtual void Init() OVERRIDE; | 81 virtual void Init() OVERRIDE; |
82 virtual void SetEncryptionPassphrase(const std::string& passphrase, | 82 virtual void SetEncryptionPassphrase(const std::string& passphrase, |
83 bool is_explicit) OVERRIDE; | 83 bool is_explicit) OVERRIDE; |
84 virtual void SetDecryptionPassphrase(const std::string& passphrase) OVERRIDE; | 84 virtual void SetDecryptionPassphrase(const std::string& passphrase) OVERRIDE; |
85 virtual void EnableEncryptEverything() OVERRIDE; | 85 virtual void EnableEncryptEverything() OVERRIDE; |
86 virtual bool EncryptEverythingEnabled() const OVERRIDE; | 86 virtual bool EncryptEverythingEnabled() const OVERRIDE; |
87 // Can be called from any thread. | 87 virtual PassphraseState GetPassphraseState() const OVERRIDE; |
88 // TODO(zea): enforce this is only called on sync thread. | |
89 virtual bool IsUsingExplicitPassphrase() const OVERRIDE; | |
90 | 88 |
91 // NigoriHandler implementation. | 89 // NigoriHandler implementation. |
92 // Note: all methods are invoked while the caller holds a transaction. | 90 // Note: all methods are invoked while the caller holds a transaction. |
93 virtual void ApplyNigoriUpdate( | 91 virtual void ApplyNigoriUpdate( |
94 const sync_pb::NigoriSpecifics& nigori, | 92 const sync_pb::NigoriSpecifics& nigori, |
95 syncable::BaseTransaction* const trans) OVERRIDE; | 93 syncable::BaseTransaction* const trans) OVERRIDE; |
96 virtual void UpdateNigoriFromEncryptedTypes( | 94 virtual void UpdateNigoriFromEncryptedTypes( |
97 sync_pb::NigoriSpecifics* nigori, | 95 sync_pb::NigoriSpecifics* nigori, |
98 syncable::BaseTransaction* const trans) const OVERRIDE; | 96 syncable::BaseTransaction* const trans) const OVERRIDE; |
99 // Can be called from any thread. | 97 // Can be called from any thread. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // Helpers to enforce thread safety. | 183 // Helpers to enforce thread safety. |
186 // Sync's cryptographer (wrapped within a transactional holder). | 184 // Sync's cryptographer (wrapped within a transactional holder). |
187 TransactionalHolder<Cryptographer> cryptographer_holder_; | 185 TransactionalHolder<Cryptographer> cryptographer_holder_; |
188 // Sync's set of encrypted types (wrapped within a transactional holder). | 186 // Sync's set of encrypted types (wrapped within a transactional holder). |
189 TransactionalHolder<ModelTypeSet> encrypted_types_holder_; | 187 TransactionalHolder<ModelTypeSet> encrypted_types_holder_; |
190 | 188 |
191 // Sync encryption state that is only modified and accessed from the sync | 189 // Sync encryption state that is only modified and accessed from the sync |
192 // thread. | 190 // thread. |
193 // Whether all current and future types should be encrypted. | 191 // Whether all current and future types should be encrypted. |
194 bool encrypt_everything_; | 192 bool encrypt_everything_; |
195 // Whether the user is using a custom passphrase for encryption. | 193 // The current state of the passphrase required to decrypt the encryption |
196 bool explicit_passphrase_; | 194 // keys stored in the nigori node. |
| 195 PassphraseState passphrase_state_; |
197 | 196 |
198 // The number of times we've automatically (i.e. not via SetPassphrase or | 197 // The number of times we've automatically (i.e. not via SetPassphrase or |
199 // conflict resolver) updated the nigori's encryption keys in this chrome | 198 // conflict resolver) updated the nigori's encryption keys in this chrome |
200 // instantiation. | 199 // instantiation. |
201 int nigori_overwrite_count_; | 200 int nigori_overwrite_count_; |
202 | 201 |
203 DISALLOW_COPY_AND_ASSIGN(SyncEncryptionHandlerImpl); | 202 DISALLOW_COPY_AND_ASSIGN(SyncEncryptionHandlerImpl); |
204 }; | 203 }; |
205 | 204 |
206 } // namespace syncer | 205 } // namespace syncer |
207 | 206 |
208 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_IMPL_H_ | 207 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_IMPL_H_ |
OLD | NEW |