| 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 COMPONENTS_SYNC_ENGINE_SYNC_ENCRYPTION_HANDLER_H_ | 5 #ifndef COMPONENTS_SYNC_ENGINE_SYNC_ENCRYPTION_HANDLER_H_ |
| 6 #define COMPONENTS_SYNC_ENGINE_SYNC_ENCRYPTION_HANDLER_H_ | 6 #define COMPONENTS_SYNC_ENGINE_SYNC_ENCRYPTION_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // methods must be invoked on the sync thread. | 41 // methods must be invoked on the sync thread. |
| 42 class SyncEncryptionHandler { | 42 class SyncEncryptionHandler { |
| 43 public: | 43 public: |
| 44 class NigoriState; | 44 class NigoriState; |
| 45 | 45 |
| 46 // All Observer methods are done synchronously from within a transaction and | 46 // All Observer methods are done synchronously from within a transaction and |
| 47 // on the sync thread. | 47 // on the sync thread. |
| 48 class Observer { | 48 class Observer { |
| 49 public: | 49 public: |
| 50 Observer(); | 50 Observer(); |
| 51 virtual ~Observer(); |
| 51 | 52 |
| 52 // Called when user interaction is required to obtain a valid passphrase. | 53 // Called when user interaction is required to obtain a valid passphrase. |
| 53 // - If the passphrase is required for encryption, |reason| will be | 54 // - If the passphrase is required for encryption, |reason| will be |
| 54 // REASON_ENCRYPTION. | 55 // REASON_ENCRYPTION. |
| 55 // - If the passphrase is required for the decryption of data that has | 56 // - If the passphrase is required for the decryption of data that has |
| 56 // already been encrypted, |reason| will be REASON_DECRYPTION. | 57 // already been encrypted, |reason| will be REASON_DECRYPTION. |
| 57 // - If the passphrase is required because decryption failed, and a new | 58 // - If the passphrase is required because decryption failed, and a new |
| 58 // passphrase is required, |reason| will be REASON_SET_PASSPHRASE_FAILED. | 59 // passphrase is required, |reason| will be REASON_SET_PASSPHRASE_FAILED. |
| 59 // | 60 // |
| 60 // |pending_keys| is a copy of the cryptographer's pending keys, that may be | 61 // |pending_keys| is a copy of the cryptographer's pending keys, that may be |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 virtual void OnPassphraseTypeChanged(PassphraseType type, | 110 virtual void OnPassphraseTypeChanged(PassphraseType type, |
| 110 base::Time passphrase_time) = 0; | 111 base::Time passphrase_time) = 0; |
| 111 | 112 |
| 112 // The user has set a passphrase using this device. | 113 // The user has set a passphrase using this device. |
| 113 // | 114 // |
| 114 // |nigori_state| can be used to restore nigori state across | 115 // |nigori_state| can be used to restore nigori state across |
| 115 // SyncEncryptionHandlerImpl lifetimes. See also SyncEncryptionHandlerImpl's | 116 // SyncEncryptionHandlerImpl lifetimes. See also SyncEncryptionHandlerImpl's |
| 116 // RestoredNigori method. | 117 // RestoredNigori method. |
| 117 virtual void OnLocalSetPassphraseEncryption( | 118 virtual void OnLocalSetPassphraseEncryption( |
| 118 const NigoriState& nigori_state) = 0; | 119 const NigoriState& nigori_state) = 0; |
| 119 | |
| 120 protected: | |
| 121 virtual ~Observer(); | |
| 122 }; | 120 }; |
| 123 | 121 |
| 124 class NigoriState { | 122 class NigoriState { |
| 125 public: | 123 public: |
| 126 NigoriState() {} | 124 NigoriState() {} |
| 127 sync_pb::NigoriSpecifics nigori_specifics; | 125 sync_pb::NigoriSpecifics nigori_specifics; |
| 128 }; | 126 }; |
| 129 | 127 |
| 130 SyncEncryptionHandler(); | 128 SyncEncryptionHandler(); |
| 131 virtual ~SyncEncryptionHandler(); | 129 virtual ~SyncEncryptionHandler(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 // types are encrypted. | 165 // types are encrypted. |
| 168 virtual bool IsEncryptEverythingEnabled() const = 0; | 166 virtual bool IsEncryptEverythingEnabled() const = 0; |
| 169 | 167 |
| 170 // The set of types that are always encrypted. | 168 // The set of types that are always encrypted. |
| 171 static ModelTypeSet SensitiveTypes(); | 169 static ModelTypeSet SensitiveTypes(); |
| 172 }; | 170 }; |
| 173 | 171 |
| 174 } // namespace syncer | 172 } // namespace syncer |
| 175 | 173 |
| 176 #endif // COMPONENTS_SYNC_ENGINE_SYNC_ENCRYPTION_HANDLER_H_ | 174 #endif // COMPONENTS_SYNC_ENGINE_SYNC_ENCRYPTION_HANDLER_H_ |
| OLD | NEW |