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

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

Issue 2701523008: Intercept WebVR api calls and check for VrCore compatibility. (Closed)
Patch Set: rebase on latest patch Created 3 years, 10 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
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrCoreVersionCheckerImpl.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8e3a6b3baead5999469e0e736a035f05c86fc1d3..9ac366c318690079b3dea6babfcc4e27f0933903 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
@@ -12,7 +12,6 @@ import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.net.Uri;
-import android.os.Build;
import android.os.Handler;
import android.os.StrictMode;
import android.os.SystemClock;
@@ -82,8 +81,6 @@ public class VrShellDelegate {
private static final String DAYDREAM_CATEGORY = "com.google.intent.category.DAYDREAM";
private static final String CARDBOARD_CATEGORY = "com.google.intent.category.CARDBOARD";
- private static final String MIN_SDK_VERSION_PARAM_NAME = "min_sdk_version";
-
private static final String VR_ACTIVITY_ALIAS =
"org.chromium.chrome.browser.VRChromeTabbedActivity";
@@ -229,16 +226,6 @@ public class VrShellDelegate {
if (daydreamApi.isDaydreamReadyDevice()) return VR_DAYDREAM;
- // Check cardboard support for non-daydream devices. Supported Build version is determined
- // by the webvr cardboard support feature. Default is KITKAT unless specified via server
- // side finch config.
- if (Build.VERSION.SDK_INT < ChromeFeatureList.getFieldTrialParamByFeatureAsInt(
- ChromeFeatureList.WEBVR_CARDBOARD_SUPPORT,
- MIN_SDK_VERSION_PARAM_NAME,
- Build.VERSION_CODES.KITKAT)) {
- return VR_NOT_AVAILABLE;
- }
-
return VR_CARDBOARD;
}
@@ -624,6 +611,9 @@ public class VrShellDelegate {
@CalledByNative
private long createNonPresentingNativeContext() {
if (mVrClassesWrapper == null) return 0;
+ // Update VR support level as it can change at runtime
+ updateVrSupportLevel();
+ if (mVrSupportLevel == VR_NOT_AVAILABLE) return 0;
mNonPresentingGvrContext = mVrClassesWrapper.createNonPresentingGvrContext(mActivity);
if (mNonPresentingGvrContext == null) return 0;
return mNonPresentingGvrContext.getNativeGvrContext();
@@ -676,23 +666,19 @@ public class VrShellDelegate {
private static boolean isVrCoreCompatible(
VrCoreVersionChecker versionChecker, Tab tabToShowInfobarIn) {
- return verifyOrUpdateVrServices(
- versionChecker.getVrCoreCompatibility(), tabToShowInfobarIn);
- }
+ int vrCoreCompatibility = versionChecker.getVrCoreCompatibility();
- private static boolean verifyOrUpdateVrServices(int vrCoreCompatibility, Tab tab) {
- if (vrCoreCompatibility == VrCoreVersionChecker.VR_READY) {
- return true;
+ if (vrCoreCompatibility == VrCoreVersionChecker.VR_NOT_AVAILABLE
+ || vrCoreCompatibility == VrCoreVersionChecker.VR_OUT_OF_DATE) {
+ promptToUpdateVrServices(vrCoreCompatibility, tabToShowInfobarIn);
}
+
+ return vrCoreCompatibility == VrCoreVersionChecker.VR_READY;
+ }
+
+ private static void promptToUpdateVrServices(int vrCoreCompatibility, Tab tab) {
if (tab == null) {
- return false;
- }
- // Make sure OS is supported before showing the user a prompt.
- if (Build.VERSION.SDK_INT < ChromeFeatureList.getFieldTrialParamByFeatureAsInt(
- ChromeFeatureList.WEBVR_CARDBOARD_SUPPORT,
- MIN_SDK_VERSION_PARAM_NAME,
- Build.VERSION_CODES.KITKAT)) {
- return false;
+ return;
}
final Activity activity = tab.getActivity();
String infobarText;
@@ -706,7 +692,7 @@ public class VrShellDelegate {
buttonText = activity.getString(R.string.vr_services_check_infobar_update_button);
} else {
Log.e(TAG, "Unknown VrCore compatibility: " + vrCoreCompatibility);
- return false;
+ return;
}
SimpleConfirmInfoBarBuilder.create(tab,
@@ -723,7 +709,6 @@ public class VrShellDelegate {
},
InfoBarIdentifier.VR_SERVICES_UPGRADE_ANDROID, R.drawable.vr_services, infobarText,
buttonText, null, true);
- return false;
}
private boolean createVrShell() {
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrCoreVersionCheckerImpl.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698