summaryrefslogtreecommitdiffstats
path: root/sync/android
diff options
context:
space:
mode:
authormaxbogue <maxbogue@chromium.org>2014-12-18 10:46:19 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-18 18:46:44 +0000
commit58ae9578c81eb20e4ff07b4ed9c6c1cbd60c4823 (patch)
tree3c4e50b6ea43a628d5417b1237c324d69348a0e4 /sync/android
parent9f275df20c58749c13ce33e1f37036b3dfbbba0c (diff)
downloadchromium_src-58ae9578c81eb20e4ff07b4ed9c6c1cbd60c4823.zip
chromium_src-58ae9578c81eb20e4ff07b4ed9c6c1cbd60c4823.tar.gz
chromium_src-58ae9578c81eb20e4ff07b4ed9c6c1cbd60c4823.tar.bz2
Delete SyncDecryptionPassphraseType.
Review URL: https://codereview.chromium.org/805983002 Cr-Commit-Position: refs/heads/master@{#309044}
Diffstat (limited to 'sync/android')
-rw-r--r--sync/android/java/src/org/chromium/sync/internal_api/pub/SyncDecryptionPassphraseType.java121
1 files changed, 0 insertions, 121 deletions
diff --git a/sync/android/java/src/org/chromium/sync/internal_api/pub/SyncDecryptionPassphraseType.java b/sync/android/java/src/org/chromium/sync/internal_api/pub/SyncDecryptionPassphraseType.java
deleted file mode 100644
index 3190c77..0000000
--- a/sync/android/java/src/org/chromium/sync/internal_api/pub/SyncDecryptionPassphraseType.java
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.sync.internal_api.pub;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * This enum describes the type of passphrase required, if any, to decrypt synced data.
- *
- * It implements the Android {@link Parcelable} interface so it is easy to pass around in intents.
- *
- * It maps the native enum syncer::PassphraseType, but has the additional values INVALID and NONE.
- */
-public enum SyncDecryptionPassphraseType implements Parcelable {
- INVALID(-2), // Used as default value and is not a valid decryption type.
- NONE(-1), // No encryption (deprecated).
- 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.
-
- public static Parcelable.Creator CREATOR =
- new Parcelable.Creator<SyncDecryptionPassphraseType>() {
- @Override
- public SyncDecryptionPassphraseType createFromParcel(Parcel parcel) {
- return fromInternalValue(parcel.readInt());
- }
-
- @Override
- public SyncDecryptionPassphraseType[] newArray(int size) {
- return new SyncDecryptionPassphraseType[size];
- }
- };
-
- public static SyncDecryptionPassphraseType fromInternalValue(int value) {
- for (SyncDecryptionPassphraseType type : values()) {
- if (type.internalValue() == value) {
- return type;
- }
- }
- // Falling back to INVALID. Should not happen if |value| was retrieved from native.
- return INVALID;
- }
-
- private final int mNativeValue;
-
- private SyncDecryptionPassphraseType(int nativeValue) {
- mNativeValue = nativeValue;
- }
-
- public Set<SyncDecryptionPassphraseType> getVisibleTypes() {
- Set<SyncDecryptionPassphraseType> visibleTypes = new HashSet<>();
- switch (this) {
- case NONE: // Intentional fall through.
- case IMPLICIT_PASSPHRASE: // Intentional fall through.
- case KEYSTORE_PASSPHRASE:
- visibleTypes.add(this);
- visibleTypes.add(CUSTOM_PASSPHRASE);
- break;
- case FROZEN_IMPLICIT_PASSPHRASE:
- visibleTypes.add(KEYSTORE_PASSPHRASE);
- visibleTypes.add(FROZEN_IMPLICIT_PASSPHRASE);
- break;
- case CUSTOM_PASSPHRASE:
- visibleTypes.add(KEYSTORE_PASSPHRASE);
- visibleTypes.add(CUSTOM_PASSPHRASE);
- break;
- case INVALID: // Intentional fall through.
- default:
- visibleTypes.add(this);
- break;
- }
- return visibleTypes;
- }
-
- /**
- * Get the types that are allowed to be enabled from the current type.
- *
- * @param encryptEverythingAllowed Whether encrypting all data is allowed.
- */
- public Set<SyncDecryptionPassphraseType> getAllowedTypes(boolean encryptEverythingAllowed) {
- Set<SyncDecryptionPassphraseType> allowedTypes = new HashSet<>();
- switch (this) {
- case NONE: // Intentional fall through.
- case IMPLICIT_PASSPHRASE: // Intentional fall through.
- case KEYSTORE_PASSPHRASE:
- allowedTypes.add(this);
- if (encryptEverythingAllowed) {
- allowedTypes.add(CUSTOM_PASSPHRASE);
- }
- break;
- case FROZEN_IMPLICIT_PASSPHRASE: // Intentional fall through.
- case CUSTOM_PASSPHRASE: // Intentional fall through.
- case INVALID: // Intentional fall through.
- default:
- break;
- }
- return allowedTypes;
- }
-
- public int internalValue() {
- // Since the values in this enums are constant and very small, this cast is safe.
- return mNativeValue;
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(mNativeValue);
- }
-}