Java Code Examples for org.chromium.chrome.browser.tab.Tab#show()

The following examples show how to use org.chromium.chrome.browser.tab.Tab#show() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FullScreenActivity.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void initializeState() {
    super.initializeState();

    Tab tab = createTab();
    getTabModelSelector().setTab(tab);
    handleTabContentChanged();
    tab.show(TabSelectionType.FROM_NEW);
}
 
Example 2
Source File: TabModelSelectorImpl.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public void requestToShowTab(Tab tab, TabSelectionType type) {
    boolean isFromExternalApp = tab != null
            && tab.getLaunchType() == TabLaunchType.FROM_EXTERNAL_APP;

    if (mVisibleTab != tab && tab != null && !tab.isNativePage()) {
        TabModelImpl.startTabSwitchLatencyTiming(type);
    }
    if (mVisibleTab != null && mVisibleTab != tab && !mVisibleTab.needsReload()) {
        if (mVisibleTab.isInitialized() && !mVisibleTab.isDetachedForReparenting()) {
            // TODO(dtrainor): Once we figure out why we can't grab a snapshot from the current
            // tab when we have other tabs loading from external apps remove the checks for
            // FROM_EXTERNAL_APP/FROM_NEW.
            if (!mVisibleTab.isClosing()
                    && (!isFromExternalApp || type != TabSelectionType.FROM_NEW)) {
                cacheTabBitmap(mVisibleTab);
            }
            mVisibleTab.hide();
            mVisibleTab.setFullscreenManager(null);
            mTabSaver.addTabToSaveQueue(mVisibleTab);
        }
        mVisibleTab = null;
    }

    if (tab == null) {
        notifyChanged();
        return;
    }

    // We hit this case when the user enters tab switcher and comes back to the current tab
    // without actual tab switch.
    if (mVisibleTab == tab && !mVisibleTab.isHidden()) {
        // The current tab might have been killed by the os while in tab switcher.
        tab.loadIfNeeded();
        return;
    }

    tab.setFullscreenManager(mActivity.getFullscreenManager());
    mVisibleTab = tab;

    // Don't execute the tab display part if Chrome has just been sent to background. This
    // avoids uneccessary work (tab restore) and prevents pollution of tab display metrics - see
    // http://crbug.com/316166.
    if (type != TabSelectionType.FROM_EXIT) {
        tab.show(type);
        mUma.onShowTab(tab.getId(), tab.isBeingRestored());
    }
}
 
Example 3
Source File: TabModelSelectorImpl.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public void requestToShowTab(Tab tab, TabSelectionType type) {
    boolean isFromExternalApp = tab != null
            && tab.getLaunchType() == TabLaunchType.FROM_EXTERNAL_APP;

    if (mVisibleTab != tab && tab != null && !tab.isNativePage()) {
        TabModelImpl.startTabSwitchLatencyTiming(type);
    }
    if (mVisibleTab != null && mVisibleTab != tab && !mVisibleTab.needsReload()) {
        if (mVisibleTab.isInitialized() && !mVisibleTab.isDetachedForReparenting()) {
            // TODO(dtrainor): Once we figure out why we can't grab a snapshot from the current
            // tab when we have other tabs loading from external apps remove the checks for
            // FROM_EXTERNAL_APP/FROM_NEW.
            if (!mVisibleTab.isClosing()
                    && (!isFromExternalApp || type != TabSelectionType.FROM_NEW)) {
                cacheTabBitmap(mVisibleTab);
            }
            mVisibleTab.hide();
            mTabSaver.addTabToSaveQueue(mVisibleTab);
        }
        mVisibleTab = null;
    }

    if (tab == null) {
        notifyChanged();
        return;
    }

    // We hit this case when the user enters tab switcher and comes back to the current tab
    // without actual tab switch.
    if (mVisibleTab == tab && !mVisibleTab.isHidden()) {
        // The current tab might have been killed by the os while in tab switcher.
        tab.loadIfNeeded();
        return;
    }
    mVisibleTab = tab;

    // Don't execute the tab display part if Chrome has just been sent to background. This
    // avoids uneccessary work (tab restore) and prevents pollution of tab display metrics - see
    // http://crbug.com/316166.
    if (type != TabSelectionType.FROM_EXIT) {
        tab.show(type);
        mUma.onShowTab(tab.getId(), tab.isBeingRestored());
    }
}
 
Example 4
Source File: TabModelSelectorImpl.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void requestToShowTab(Tab tab, TabSelectionType type) {
    boolean isFromExternalApp = tab != null
            && tab.getLaunchType() == TabLaunchType.FROM_EXTERNAL_APP;

    if (mVisibleTab != tab && tab != null && !tab.isNativePage()) {
        TabModelImpl.startTabSwitchLatencyTiming(type);
    }
    if (mVisibleTab != null && mVisibleTab != tab && !mVisibleTab.needsReload()) {
        if (mVisibleTab.isInitialized() && !mVisibleTab.isDetached()) {
            // TODO(dtrainor): Once we figure out why we can't grab a snapshot from the current
            // tab when we have other tabs loading from external apps remove the checks for
            // FROM_EXTERNAL_APP/FROM_NEW.
            if (!mVisibleTab.isClosing()
                    && (!isFromExternalApp || type != TabSelectionType.FROM_NEW)) {
                cacheTabBitmap(mVisibleTab);
            }
            mVisibleTab.hide();
            mTabSaver.addTabToSaveQueue(mVisibleTab);
        }
        mVisibleTab = null;
    }

    if (tab == null) {
        notifyChanged();
        return;
    }

    // We hit this case when the user enters tab switcher and comes back to the current tab
    // without actual tab switch.
    if (mVisibleTab == tab && !mVisibleTab.isHidden()) {
        // The current tab might have been killed by the os while in tab switcher.
        tab.loadIfNeeded();
        return;
    }
    mVisibleTab = tab;

    // Don't execute the tab display part if Chrome has just been sent to background. This
    // avoids uneccessary work (tab restore) and prevents pollution of tab display metrics - see
    // http://crbug.com/316166.
    if (type != TabSelectionType.FROM_EXIT) {
        tab.show(type);
        mUma.onShowTab(tab.getId(), tab.isBeingRestored());
    }
}