Java Code Examples for org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType#FROM_RESTORE

The following examples show how to use org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType#FROM_RESTORE . 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: LayoutManagerChrome.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void didAddTab(Tab tab, TabLaunchType launchType) {
    int tabId = tab.getId();
    if (launchType != TabLaunchType.FROM_RESTORE) {
        boolean incognito = tab.isIncognito();
        boolean willBeSelected = launchType != TabLaunchType.FROM_LONGPRESS_BACKGROUND
                || (!getTabModelSelector().isIncognitoSelected() && incognito);
        float lastTapX = LocalizationUtils.isLayoutRtl() ? mLastContentWidthDp : 0.f;
        float lastTapY = 0.f;
        if (launchType != TabLaunchType.FROM_CHROME_UI) {
            float heightDelta =
                    mLastFullscreenViewportDp.height() - mLastVisibleViewportDp.height();
            lastTapX = mPxToDp * mLastTapX;
            lastTapY = mPxToDp * mLastTapY - heightDelta;
        }

        tabCreated(tabId, getTabModelSelector().getCurrentTabId(), launchType, incognito,
                willBeSelected, lastTapX, lastTapY);
    }
}
 
Example 2
Source File: LayoutManagerChrome.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void didAddTab(Tab tab, TabLaunchType launchType) {
    int tabId = tab.getId();
    if (launchType == TabLaunchType.FROM_RESTORE) {
        getActiveLayout().onTabRestored(time(), tabId);
    } else {
        boolean incognito = tab.isIncognito();
        boolean willBeSelected = launchType != TabLaunchType.FROM_LONGPRESS_BACKGROUND
                || (!getTabModelSelector().isIncognitoSelected() && incognito);
        float lastTapX = LocalizationUtils.isLayoutRtl() ? mLastContentWidthDp : 0.f;
        float lastTapY = 0.f;
        if (launchType != TabLaunchType.FROM_CHROME_UI) {
            float heightDelta =
                    mLastFullscreenViewportDp.height() - mLastVisibleViewportDp.height();
            lastTapX = mPxToDp * mLastTapX;
            lastTapY = mPxToDp * mLastTapY - heightDelta;
        }

        tabCreated(tabId, getTabModelSelector().getCurrentTabId(), launchType, incognito,
                willBeSelected, lastTapX, lastTapY);
    }
}
 
Example 3
Source File: LayoutManagerChrome.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public void didAddTab(Tab tab, TabLaunchType launchType) {
    int tabId = tab.getId();
    if (launchType == TabLaunchType.FROM_RESTORE) {
        getActiveLayout().onTabRestored(time(), tabId);
    } else {
        boolean incognito = tab.isIncognito();
        boolean willBeSelected = launchType != TabLaunchType.FROM_LONGPRESS_BACKGROUND
                || (!getTabModelSelector().isIncognitoSelected() && incognito);
        float lastTapX = LocalizationUtils.isLayoutRtl()
                ? mHost.getWidth() * mPxToDp : 0.f;
        float lastTapY = 0.f;
        if (launchType != TabLaunchType.FROM_CHROME_UI) {
            float heightDelta = mHost.getHeightMinusBrowserControls() * mPxToDp;
            lastTapX = mPxToDp * mLastTapX;
            lastTapY = mPxToDp * mLastTapY - heightDelta;
        }

        tabCreated(tabId, getTabModelSelector().getCurrentTabId(), launchType, incognito,
                willBeSelected, lastTapX, lastTapY);
    }
}
 
Example 4
Source File: LayoutManagerChrome.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void willAddTab(Tab tab, TabLaunchType type) {
    // Open the new tab
    if (type == TabLaunchType.FROM_RESTORE) return;
    if (type == TabLaunchType.FROM_REPARENTING) return;

    tabCreating(getTabModelSelector().getCurrentTabId(), tab.getUrl(), tab.isIncognito());
}
 
