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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 virtual void AddObserver(Observer* observer) OVERRIDE; | 55 virtual void AddObserver(Observer* observer) OVERRIDE; |
56 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 56 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
57 virtual void Init() OVERRIDE; | 57 virtual void Init() OVERRIDE; |
58 virtual void SetEncryptionPassphrase(const std::string& passphrase, | 58 virtual void SetEncryptionPassphrase(const std::string& passphrase, |
59 bool is_explicit) OVERRIDE; | 59 bool is_explicit) OVERRIDE; |
60 virtual void SetDecryptionPassphrase(const std::string& passphrase) OVERRIDE; | 60 virtual void SetDecryptionPassphrase(const std::string& passphrase) OVERRIDE; |
61 virtual void EnableEncryptEverything() OVERRIDE; | 61 virtual void EnableEncryptEverything() OVERRIDE; |
62 virtual bool EncryptEverythingEnabled() const OVERRIDE; | 62 virtual bool EncryptEverythingEnabled() const OVERRIDE; |
63 virtual PassphraseType GetPassphraseType() const OVERRIDE; | 63 virtual PassphraseType GetPassphraseType() const OVERRIDE; |
64 | 64 |
65 // TODO(zea): provide a method for getting the time at which the nigori | |
66 // node was migrated. | |
67 | |
68 // NigoriHandler implementation. | 65 // NigoriHandler implementation. |
69 // Note: all methods are invoked while the caller holds a transaction. | 66 // Note: all methods are invoked while the caller holds a transaction. |
70 virtual void ApplyNigoriUpdate( | 67 virtual void ApplyNigoriUpdate( |
71 const sync_pb::NigoriSpecifics& nigori, | 68 const sync_pb::NigoriSpecifics& nigori, |
72 syncable::BaseTransaction* const trans) OVERRIDE; | 69 syncable::BaseTransaction* const trans) OVERRIDE; |
73 virtual void UpdateNigoriFromEncryptedTypes( | 70 virtual void UpdateNigoriFromEncryptedTypes( |
74 sync_pb::NigoriSpecifics* nigori, | 71 sync_pb::NigoriSpecifics* nigori, |
75 syncable::BaseTransaction* const trans) const OVERRIDE; | 72 syncable::BaseTransaction* const trans) const OVERRIDE; |
76 virtual bool NeedKeystoreKey( | 73 virtual bool NeedKeystoreKey( |
77 syncable::BaseTransaction* const trans) const OVERRIDE; | 74 syncable::BaseTransaction* const trans) const OVERRIDE; |
78 virtual bool SetKeystoreKey( | 75 virtual bool SetKeystoreKey( |
79 const std::string& key, | 76 const std::string& key, |
80 syncable::BaseTransaction* const trans) OVERRIDE; | 77 syncable::BaseTransaction* const trans) OVERRIDE; |
81 // Can be called from any thread. | 78 // Can be called from any thread. |
82 virtual ModelTypeSet GetEncryptedTypes( | 79 virtual ModelTypeSet GetEncryptedTypes( |
83 syncable::BaseTransaction* const trans) const OVERRIDE; | 80 syncable::BaseTransaction* const trans) const OVERRIDE; |
84 | 81 |
85 // 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 |
86 // of other threads calling this. | 83 // of other threads calling this. |
87 Cryptographer* GetCryptographerUnsafe(); | 84 Cryptographer* GetCryptographerUnsafe(); |
88 ModelTypeSet GetEncryptedTypesUnsafe(); | 85 ModelTypeSet GetEncryptedTypesUnsafe(); |
89 | 86 |
90 bool MigratedToKeystore(); | 87 bool MigratedToKeystore(); |
88 base::Time GetKeystoreMigrationTime() const; | |
91 | 89 |
92 private: | 90 private: |
93 FRIEND_TEST_ALL_PREFIXES(SyncEncryptionHandlerImplTest, | 91 FRIEND_TEST_ALL_PREFIXES(SyncEncryptionHandlerImplTest, |
94 NigoriEncryptionTypes); | 92 NigoriEncryptionTypes); |
95 FRIEND_TEST_ALL_PREFIXES(SyncEncryptionHandlerImplTest, | 93 FRIEND_TEST_ALL_PREFIXES(SyncEncryptionHandlerImplTest, |
96 EncryptEverythingExplicit); | 94 EncryptEverythingExplicit); |
97 FRIEND_TEST_ALL_PREFIXES(SyncEncryptionHandlerImplTest, | 95 FRIEND_TEST_ALL_PREFIXES(SyncEncryptionHandlerImplTest, |
98 EncryptEverythingImplicit); | 96 EncryptEverythingImplicit); |
99 FRIEND_TEST_ALL_PREFIXES(SyncEncryptionHandlerImplTest, | 97 FRIEND_TEST_ALL_PREFIXES(SyncEncryptionHandlerImplTest, |
100 UnknownSensitiveTypes); | 98 UnknownSensitiveTypes); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 | 279 |
282 // The keystore key provided by the server. | 280 // The keystore key provided by the server. |
283 std::string keystore_key_; | 281 std::string keystore_key_; |
284 | 282 |
285 // The number of times we've automatically (i.e. not via SetPassphrase or | 283 // The number of times we've automatically (i.e. not via SetPassphrase or |
286 // conflict resolver) updated the nigori's encryption keys in this chrome | 284 // conflict resolver) updated the nigori's encryption keys in this chrome |
287 // instantiation. | 285 // instantiation. |
288 int nigori_overwrite_count_; | 286 int nigori_overwrite_count_; |
289 | 287 |
290 // The time (in ms) the nigori was migrated to support keystore encryption. | 288 // The time (in ms) the nigori was migrated to support keystore encryption. |
291 int64 migration_time_ms_; | 289 int64 migration_time_ms_; |
akalin
2012/09/17 18:07:20
can you change this to base::Time?
Nicolas Zea
2012/09/17 21:00:24
Done.
| |
292 | 290 |
293 DISALLOW_COPY_AND_ASSIGN(SyncEncryptionHandlerImpl); | 291 DISALLOW_COPY_AND_ASSIGN(SyncEncryptionHandlerImpl); |
294 }; | 292 }; |
295 | 293 |
296 } // namespace syncer | 294 } // namespace syncer |
297 | 295 |
298 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_IMPL_H_ | 296 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_IMPL_H_ |
OLD | NEW |