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 /** |
794 * @return Pointer to the native VrShellDelegate object. | 802 * @return Pointer to the native VrShellDelegate object. |
795 */ | 803 */ |
796 @CalledByNative | 804 @CalledByNative |
797 private long getNativePointer() { | 805 private long getNativePointer() { |
798 return mNativeVrShellDelegate; | 806 return mNativeVrShellDelegate; |
799 } | 807 } |
800 | 808 |
801 private void destroy() { | 809 private void destroy() { |
802 if (sInstance == null) return; | 810 if (sInstance == null) return; |
803 if (mNativeVrShellDelegate != 0) nativeDestroy(mNativeVrShellDelegate); | 811 if (mNativeVrShellDelegate != 0) nativeDestroy(mNativeVrShellDelegate); |
804 ApplicationStatus.unregisterActivityStateListener(this); | 812 ApplicationStatus.unregisterActivityStateListener(this); |
805 sInstance = null; | 813 sInstance = null; |
806 } | 814 } |
807 | 815 |
808 private native long nativeInit(); | 816 private native long nativeInit(); |
809 private static native void nativeOnLibraryAvailable(); | 817 private static native void nativeOnLibraryAvailable(); |
810 private native void nativeSetPresentResult(long nativeVrShellDelegate, boole
an result); | 818 private native void nativeSetPresentResult(long nativeVrShellDelegate, boole
an result); |
811 private native void nativeDisplayActivate(long nativeVrShellDelegate); | 819 private native void nativeDisplayActivate(long nativeVrShellDelegate); |
812 private native void nativeUpdateVSyncInterval(long nativeVrShellDelegate, lo
ng timebaseNanos, | 820 private native void nativeUpdateVSyncInterval(long nativeVrShellDelegate, lo
ng timebaseNanos, |
813 double intervalSeconds); | 821 double intervalSeconds); |
814 private native void nativeOnPause(long nativeVrShellDelegate); | 822 private native void nativeOnPause(long nativeVrShellDelegate); |
815 private native void nativeOnResume(long nativeVrShellDelegate); | 823 private native void nativeOnResume(long nativeVrShellDelegate); |
816 private native void nativeDestroy(long nativeVrShellDelegate); | 824 private native void nativeDestroy(long nativeVrShellDelegate); |
817 } | 825 } |
OLD | NEW |