Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Unified Diff: sync/internal_api/public/sync_encryption_handler.h

Issue 10824410: [Sync] Refactor passphrase state handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix last test Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sync/internal_api/public/sync_encryption_handler.h
diff --git a/sync/internal_api/public/sync_encryption_handler.h b/sync/internal_api/public/sync_encryption_handler.h
index 52e2ca3edcf4ed36055f2106a0a2175060f1ffaf..ef07b4d064fa7747445f528569b2c203b2e75480 100644
--- a/sync/internal_api/public/sync_encryption_handler.h
+++ b/sync/internal_api/public/sync_encryption_handler.h
@@ -29,9 +29,20 @@ enum PassphraseRequiredReason {
// decryption.
};
+// The different states for the encryption passphrase. These control if and how
+// the user should be prompted for a decryption passphrase.
+enum PassphraseState {
+ IMPLICIT_PASSPHRASE = 0, // GAIA-based passphrase (deprecated).
+ KEYSTORE_PASSPHRASE = 1, // Keystore passphrase.
+ FROZEN_IMPLICIT_PASSPHRASE = 2, // Frozen GAIA passphrase.
+ CUSTOM_PASSPHRASE = 3, // User-provided passphrase.
+};
+
// Sync's encryption handler. Handles tracking encrypted types, ensuring the
// cryptographer encrypts with the proper key and has the most recent keybag,
// and keeps the nigori node up to date.
+// This class is not thread safe. All methods must be invoked on the sync
akalin 2012/08/22 20:10:39 thread safe -> thread-safe also, since this is an
Nicolas Zea 2012/08/22 20:18:33 Done.
+// thread.
class SyncEncryptionHandler {
public:
// All Observer methods are done synchronously from within a transaction and
@@ -93,6 +104,9 @@ class SyncEncryptionHandler {
// Used primarily for debugging.
virtual void OnCryptographerStateChanged(Cryptographer* cryptographer) = 0;
+ // The passprhase state has changed.
+ virtual void OnPassphraseStateChanged(PassphraseState state) = 0;
+
protected:
virtual ~Observer();
};
@@ -101,7 +115,6 @@ class SyncEncryptionHandler {
virtual ~SyncEncryptionHandler();
// Add/Remove SyncEncryptionHandler::Observer's.
akalin 2012/08/22 20:10:39 no apostrophe
Nicolas Zea 2012/08/22 20:18:33 Done.
- // Must be called from sync thread.
virtual void AddObserver(Observer* observer) = 0;
virtual void RemoveObserver(Observer* observer) = 0;
@@ -138,9 +151,9 @@ class SyncEncryptionHandler {
// types are encrypted.
virtual bool EncryptEverythingEnabled() const = 0;
- // Whether the account requires a user-provided passphrase to decrypt
- // encrypted data.
- virtual bool IsUsingExplicitPassphrase() const = 0;
+ // Returns the current state of the passphrase needed to decrypt the
+ // bag encryption keys in the nigori node.
akalin 2012/08/22 20:10:39 bag -> bag of (?)
Nicolas Zea 2012/08/22 20:18:33 Done.
+ virtual PassphraseState GetPassphraseState() const = 0;
// The set of types that are always encrypted.
static ModelTypeSet SensitiveTypes();

Powered by Google App Engine
This is Rietveld 408576698