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

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

Issue 2865463003: Tracks GVR version crossed with headset type using UMA. (Closed)
Patch Set: Nit: only create native-Java enum if enable_vr is 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/VrShellDelegate.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
index 6ea8491b9e3b41178fd4b9e600c6f154c81474e1..cb32865e41856013d1e19c579595aa7e4c0ed3aa 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
@@ -764,14 +764,14 @@ public class VrShellDelegate implements ApplicationStatus.ActivityStateListener,
private static boolean isVrCoreCompatible(
VrCoreVersionChecker versionChecker, Tab tabToShowInfobarIn) {
- int vrCoreCompatibility = versionChecker.getVrCoreCompatibility();
+ int vrCoreCompatibility = versionChecker.getVrCoreInfo().compatibility;
- if (vrCoreCompatibility == VrCoreVersionChecker.VR_NOT_AVAILABLE
- || vrCoreCompatibility == VrCoreVersionChecker.VR_OUT_OF_DATE) {
+ if (vrCoreCompatibility == VrCoreCompatibility.VR_NOT_AVAILABLE
+ || vrCoreCompatibility == VrCoreCompatibility.VR_OUT_OF_DATE) {
promptToUpdateVrServices(vrCoreCompatibility, tabToShowInfobarIn);
}
- return vrCoreCompatibility == VrCoreVersionChecker.VR_READY;
+ return vrCoreCompatibility == VrCoreCompatibility.VR_READY;
}
private static void promptToUpdateVrServices(int vrCoreCompatibility, Tab tab) {
@@ -781,11 +781,11 @@ public class VrShellDelegate implements ApplicationStatus.ActivityStateListener,
final Activity activity = tab.getActivity();
String infobarText;
String buttonText;
- if (vrCoreCompatibility == VrCoreVersionChecker.VR_NOT_AVAILABLE) {
+ if (vrCoreCompatibility == VrCoreCompatibility.VR_NOT_AVAILABLE) {
// Supported, but not installed. Ask user to install instead of upgrade.
infobarText = activity.getString(R.string.vr_services_check_infobar_install_text);
buttonText = activity.getString(R.string.vr_services_check_infobar_install_button);
- } else if (vrCoreCompatibility == VrCoreVersionChecker.VR_OUT_OF_DATE) {
+ } else if (vrCoreCompatibility == VrCoreCompatibility.VR_OUT_OF_DATE) {
infobarText = activity.getString(R.string.vr_services_check_infobar_update_text);
buttonText = activity.getString(R.string.vr_services_check_infobar_update_button);
} else {
@@ -902,6 +902,19 @@ public class VrShellDelegate implements ApplicationStatus.ActivityStateListener,
return mNativeVrShellDelegate;
}
+ @CalledByNative
+ private long getVrCoreInfo() {
+ assert mVrCoreVersionChecker != null;
+ VrCoreInfo vrCoreInfo = mVrCoreVersionChecker.getVrCoreInfo();
+ long nativeVrCoreInfo = (vrCoreInfo.gvrVersion != null)
ddorwin 2017/05/24 07:31:37 nit: It is generally clearer to use positive logic
tiborg 2017/05/25 00:06:02 Makes sense. Changed it.
+ ? nativeMakeNativeVrCoreInfo(mNativeVrShellDelegate,
+ vrCoreInfo.gvrVersion.majorVersion, vrCoreInfo.gvrVersion.minorVersion,
+ vrCoreInfo.gvrVersion.patchVersion, vrCoreInfo.compatibility)
+ : nativeMakeNativeVrCoreInfo(
+ mNativeVrShellDelegate, 0, 0, 0, vrCoreInfo.compatibility);
+ return nativeVrCoreInfo;
+ }
+
private void destroy() {
if (sInstance == null) return;
shutdownVr(true, false);
@@ -920,4 +933,6 @@ public class VrShellDelegate implements ApplicationStatus.ActivityStateListener,
private native void nativeOnPause(long nativeVrShellDelegate);
private native void nativeOnResume(long nativeVrShellDelegate);
private native void nativeDestroy(long nativeVrShellDelegate);
+ private native long nativeMakeNativeVrCoreInfo(long nativeVrShellDelegate, int majorVersion,
+ int minorVersion, int patchVersion, int compatibility);
}

Powered by Google App Engine
This is Rietveld 408576698