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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrFeedbackStatus.java

Issue 2899013002: This CL reverts the CL that reverted infobar prompts due to the compile failure (Closed)
Patch Set: Created 3 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: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrFeedbackStatus.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrFeedbackStatus.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrFeedbackStatus.java
new file mode 100644
index 0000000000000000000000000000000000000000..3a87656bbe412be16fa8d7c3bf3c1e33618c54c7
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrFeedbackStatus.java
@@ -0,0 +1,49 @@
+// Copyright 2017 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.chrome.browser.vr_shell;
+
+import org.chromium.base.ContextUtils;
+
+/**
+ * Gets and sets preferences related to the status of the Vr feedback infobar.
+ */
+public class VrFeedbackStatus {
+ public static final String VR_FEEDBACK_OPT_OUT = "VR_FEEDBACK_OPT_OUT";
+ public static final String VR_EXIT_TO_2D_COUNT = "VR_EXIT_TO_2D_COUNT";
+
+ /**
+ * Sets the "opted out of entering VR feedback" preference.
+ * @param optOut Whether the VR feedback option has been opted-out of.
+ */
+ public static void setFeedbackOptOut(boolean optOut) {
+ ContextUtils.getAppSharedPreferences()
+ .edit()
+ .putBoolean(VR_FEEDBACK_OPT_OUT, optOut)
+ .apply();
+ }
+
+ /**
+ * Returns whether the user opted out of entering feedback for their VR experience.
+ */
+ public static boolean getFeedbackOptOut() {
+ return ContextUtils.getAppSharedPreferences().getBoolean(VR_FEEDBACK_OPT_OUT, false);
+ }
+
+ /**
+ * Sets the "exited VR mode into 2D browsing" preference.
+ * @param count The number of times the user exited VR and entered 2D browsing mode
+ */
+ public static void setUserExitedAndEntered2DCount(int count) {
+ ContextUtils.getAppSharedPreferences().edit().putInt(VR_EXIT_TO_2D_COUNT, count).apply();
+ }
+
+ /**
+ * Returns the number of times the user has exited VR mode and entered the 2D browsing
+ * mode.
+ */
+ public static int getUserExitedAndEntered2DCount() {
+ return ContextUtils.getAppSharedPreferences().getInt(VR_EXIT_TO_2D_COUNT, 0);
+ }
+}
« no previous file with comments | « chrome/android/BUILD.gn ('k') | chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698