OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.tab; | 5 package org.chromium.chrome.browser.tab; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.content.res.Resources; | 10 import android.content.res.Resources; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 import org.chromium.chrome.browser.UrlConstants; | 43 import org.chromium.chrome.browser.UrlConstants; |
44 import org.chromium.chrome.browser.WebContentsFactory; | 44 import org.chromium.chrome.browser.WebContentsFactory; |
45 import org.chromium.chrome.browser.banners.AppBannerManager; | 45 import org.chromium.chrome.browser.banners.AppBannerManager; |
46 import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager; | 46 import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager; |
47 import org.chromium.chrome.browser.contextmenu.ChromeContextMenuItemDelegate; | 47 import org.chromium.chrome.browser.contextmenu.ChromeContextMenuItemDelegate; |
48 import org.chromium.chrome.browser.contextmenu.ChromeContextMenuPopulator; | 48 import org.chromium.chrome.browser.contextmenu.ChromeContextMenuPopulator; |
49 import org.chromium.chrome.browser.contextmenu.ContextMenuParams; | 49 import org.chromium.chrome.browser.contextmenu.ContextMenuParams; |
50 import org.chromium.chrome.browser.contextmenu.ContextMenuPopulator; | 50 import org.chromium.chrome.browser.contextmenu.ContextMenuPopulator; |
51 import org.chromium.chrome.browser.contextmenu.ContextMenuPopulatorWrapper; | 51 import org.chromium.chrome.browser.contextmenu.ContextMenuPopulatorWrapper; |
52 import org.chromium.chrome.browser.contextmenu.EmptyChromeContextMenuItemDelegat e; | 52 import org.chromium.chrome.browser.contextmenu.EmptyChromeContextMenuItemDelegat e; |
53 import org.chromium.chrome.browser.customtabs.CustomTabActivity; | |
53 import org.chromium.chrome.browser.fullscreen.FullscreenManager; | 54 import org.chromium.chrome.browser.fullscreen.FullscreenManager; |
54 import org.chromium.chrome.browser.help.HelpAndFeedback; | 55 import org.chromium.chrome.browser.help.HelpAndFeedback; |
55 import org.chromium.chrome.browser.infobar.InfoBarContainer; | 56 import org.chromium.chrome.browser.infobar.InfoBarContainer; |
56 import org.chromium.chrome.browser.metrics.UmaSessionStats; | 57 import org.chromium.chrome.browser.metrics.UmaSessionStats; |
57 import org.chromium.chrome.browser.metrics.UmaUtils; | 58 import org.chromium.chrome.browser.metrics.UmaUtils; |
58 import org.chromium.chrome.browser.printing.TabPrinter; | 59 import org.chromium.chrome.browser.printing.TabPrinter; |
59 import org.chromium.chrome.browser.profiles.Profile; | 60 import org.chromium.chrome.browser.profiles.Profile; |
60 import org.chromium.chrome.browser.snackbar.SnackbarManager; | 61 import org.chromium.chrome.browser.snackbar.SnackbarManager; |
61 import org.chromium.chrome.browser.ssl.ConnectionSecurity; | 62 import org.chromium.chrome.browser.ssl.ConnectionSecurity; |
62 import org.chromium.chrome.browser.ssl.ConnectionSecurityLevel; | 63 import org.chromium.chrome.browser.ssl.ConnectionSecurityLevel; |
(...skipping 16 matching lines...) Expand all Loading... | |
79 import org.chromium.printing.PrintManagerDelegateImpl; | 80 import org.chromium.printing.PrintManagerDelegateImpl; |
80 import org.chromium.printing.PrintingController; | 81 import org.chromium.printing.PrintingController; |
81 import org.chromium.printing.PrintingControllerImpl; | 82 import org.chromium.printing.PrintingControllerImpl; |
82 import org.chromium.ui.WindowOpenDisposition; | 83 import org.chromium.ui.WindowOpenDisposition; |
83 import org.chromium.ui.base.Clipboard; | 84 import org.chromium.ui.base.Clipboard; |
84 import org.chromium.ui.base.LocalizationUtils; | 85 import org.chromium.ui.base.LocalizationUtils; |
85 import org.chromium.ui.base.PageTransition; | 86 import org.chromium.ui.base.PageTransition; |
86 import org.chromium.ui.base.WindowAndroid; | 87 import org.chromium.ui.base.WindowAndroid; |
87 import org.chromium.ui.gfx.DeviceDisplayInfo; | 88 import org.chromium.ui.gfx.DeviceDisplayInfo; |
88 | 89 |
90 import java.lang.ref.WeakReference; | |
89 import java.nio.ByteBuffer; | 91 import java.nio.ByteBuffer; |
90 import java.util.ArrayList; | 92 import java.util.ArrayList; |
91 import java.util.List; | 93 import java.util.List; |
92 | 94 |
93 /** | 95 /** |
94 * The basic Java representation of a tab. Contains and manages a {@link Conten tView}. | 96 * The basic Java representation of a tab. Contains and manages a {@link Conten tView}. |
95 * | 97 * |
96 * Tab provides common functionality for ChromeShell Tab as well as Chrome on An droid's | 98 * Tab provides common functionality for ChromeShell Tab as well as Chrome on An droid's |
97 * tab. It is intended to be extended either on Java or both Java and C++, with ownership managed | 99 * tab. It is intended to be extended either on Java or both Java and C++, with ownership managed |
98 * by this base class. | 100 * by this base class. |
(...skipping 2736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2835 Tab tab = new Tab(id, parentId, incognito, context, nativeWindow, type, null); | 2837 Tab tab = new Tab(id, parentId, incognito, context, nativeWindow, type, null); |
2836 if (context != null) { | 2838 if (context != null) { |
2837 tab.setTabUma(new TabUma(tab, initiallyHidden ? TabCreationState.LIV E_IN_BACKGROUND | 2839 tab.setTabUma(new TabUma(tab, initiallyHidden ? TabCreationState.LIV E_IN_BACKGROUND |
2838 : TabCreationState.LIV E_IN_FOREGROUND, | 2840 : TabCreationState.LIV E_IN_FOREGROUND, |
2839 tabModelSelector.getModel(incognito))); | 2841 tabModelSelector.getModel(incognito))); |
2840 } | 2842 } |
2841 return tab; | 2843 return tab; |
2842 } | 2844 } |
2843 | 2845 |
2844 /** | 2846 /** |
2845 * Returns an Intent that tells Chrome to open a Tab with a particular ID. | 2847 * @return Intent that tells Chrome to bring an Activity for a particular Ta b back to the |
2848 * foreground, or null if this isn't possible. | |
2846 */ | 2849 */ |
2847 public static Intent createBringTabToFrontIntent(int tabId) { | 2850 public static Intent createBringTabToFrontIntent(int tabId) { |
2851 // Iterate through all active custom tabs and check whether the given ta bId belongs to a | |
gone
2015/09/08 17:51:29
Need to keep using {@link CustomTab} everywhere be
| |
2852 // {@link CustomTab}. If so, return null as the client app's task cannot be foregrounded. | |
2853 List<WeakReference<Activity>> list = ApplicationStatus.getRunningActivit ies(); | |
2854 for (WeakReference<Activity> ref : list) { | |
2855 Activity activity = ref.get(); | |
2856 if (activity instanceof CustomTabActivity | |
2857 && tabId == ((CustomTabActivity) activity).getActivityTab(). getId()) { | |
2858 return null; | |
2859 } | |
2860 } | |
2861 | |
2848 String packageName = ApplicationStatus.getApplicationContext().getPackag eName(); | 2862 String packageName = ApplicationStatus.getApplicationContext().getPackag eName(); |
2849 Intent intent = new Intent(Intent.ACTION_MAIN); | 2863 Intent intent = new Intent(Intent.ACTION_MAIN); |
2850 intent.putExtra(Browser.EXTRA_APPLICATION_ID, packageName); | 2864 intent.putExtra(Browser.EXTRA_APPLICATION_ID, packageName); |
2851 intent.putExtra(TabOpenType.BRING_TAB_TO_FRONT.name(), tabId); | 2865 intent.putExtra(TabOpenType.BRING_TAB_TO_FRONT.name(), tabId); |
2852 intent.setPackage(packageName); | 2866 intent.setPackage(packageName); |
2853 return intent; | 2867 return intent; |
2854 } | 2868 } |
2855 | 2869 |
2856 private native void nativeInit(); | 2870 private native void nativeInit(); |
2857 private native void nativeDestroy(long nativeTabAndroid); | 2871 private native void nativeDestroy(long nativeTabAndroid); |
(...skipping 25 matching lines...) Expand all Loading... | |
2883 private native void nativeAttachOverlayContentViewCore(long nativeTabAndroid , | 2897 private native void nativeAttachOverlayContentViewCore(long nativeTabAndroid , |
2884 ContentViewCore content, boolean visible); | 2898 ContentViewCore content, boolean visible); |
2885 private native void nativeDetachOverlayContentViewCore(long nativeTabAndroid , | 2899 private native void nativeDetachOverlayContentViewCore(long nativeTabAndroid , |
2886 ContentViewCore content); | 2900 ContentViewCore content); |
2887 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String url); | 2901 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String url); |
2888 private native void nativeOnRendererUnresponsive(long nativeTabAndroid); | 2902 private native void nativeOnRendererUnresponsive(long nativeTabAndroid); |
2889 private native void nativeOnRendererResponsive(long nativeTabAndroid); | 2903 private native void nativeOnRendererResponsive(long nativeTabAndroid); |
2890 | 2904 |
2891 private static native void nativeRecordStartupToCommitUma(); | 2905 private static native void nativeRecordStartupToCommitUma(); |
2892 } | 2906 } |
OLD | NEW |