Index: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java |
index 0f77bac3a8720683f42e4b455d0f651048ec52d8..f869c721b3ef0eb628efba20c3d923504cdd398c 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java |
@@ -35,6 +35,8 @@ import org.chromium.chrome.browser.ChromeFeatureList; |
import org.chromium.chrome.browser.ChromeTabbedActivity; |
import org.chromium.chrome.browser.multiwindow.MultiWindowUtils; |
import org.chromium.chrome.browser.tab.Tab; |
+import org.chromium.chrome.browser.tabmodel.TabModel; |
+import org.chromium.chrome.browser.tabmodel.TabModelUtils; |
import java.lang.annotation.Retention; |
import java.lang.annotation.RetentionPolicy; |
@@ -627,6 +629,19 @@ public class VrShellDelegate { |
return mNativeVrShellDelegate; |
} |
+ @CalledByNative |
+ private void showTab(int id) { |
+ Tab tab = mActivity.getTabModelSelector().getTabById(id); |
+ if (tab != null) { |
cjgrant
2017/02/10 16:02:15
Should this be an early return instead?
tiborg
2017/02/10 16:34:17
You mean instead of the nested if statements?
cjgrant
2017/02/10 18:14:29
Yes. That's the preference, to avoid excessive in
tiborg
2017/02/13 17:35:37
Done.
|
+ int index = mActivity.getTabModelSelector().getModel(tab.isIncognito()).indexOf(tab); |
tiborg
2017/02/09 21:22:00
I don't know why this line and the one below are s
mthiesse
2017/02/09 21:37:56
java lines are 100 characters long.
|
+ |
+ if (index != TabModel.INVALID_TAB_INDEX) { |
+ TabModelUtils.setIndex( |
+ mActivity.getTabModelSelector().getModel(tab.isIncognito()), index); |
+ } |
+ } |
+ } |
tiborg
2017/02/09 21:22:00
What would be the best way to deal with an unknown
mthiesse
2017/02/09 21:37:56
Yeah, ignoring it is probably best.
|
+ |
private native long nativeInit(); |
private native void nativeSetPresentResult(long nativeVrShellDelegate, boolean result); |
private native void nativeDisplayActivate(long nativeVrShellDelegate); |