| 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 17 matching lines...) Expand all Loading... |
| 28 import org.chromium.base.Log; | 28 import org.chromium.base.Log; |
| 29 import org.chromium.base.VisibleForTesting; | 29 import org.chromium.base.VisibleForTesting; |
| 30 import org.chromium.base.annotations.CalledByNative; | 30 import org.chromium.base.annotations.CalledByNative; |
| 31 import org.chromium.base.annotations.JNINamespace; | 31 import org.chromium.base.annotations.JNINamespace; |
| 32 import org.chromium.base.library_loader.LibraryLoader; | 32 import org.chromium.base.library_loader.LibraryLoader; |
| 33 import org.chromium.chrome.browser.ChromeActivity; | 33 import org.chromium.chrome.browser.ChromeActivity; |
| 34 import org.chromium.chrome.browser.ChromeFeatureList; | 34 import org.chromium.chrome.browser.ChromeFeatureList; |
| 35 import org.chromium.chrome.browser.ChromeTabbedActivity; | 35 import org.chromium.chrome.browser.ChromeTabbedActivity; |
| 36 import org.chromium.chrome.browser.multiwindow.MultiWindowUtils; | 36 import org.chromium.chrome.browser.multiwindow.MultiWindowUtils; |
| 37 import org.chromium.chrome.browser.tab.Tab; | 37 import org.chromium.chrome.browser.tab.Tab; |
| 38 import org.chromium.chrome.browser.tabmodel.TabModel; |
| 39 import org.chromium.chrome.browser.tabmodel.TabModelUtils; |
| 38 | 40 |
| 39 import java.lang.annotation.Retention; | 41 import java.lang.annotation.Retention; |
| 40 import java.lang.annotation.RetentionPolicy; | 42 import java.lang.annotation.RetentionPolicy; |
| 41 import java.lang.reflect.Constructor; | 43 import java.lang.reflect.Constructor; |
| 42 import java.lang.reflect.InvocationTargetException; | 44 import java.lang.reflect.InvocationTargetException; |
| 43 | 45 |
| 44 /** | 46 /** |
| 45 * Manages interactions with the VR Shell. | 47 * Manages interactions with the VR Shell. |
| 46 */ | 48 */ |
| 47 @JNINamespace("vr_shell") | 49 @JNINamespace("vr_shell") |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 } | 622 } |
| 621 | 623 |
| 622 /** | 624 /** |
| 623 * @return Pointer to the native VrShellDelegate object. | 625 * @return Pointer to the native VrShellDelegate object. |
| 624 */ | 626 */ |
| 625 @CalledByNative | 627 @CalledByNative |
| 626 private long getNativePointer() { | 628 private long getNativePointer() { |
| 627 return mNativeVrShellDelegate; | 629 return mNativeVrShellDelegate; |
| 628 } | 630 } |
| 629 | 631 |
| 632 @CalledByNative |
| 633 private void showTab(int id) { |
| 634 Tab tab = mActivity.getTabModelSelector().getTabById(id); |
| 635 if (tab == null) { |
| 636 return; |
| 637 } |
| 638 int index = mActivity.getTabModelSelector().getModel(tab.isIncognito()).
indexOf(tab); |
| 639 if (index == TabModel.INVALID_TAB_INDEX) { |
| 640 return; |
| 641 } |
| 642 TabModelUtils.setIndex(mActivity.getTabModelSelector().getModel(tab.isIn
cognito()), index); |
| 643 } |
| 644 |
| 630 private native long nativeInit(); | 645 private native long nativeInit(); |
| 631 private native void nativeSetPresentResult(long nativeVrShellDelegate, boole
an result); | 646 private native void nativeSetPresentResult(long nativeVrShellDelegate, boole
an result); |
| 632 private native void nativeDisplayActivate(long nativeVrShellDelegate); | 647 private native void nativeDisplayActivate(long nativeVrShellDelegate); |
| 633 private native void nativeUpdateVSyncInterval(long nativeVrShellDelegate, lo
ng timebaseNanos, | 648 private native void nativeUpdateVSyncInterval(long nativeVrShellDelegate, lo
ng timebaseNanos, |
| 634 double intervalSeconds); | 649 double intervalSeconds); |
| 635 private native void nativeOnPause(long nativeVrShellDelegate); | 650 private native void nativeOnPause(long nativeVrShellDelegate); |
| 636 private native void nativeOnResume(long nativeVrShellDelegate); | 651 private native void nativeOnResume(long nativeVrShellDelegate); |
| 637 } | 652 } |
| OLD | NEW |