Example 5
Source File: LayoutManagerChrome.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void willAddTab(Tab tab, TabLaunchType type) {
    // Open the new tab
    if (type == TabLaunchType.FROM_RESTORE) return;
    if (type == TabLaunchType.FROM_REPARENTING) return;
    if (type == TabLaunchType.FROM_EXTERNAL_APP) return;

    tabCreating(getTabModelSelector().getCurrentTabId(), tab.getUrl(), tab.isIncognito());
}
 
Example 6
Source File: CustomTabLayoutManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void didAddTab(Tab tab, TabLaunchType type) {
    if (type == TabLaunchType.FROM_RESTORE) {
        getActiveLayout().onTabRestored(time(), tab.getId());
    } else {
        int newIndex = TabModelUtils.getTabIndexById(getTabModelSelector().getModel(false),
                tab.getId());
        getActiveLayout().onTabCreated(time(), tab.getId(), newIndex,
                getTabModelSelector().getCurrentTabId(), false, false, 0f, 0f);
    }
}
 
Example 7
Source File: LayoutManagerChrome.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void willAddTab(Tab tab, TabLaunchType type) {
    // Open the new tab
    if (type == TabLaunchType.FROM_RESTORE) return;
    if (type == TabLaunchType.FROM_REPARENTING) return;
    if (type == TabLaunchType.FROM_EXTERNAL_APP) return;
    if (type == TabLaunchType.FROM_LAUNCHER_SHORTCUT) return;

    tabCreating(getTabModelSelector().getCurrentTabId(), tab.getUrl(), tab.isIncognito());
}
 
Example 8
Source File: CustomTabLayoutManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void didAddTab(Tab tab, TabLaunchType type) {
    if (type == TabLaunchType.FROM_RESTORE) {
        getActiveLayout().onTabRestored(time(), tab.getId());
    } else {
        int newIndex = TabModelUtils.getTabIndexById(getTabModelSelector().getModel(false),
                tab.getId());
        getActiveLayout().onTabCreated(time(), tab.getId(), newIndex,
                getTabModelSelector().getCurrentTabId(), false, false, 0f, 0f);
    }
}
 
Example 9
Source File: TabModelOrderController.java    From delion with Apache License 2.0 3 votes vote down vote up
/**
 * Determine if a launch type will result in the tab being opened in the
 * foreground.
 * @param type               The type of opening event.
 * @param isNewTabIncognito  True if the new opened tab is incognito.
 * @return                   True if the tab will be in the foreground
 */
public boolean willOpenInForeground(TabLaunchType type, boolean isNewTabIncognito) {
    // Restore is handling the active index by itself.
    if (type == TabLaunchType.FROM_RESTORE) return false;
    return type != TabLaunchType.FROM_LONGPRESS_BACKGROUND
            || (!mTabModelSelector.isIncognitoSelected() && isNewTabIncognito);
}
 
Example 10
Source File: TabModelOrderController.java    From AndroidChromium with Apache License 2.0 3 votes vote down vote up
/**
 * Determine if a launch type will result in the tab being opened in the
 * foreground.
 * @param type               The type of opening event.
 * @param isNewTabIncognito  True if the new opened tab is incognito.
 * @return                   True if the tab will be in the foreground
 */
public boolean willOpenInForeground(TabLaunchType type, boolean isNewTabIncognito) {
    // Restore is handling the active index by itself.
    if (type == TabLaunchType.FROM_RESTORE) return false;
    return type != TabLaunchType.FROM_LONGPRESS_BACKGROUND
            || (!mTabModelSelector.isIncognitoSelected() && isNewTabIncognito);
}
 
Example 11
Source File: TabModelOrderController.java    From 365browser with Apache License 2.0 3 votes vote down vote up
/**
 * Determine if a launch type will result in the tab being opened in the
 * foreground.
 * @param type               The type of opening event.
 * @param isNewTabIncognito  True if the new opened tab is incognito.
 * @return                   True if the tab will be in the foreground
 */
public boolean willOpenInForeground(TabLaunchType type, boolean isNewTabIncognito) {
    // Restore is handling the active index by itself.
    if (type == TabLaunchType.FROM_RESTORE) return false;
    return type != TabLaunchType.FROM_LONGPRESS_BACKGROUND
            || (!mTabModelSelector.isIncognitoSelected() && isNewTabIncognito);
}