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

Unified Diff: components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedBridge.java

Issue 1965093002: 🎾 Migrate more shared preferences to ContextUtils. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 7 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: components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedBridge.java
diff --git a/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedBridge.java b/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedBridge.java
index 64e2877ae15234ce8ac9dcd90629307bc68c151d..465809c1c65ba21665ffa3b21953b4a714e2ebe0 100644
--- a/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedBridge.java
+++ b/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedBridge.java
@@ -5,9 +5,9 @@
package org.chromium.components.variations.firstrun;
import android.content.Context;
-import android.preference.PreferenceManager;
import android.util.Base64;
+import org.chromium.base.ContextUtils;
import org.chromium.base.annotations.CalledByNative;
/**
@@ -30,7 +30,7 @@ public class VariationsSeedBridge {
"variations_seed_native_stored";
protected static String getVariationsFirstRunSeedPref(Context context, String prefName) {
- return PreferenceManager.getDefaultSharedPreferences(context).getString(prefName, "");
+ return ContextUtils.getAppSharedPreferences().getString(prefName, "");
}
/**
@@ -40,7 +40,7 @@ public class VariationsSeedBridge {
@CalledByNative
public static void setVariationsFirstRunSeed(Context context, byte[] rawSeed, String signature,
String country, String date, boolean isGzipCompressed) {
- PreferenceManager.getDefaultSharedPreferences(context)
+ ContextUtils.getAppSharedPreferences()
.edit()
.putString(VARIATIONS_FIRST_RUN_SEED_BASE64,
Base64.encodeToString(rawSeed, Base64.NO_WRAP))
@@ -53,7 +53,7 @@ public class VariationsSeedBridge {
@CalledByNative
private static void clearFirstRunPrefs(Context context) {
- PreferenceManager.getDefaultSharedPreferences(context)
+ ContextUtils.getAppSharedPreferences()
.edit()
.remove(VARIATIONS_FIRST_RUN_SEED_BASE64)
.remove(VARIATIONS_FIRST_RUN_SEED_SIGNATURE)
@@ -67,7 +67,7 @@ public class VariationsSeedBridge {
* Returns the status of the variations first run fetch: was it successful or not.
*/
public static boolean hasJavaPref(Context context) {
- return !PreferenceManager.getDefaultSharedPreferences(context)
+ return !ContextUtils.getAppSharedPreferences()
.getString(VARIATIONS_FIRST_RUN_SEED_BASE64, "")
.isEmpty();
}
@@ -76,13 +76,13 @@ public class VariationsSeedBridge {
* Returns the status of the variations seed storing on the C++ side: was it successful or not.
*/
public static boolean hasNativePref(Context context) {
- return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
+ return ContextUtils.getAppSharedPreferences().getBoolean(
VARIATIONS_FIRST_RUN_SEED_NATIVE_STORED, false);
}
@CalledByNative
private static void markVariationsSeedAsStored(Context context) {
- PreferenceManager.getDefaultSharedPreferences(context)
+ ContextUtils.getAppSharedPreferences()
.edit()
.putBoolean(VARIATIONS_FIRST_RUN_SEED_NATIVE_STORED, true)
.apply();
@@ -112,7 +112,7 @@ public class VariationsSeedBridge {
@CalledByNative
private static boolean getVariationsFirstRunSeedIsGzipCompressed(Context context) {
- return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
+ return ContextUtils.getAppSharedPreferences().getBoolean(
VARIATIONS_FIRST_RUN_SEED_IS_GZIP_COMPRESSED, false);
}
}

Powered by Google App Engine
This is Rietveld 408576698