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.PendingIntent; | 8 import android.app.PendingIntent; |
9 import android.content.ComponentName; | 9 import android.content.ComponentName; |
10 import android.content.Context; | 10 import android.content.Context; |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 | 784 |
785 /** | 785 /** |
786 * @param api The VrDaydreamApi object this delegate will use instead of the
default one | 786 * @param api The VrDaydreamApi object this delegate will use instead of the
default one |
787 */ | 787 */ |
788 @VisibleForTesting | 788 @VisibleForTesting |
789 public void overrideDaydreamApiForTesting(VrDaydreamApi api) { | 789 public void overrideDaydreamApiForTesting(VrDaydreamApi api) { |
790 mVrDaydreamApi = api; | 790 mVrDaydreamApi = api; |
791 } | 791 } |
792 | 792 |
793 /** | 793 /** |
794 * @return The VrShell for the VrShellDelegate instance | |
795 */ | |
796 @VisibleForTesting | |
797 public static VrShell getVrShellForTesting() { | |
798 return sInstance == null ? null : sInstance.mVrShell; | |
799 } | |
800 | |
801 /** | |
802 * @return Pointer to the native VrShellDelegate object. | 794 * @return Pointer to the native VrShellDelegate object. |
803 */ | 795 */ |
804 @CalledByNative | 796 @CalledByNative |
805 private long getNativePointer() { | 797 private long getNativePointer() { |
806 return mNativeVrShellDelegate; | 798 return mNativeVrShellDelegate; |
807 } | 799 } |
808 | 800 |
809 private void destroy() { | 801 private void destroy() { |
810 if (sInstance == null) return; | 802 if (sInstance == null) return; |
811 if (mNativeVrShellDelegate != 0) nativeDestroy(mNativeVrShellDelegate); | 803 if (mNativeVrShellDelegate != 0) nativeDestroy(mNativeVrShellDelegate); |
812 ApplicationStatus.unregisterActivityStateListener(this); | 804 ApplicationStatus.unregisterActivityStateListener(this); |
813 sInstance = null; | 805 sInstance = null; |
814 } | 806 } |
815 | 807 |
816 private native long nativeInit(); | 808 private native long nativeInit(); |
817 private static native void nativeOnLibraryAvailable(); | 809 private static native void nativeOnLibraryAvailable(); |
818 private native void nativeSetPresentResult(long nativeVrShellDelegate, boole
an result); | 810 private native void nativeSetPresentResult(long nativeVrShellDelegate, boole
an result); |
819 private native void nativeDisplayActivate(long nativeVrShellDelegate); | 811 private native void nativeDisplayActivate(long nativeVrShellDelegate); |
820 private native void nativeUpdateVSyncInterval(long nativeVrShellDelegate, lo
ng timebaseNanos, | 812 private native void nativeUpdateVSyncInterval(long nativeVrShellDelegate, lo
ng timebaseNanos, |
821 double intervalSeconds); | 813 double intervalSeconds); |
822 private native void nativeOnPause(long nativeVrShellDelegate); | 814 private native void nativeOnPause(long nativeVrShellDelegate); |
823 private native void nativeOnResume(long nativeVrShellDelegate); | 815 private native void nativeOnResume(long nativeVrShellDelegate); |
824 private native void nativeDestroy(long nativeVrShellDelegate); | 816 private native void nativeDestroy(long nativeVrShellDelegate); |
825 } | 817 } |
OLD | NEW |