Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java

Issue 2684233003: Switch tabs from VR shell. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/vr_shell.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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) {
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.
636 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.
637
638 if (index != TabModel.INVALID_TAB_INDEX) {
639 TabModelUtils.setIndex(
640 mActivity.getTabModelSelector().getModel(tab.isIncognito ()), index);
641 }
642 }
643 }
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.
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/vr_shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698