Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.vr_shell; | 5 package org.chromium.chrome.browser.vr_shell; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.app.ActivityManager; | 8 import android.app.ActivityManager; |
| 9 import android.app.PendingIntent; | 9 import android.app.PendingIntent; |
| 10 import android.content.BroadcastReceiver; | 10 import android.content.BroadcastReceiver; |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 725 } | 725 } |
| 726 restoreWindowMode(); | 726 restoreWindowMode(); |
| 727 mVrShell.pause(); | 727 mVrShell.pause(); |
| 728 removeVrViews(); | 728 removeVrViews(); |
| 729 destroyVrShell(); | 729 destroyVrShell(); |
| 730 mActivity.getFullscreenManager().setPositionsForTabToNonFullscreen(); | 730 mActivity.getFullscreenManager().setPositionsForTabToNonFullscreen(); |
| 731 } | 731 } |
| 732 | 732 |
| 733 private static boolean isVrCoreCompatible( | 733 private static boolean isVrCoreCompatible( |
| 734 VrCoreVersionChecker versionChecker, Tab tabToShowInfobarIn) { | 734 VrCoreVersionChecker versionChecker, Tab tabToShowInfobarIn) { |
| 735 int vrCoreCompatibility = versionChecker.getVrCoreCompatibility(); | 735 int vrCoreCompatibility = versionChecker.getVrCoreInfo().compatibility; |
|
ddorwin
2017/05/05 20:29:59
Can this throw an exception? See line 875.
tiborg
2017/05/10 20:39:51
getVrCoreInfo() always returns non-null and this f
| |
| 736 | 736 |
| 737 if (vrCoreCompatibility == VrCoreVersionChecker.VR_NOT_AVAILABLE | 737 if (vrCoreCompatibility == VrCoreVersionChecker.VR_NOT_AVAILABLE |
| 738 || vrCoreCompatibility == VrCoreVersionChecker.VR_OUT_OF_DATE) { | 738 || vrCoreCompatibility == VrCoreVersionChecker.VR_OUT_OF_DATE) { |
| 739 promptToUpdateVrServices(vrCoreCompatibility, tabToShowInfobarIn); | 739 promptToUpdateVrServices(vrCoreCompatibility, tabToShowInfobarIn); |
| 740 } | 740 } |
| 741 | 741 |
| 742 return vrCoreCompatibility == VrCoreVersionChecker.VR_READY; | 742 return vrCoreCompatibility == VrCoreVersionChecker.VR_READY; |
| 743 } | 743 } |
| 744 | 744 |
| 745 private static void promptToUpdateVrServices(int vrCoreCompatibility, Tab ta b) { | 745 private static void promptToUpdateVrServices(int vrCoreCompatibility, Tab ta b) { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 863 } | 863 } |
| 864 | 864 |
| 865 /** | 865 /** |
| 866 * @return Pointer to the native VrShellDelegate object. | 866 * @return Pointer to the native VrShellDelegate object. |
| 867 */ | 867 */ |
| 868 @CalledByNative | 868 @CalledByNative |
| 869 private long getNativePointer() { | 869 private long getNativePointer() { |
| 870 return mNativeVrShellDelegate; | 870 return mNativeVrShellDelegate; |
| 871 } | 871 } |
| 872 | 872 |
| 873 @CalledByNative | |
| 874 private VrCoreInfo getVrCoreInfo() { | |
| 875 return (mVrCoreVersionChecker != null) ? mVrCoreVersionChecker.getVrCore Info() : null; | |
| 876 } | |
| 877 | |
| 873 private void destroy() { | 878 private void destroy() { |
| 874 if (sInstance == null) return; | 879 if (sInstance == null) return; |
| 875 shutdownVr(true, false); | 880 shutdownVr(true, false); |
| 876 if (mNativeVrShellDelegate != 0) nativeDestroy(mNativeVrShellDelegate); | 881 if (mNativeVrShellDelegate != 0) nativeDestroy(mNativeVrShellDelegate); |
| 877 mNativeVrShellDelegate = 0; | 882 mNativeVrShellDelegate = 0; |
| 878 ApplicationStatus.unregisterActivityStateListener(this); | 883 ApplicationStatus.unregisterActivityStateListener(this); |
| 879 sInstance = null; | 884 sInstance = null; |
| 880 } | 885 } |
| 881 | 886 |
| 882 private native long nativeInit(); | 887 private native long nativeInit(); |
| 883 private static native void nativeOnLibraryAvailable(); | 888 private static native void nativeOnLibraryAvailable(); |
| 884 private native void nativeSetPresentResult(long nativeVrShellDelegate, boole an result); | 889 private native void nativeSetPresentResult(long nativeVrShellDelegate, boole an result); |
| 885 private native void nativeDisplayActivate(long nativeVrShellDelegate); | 890 private native void nativeDisplayActivate(long nativeVrShellDelegate); |
| 886 private native void nativeUpdateVSyncInterval(long nativeVrShellDelegate, lo ng timebaseNanos, | 891 private native void nativeUpdateVSyncInterval(long nativeVrShellDelegate, lo ng timebaseNanos, |
| 887 double intervalSeconds); | 892 double intervalSeconds); |
| 888 private native void nativeOnPause(long nativeVrShellDelegate); | 893 private native void nativeOnPause(long nativeVrShellDelegate); |
| 889 private native void nativeOnResume(long nativeVrShellDelegate); | 894 private native void nativeOnResume(long nativeVrShellDelegate); |
| 890 private native void nativeDestroy(long nativeVrShellDelegate); | 895 private native void nativeDestroy(long nativeVrShellDelegate); |
| 891 } | 896 } |
| OLD | NEW |