| 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 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 } | 757 } |
| 758 restoreWindowMode(); | 758 restoreWindowMode(); |
| 759 mVrShell.pause(); | 759 mVrShell.pause(); |
| 760 removeVrViews(); | 760 removeVrViews(); |
| 761 destroyVrShell(); | 761 destroyVrShell(); |
| 762 mActivity.getFullscreenManager().setPositionsForTabToNonFullscreen(); | 762 mActivity.getFullscreenManager().setPositionsForTabToNonFullscreen(); |
| 763 } | 763 } |
| 764 | 764 |
| 765 private static boolean isVrCoreCompatible( | 765 private static boolean isVrCoreCompatible( |
| 766 VrCoreVersionChecker versionChecker, Tab tabToShowInfobarIn) { | 766 VrCoreVersionChecker versionChecker, Tab tabToShowInfobarIn) { |
| 767 int vrCoreCompatibility = versionChecker.getVrCoreCompatibility(); | 767 int vrCoreCompatibility = versionChecker.getVrCoreInfo().compatibility; |
| 768 | 768 |
| 769 if (vrCoreCompatibility == VrCoreVersionChecker.VR_NOT_AVAILABLE | 769 if (vrCoreCompatibility == VrCoreVersionChecker.VR_NOT_AVAILABLE |
| 770 || vrCoreCompatibility == VrCoreVersionChecker.VR_OUT_OF_DATE) { | 770 || vrCoreCompatibility == VrCoreVersionChecker.VR_OUT_OF_DATE) { |
| 771 promptToUpdateVrServices(vrCoreCompatibility, tabToShowInfobarIn); | 771 promptToUpdateVrServices(vrCoreCompatibility, tabToShowInfobarIn); |
| 772 } | 772 } |
| 773 | 773 |
| 774 return vrCoreCompatibility == VrCoreVersionChecker.VR_READY; | 774 return vrCoreCompatibility == VrCoreVersionChecker.VR_READY; |
| 775 } | 775 } |
| 776 | 776 |
| 777 private static void promptToUpdateVrServices(int vrCoreCompatibility, Tab ta
b) { | 777 private static void promptToUpdateVrServices(int vrCoreCompatibility, Tab ta
b) { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 } | 895 } |
| 896 | 896 |
| 897 /** | 897 /** |
| 898 * @return Pointer to the native VrShellDelegate object. | 898 * @return Pointer to the native VrShellDelegate object. |
| 899 */ | 899 */ |
| 900 @CalledByNative | 900 @CalledByNative |
| 901 private long getNativePointer() { | 901 private long getNativePointer() { |
| 902 return mNativeVrShellDelegate; | 902 return mNativeVrShellDelegate; |
| 903 } | 903 } |
| 904 | 904 |
| 905 @CalledByNative |
| 906 private VrCoreInfo getVrCoreInfo() { |
| 907 return (mVrCoreVersionChecker != null) ? mVrCoreVersionChecker.getVrCore
Info() : null; |
| 908 } |
| 909 |
| 905 private void destroy() { | 910 private void destroy() { |
| 906 if (sInstance == null) return; | 911 if (sInstance == null) return; |
| 907 shutdownVr(true, false); | 912 shutdownVr(true, false); |
| 908 if (mNativeVrShellDelegate != 0) nativeDestroy(mNativeVrShellDelegate); | 913 if (mNativeVrShellDelegate != 0) nativeDestroy(mNativeVrShellDelegate); |
| 909 mNativeVrShellDelegate = 0; | 914 mNativeVrShellDelegate = 0; |
| 910 ApplicationStatus.unregisterActivityStateListener(this); | 915 ApplicationStatus.unregisterActivityStateListener(this); |
| 911 sInstance = null; | 916 sInstance = null; |
| 912 } | 917 } |
| 913 | 918 |
| 914 private native long nativeInit(); | 919 private native long nativeInit(); |
| 915 private static native void nativeOnLibraryAvailable(); | 920 private static native void nativeOnLibraryAvailable(); |
| 916 private native void nativeSetPresentResult(long nativeVrShellDelegate, boole
an result); | 921 private native void nativeSetPresentResult(long nativeVrShellDelegate, boole
an result); |
| 917 private native void nativeDisplayActivate(long nativeVrShellDelegate); | 922 private native void nativeDisplayActivate(long nativeVrShellDelegate); |
| 918 private native void nativeUpdateVSyncInterval(long nativeVrShellDelegate, lo
ng timebaseNanos, | 923 private native void nativeUpdateVSyncInterval(long nativeVrShellDelegate, lo
ng timebaseNanos, |
| 919 double intervalSeconds); | 924 double intervalSeconds); |
| 920 private native void nativeOnPause(long nativeVrShellDelegate); | 925 private native void nativeOnPause(long nativeVrShellDelegate); |
| 921 private native void nativeOnResume(long nativeVrShellDelegate); | 926 private native void nativeOnResume(long nativeVrShellDelegate); |
| 922 private native void nativeDestroy(long nativeVrShellDelegate); | 927 private native void nativeDestroy(long nativeVrShellDelegate); |
| 923 } | 928 } |
| OLD | NEW |