diff options
author | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-26 11:54:26 +0000 |
---|---|---|
committer | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-26 11:54:26 +0000 |
commit | 25ae16e2002fa7b2da8803d0690c44c9c5d5d355 (patch) | |
tree | 1971d53e29559a49ba3266adf6cd27f158bf7171 /sync/internal_api/public/util/sync_string_conversions.cc | |
parent | 225b6d78753087dbd3ca0c2aa8a985109ef2fb1a (diff) | |
download | chromium_src-25ae16e2002fa7b2da8803d0690c44c9c5d5d355.zip chromium_src-25ae16e2002fa7b2da8803d0690c44c9c5d5d355.tar.gz chromium_src-25ae16e2002fa7b2da8803d0690c44c9c5d5d355.tar.bz2 |
[Sync] Refactor passphrase state handling
We now have an enum describing passphrase state, and cache the current value
on the UI thread via a new OnPassphraseStateChanged method.
Additionally, we log the OnPassphraseStateChanged event in the debug log info.
BUG=139848, 129665
Review URL: https://chromiumcodereview.appspot.com/10824410
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153397 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/internal_api/public/util/sync_string_conversions.cc')
-rw-r--r-- | sync/internal_api/public/util/sync_string_conversions.cc | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/sync/internal_api/public/util/sync_string_conversions.cc b/sync/internal_api/public/util/sync_string_conversions.cc index 9614203..7e404b7 100644 --- a/sync/internal_api/public/util/sync_string_conversions.cc +++ b/sync/internal_api/public/util/sync_string_conversions.cc @@ -4,16 +4,15 @@ #include "sync/internal_api/public/util/sync_string_conversions.h" +#define ENUM_CASE(x) case x: return #x + namespace syncer { const char* ConnectionStatusToString(ConnectionStatus status) { switch (status) { - case CONNECTION_OK: - return "CONNECTION_OK"; - case CONNECTION_AUTH_ERROR: - return "CONNECTION_AUTH_ERROR"; - case CONNECTION_SERVER_ERROR: - return "CONNECTION_SERVER_ERROR"; + ENUM_CASE(CONNECTION_OK); + ENUM_CASE(CONNECTION_AUTH_ERROR); + ENUM_CASE(CONNECTION_SERVER_ERROR); default: NOTREACHED(); return "INVALID_CONNECTION_STATUS"; @@ -24,16 +23,25 @@ const char* ConnectionStatusToString(ConnectionStatus status) { const char* PassphraseRequiredReasonToString( PassphraseRequiredReason reason) { switch (reason) { - case REASON_PASSPHRASE_NOT_REQUIRED: - return "REASON_PASSPHRASE_NOT_REQUIRED"; - case REASON_ENCRYPTION: - return "REASON_ENCRYPTION"; - case REASON_DECRYPTION: - return "REASON_DECRYPTION"; + ENUM_CASE(REASON_PASSPHRASE_NOT_REQUIRED); + ENUM_CASE(REASON_ENCRYPTION); + ENUM_CASE(REASON_DECRYPTION); default: NOTREACHED(); return "INVALID_REASON"; } } +const char* PassphraseStateToString(PassphraseState state) { + switch (state) { + ENUM_CASE(IMPLICIT_PASSPHRASE); + ENUM_CASE(KEYSTORE_PASSPHRASE); + ENUM_CASE(FROZEN_IMPLICIT_PASSPHRASE); + ENUM_CASE(CUSTOM_PASSPHRASE); + default: + NOTREACHED(); + return "INVALID_PASSPHRASE_STATE"; + } +} + } // namespace syncer |