Chromium Code Reviews| 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 8aa2998dbf3809c555907c3be86973c650da505d..113164f88a51c1a131a872f8513836d466a065be 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 |
| @@ -15,6 +15,7 @@ import android.view.WindowManager; |
| import org.chromium.base.Log; |
| import org.chromium.chrome.browser.ChromeTabbedActivity; |
| +import org.chromium.chrome.browser.tab.Tab; |
| import java.lang.reflect.Constructor; |
| import java.lang.reflect.InvocationTargetException; |
| @@ -71,6 +72,12 @@ public class VrShellDelegate { |
| */ |
| public boolean enterVRIfNecessary() { |
| if (!mVrShellEnabled) return false; |
| + Tab tab = mActivity.getActivityTab(); |
|
bshe
2016/09/12 16:39:56
Did you try cold start browser? The active tab mig
mthiesse
2016/09/12 21:46:04
Cold start of the browser works just fine for ente
|
| + // TODO(mthiesse): When we have VR UI for opening new tabs, etc., allow VR Shell to be |
| + // entered without any current tabs. |
| + if (tab == null || tab.getContentViewCore() == null) { |
| + return false; |
| + } |
| if (mInVr) return true; |
| mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); |
| if (!createVrShell()) { |
| @@ -79,7 +86,7 @@ public class VrShellDelegate { |
| } |
| addVrViews(); |
| setupVrModeWindowFlags(); |
| - mVrShellView.onNativeLibraryReady(); |
| + mVrShellView.onNativeLibraryReady(tab.getContentViewCore()); |
| mVrShellView.setVrModeEnabled(true); |
| mInVr = true; |
| return true; |