Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java |
| index 0b0f6c277c1a962b4385776f762850a499d29c6a..5861a9e7148505e4c9f63e78580791d557b08d45 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java |
| @@ -27,6 +27,7 @@ import org.chromium.components.location.LocationUtils; |
| */ |
| public class PhysicalWeb { |
| public static final int OPTIN_NOTIFY_MAX_TRIES = 1; |
| + public static final String PHYSICAL_WEB_SHARING_PREFERENCE = "physical_web_sharing"; |
|
mattreynolds
2017/03/17 00:52:39
I think this can be private now.
iankc
2017/03/17 01:46:11
Done.
|
| private static final String PREF_PHYSICAL_WEB_NOTIFY_COUNT = "physical_web_notify_count"; |
| private static final String FEATURE_NAME = "PhysicalWeb"; |
| private static final String PHYSICAL_WEB_SHARING_FEATURE_NAME = "PhysicalWebSharing"; |
| @@ -61,6 +62,26 @@ public class PhysicalWeb { |
| } |
| /** |
| + * Checks whether the user has consented to use the Sharing feature. |
| + * |
| + * @return boolean {@code true} if the feature is enabled |
| + */ |
| + public static boolean sharingIsOptedIn() { |
| + SharedPreferences sharedPrefs = ContextUtils.getAppSharedPreferences(); |
| + return sharedPrefs.getBoolean(PhysicalWeb.PHYSICAL_WEB_SHARING_PREFERENCE, false); |
|
mattreynolds
2017/03/17 00:52:39
You can remove "PhysicalWeb." from the constant na
iankc
2017/03/17 01:46:11
Done.
|
| + } |
| + |
| + /** |
| + * Sets the preference that the user has opted into use the Sharing feature. |
| + */ |
| + public static void setSharingOptedIn() { |
| + ContextUtils.getAppSharedPreferences() |
| + .edit() |
| + .putBoolean(PhysicalWeb.PHYSICAL_WEB_SHARING_PREFERENCE, true) |
| + .apply(); |
| + } |
| + |
| + /** |
| * Checks whether the Physical Web onboard flow is active and the user has |
| * not yet elected to either enable or decline the feature. |
| * |