| 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_PUBLIC_SYNC_ENCRYPTION_HANDLER_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_H_ |
| 6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "sync/internal_api/public/base/model_type.h" | 10 #include "sync/internal_api/public/base/model_type.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // passphrase for its first attempt at | 24 // passphrase for its first attempt at |
| 25 // encryption. Happens only during | 25 // encryption. Happens only during |
| 26 // migration or upgrade. | 26 // migration or upgrade. |
| 27 REASON_DECRYPTION = 2, // The cryptographer requires a | 27 REASON_DECRYPTION = 2, // The cryptographer requires a |
| 28 // passphrase for its first attempt at | 28 // passphrase for its first attempt at |
| 29 // decryption. | 29 // decryption. |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 // The different states for the encryption passphrase. These control if and how | 32 // The different states for the encryption passphrase. These control if and how |
| 33 // the user should be prompted for a decryption passphrase. | 33 // the user should be prompted for a decryption passphrase. |
| 34 enum PassphraseState { | 34 enum PassphraseType { |
| 35 IMPLICIT_PASSPHRASE = 0, // GAIA-based passphrase (deprecated). | 35 IMPLICIT_PASSPHRASE = 0, // GAIA-based passphrase (deprecated). |
| 36 KEYSTORE_PASSPHRASE = 1, // Keystore passphrase. | 36 KEYSTORE_PASSPHRASE = 1, // Keystore passphrase. |
| 37 FROZEN_IMPLICIT_PASSPHRASE = 2, // Frozen GAIA passphrase. | 37 FROZEN_IMPLICIT_PASSPHRASE = 2, // Frozen GAIA passphrase. |
| 38 CUSTOM_PASSPHRASE = 3, // User-provided passphrase. | 38 CUSTOM_PASSPHRASE = 3, // User-provided passphrase. |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 // Enum used to distinguish which bootstrap encryption token is being updated. | 41 // Enum used to distinguish which bootstrap encryption token is being updated. |
| 42 enum BootstrapTokenType { | 42 enum BootstrapTokenType { |
| 43 PASSPHRASE_BOOTSTRAP_TOKEN, | 43 PASSPHRASE_BOOTSTRAP_TOKEN, |
| 44 KEYSTORE_BOOTSTRAP_TOKEN | 44 KEYSTORE_BOOTSTRAP_TOKEN |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // Called after we finish encrypting the current set of encrypted | 105 // Called after we finish encrypting the current set of encrypted |
| 106 // types. | 106 // types. |
| 107 virtual void OnEncryptionComplete() = 0; | 107 virtual void OnEncryptionComplete() = 0; |
| 108 | 108 |
| 109 // The cryptographer has been updated. Listeners should check that their | 109 // The cryptographer has been updated. Listeners should check that their |
| 110 // own state matches the cryptographer. | 110 // own state matches the cryptographer. |
| 111 // Used primarily for debugging. | 111 // Used primarily for debugging. |
| 112 virtual void OnCryptographerStateChanged(Cryptographer* cryptographer) = 0; | 112 virtual void OnCryptographerStateChanged(Cryptographer* cryptographer) = 0; |
| 113 | 113 |
| 114 // The passprhase state has changed. | 114 // The passprhase state has changed. |
| 115 virtual void OnPassphraseStateChanged(PassphraseState state) = 0; | 115 virtual void OnPassphraseTypeChanged(PassphraseType type) = 0; |
| 116 | 116 |
| 117 protected: | 117 protected: |
| 118 virtual ~Observer(); | 118 virtual ~Observer(); |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 SyncEncryptionHandler(); | 121 SyncEncryptionHandler(); |
| 122 virtual ~SyncEncryptionHandler(); | 122 virtual ~SyncEncryptionHandler(); |
| 123 | 123 |
| 124 // Add/Remove SyncEncryptionHandler::Observers. | 124 // Add/Remove SyncEncryptionHandler::Observers. |
| 125 virtual void AddObserver(Observer* observer) = 0; | 125 virtual void AddObserver(Observer* observer) = 0; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 153 | 153 |
| 154 // Enables encryption of all datatypes. | 154 // Enables encryption of all datatypes. |
| 155 virtual void EnableEncryptEverything() = 0; | 155 virtual void EnableEncryptEverything() = 0; |
| 156 | 156 |
| 157 // Whether encryption of all datatypes is enabled. If false, only sensitive | 157 // Whether encryption of all datatypes is enabled. If false, only sensitive |
| 158 // types are encrypted. | 158 // types are encrypted. |
| 159 virtual bool EncryptEverythingEnabled() const = 0; | 159 virtual bool EncryptEverythingEnabled() const = 0; |
| 160 | 160 |
| 161 // Returns the current state of the passphrase needed to decrypt the | 161 // Returns the current state of the passphrase needed to decrypt the |
| 162 // bag of encryption keys in the nigori node. | 162 // bag of encryption keys in the nigori node. |
| 163 virtual PassphraseState GetPassphraseState() const = 0; | 163 virtual PassphraseType GetPassphraseType() const = 0; |
| 164 | 164 |
| 165 // The set of types that are always encrypted. | 165 // The set of types that are always encrypted. |
| 166 static ModelTypeSet SensitiveTypes(); | 166 static ModelTypeSet SensitiveTypes(); |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 } // namespace syncer | 169 } // namespace syncer |
| 170 | 170 |
| 171 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_H_ | 171 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_ENCRYPTION_HANDLER_H_ |
| OLD | NEW |