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

The following examples show how to use org.chromium.chrome.browser.tab.Tab#requestFocus() . 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: LayoutManagerChromePhone.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
protected void tabClosed(int id, int nextId, boolean incognito, boolean tabRemoved) {
    boolean showOverview = nextId == Tab.INVALID_TAB_ID;
    Layout overviewLayout = useAccessibilityLayout() ? mOverviewListLayout : mOverviewLayout;
    if (getActiveLayout() != overviewLayout && showOverview) {
        // Since there will be no 'next' tab to display, switch to
        // overview mode when the animation is finished.
        setNextLayout(overviewLayout);
    }
    getActiveLayout().onTabClosed(time(), id, nextId, incognito);
    Tab nextTab = getTabById(nextId);
    if (nextTab != null) nextTab.requestFocus();
    boolean animate = !tabRemoved && animationsEnabled();
    if (getActiveLayout() != overviewLayout && showOverview && !animate) {
        startShowing(overviewLayout, false);
    }
}
 
Example 2
Source File: LayoutManagerChromePhone.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
protected void tabClosed(int id, int nextId, boolean incognito, boolean tabRemoved) {
    boolean showOverview = nextId == Tab.INVALID_TAB_ID;
    Layout overviewLayout = useAccessibilityLayout() ? mOverviewListLayout : mOverviewLayout;
    if (getActiveLayout() != overviewLayout && showOverview) {
        // Since there will be no 'next' tab to display, switch to
        // overview mode when the animation is finished.
        setNextLayout(overviewLayout);
    }
    getActiveLayout().onTabClosed(time(), id, nextId, incognito);
    Tab nextTab = getTabById(nextId);
    if (nextTab != null) nextTab.requestFocus();
    boolean animate = !tabRemoved && animationsEnabled();
    if (getActiveLayout() != overviewLayout && showOverview && !animate) {
        startShowing(overviewLayout, false);
    }
}
 
Example 3
Source File: LayoutManagerChromePhone.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
protected void tabClosed(int id, int nextId, boolean incognito, boolean tabRemoved) {
    boolean showOverview = nextId == Tab.INVALID_TAB_ID;
    Layout overviewLayout = DeviceClassManager.enableAccessibilityLayout() ? mOverviewListLayout
                                                                           : mOverviewLayout;
    if (getActiveLayout() != overviewLayout && showOverview) {
        // Since there will be no 'next' tab to display, switch to
        // overview mode when the animation is finished.
        setNextLayout(overviewLayout);
    }
    getActiveLayout().onTabClosed(time(), id, nextId, incognito);
    Tab nextTab = getTabById(nextId);
    if (nextTab != null) nextTab.requestFocus();
    boolean animate = !tabRemoved && animationsEnabled();
    if (getActiveLayout() != overviewLayout && showOverview && !animate) {
        startShowing(overviewLayout, false);
    }
}
 
Example 4
Source File: LayoutManagerChromePhone.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
protected void tabCreated(int id, int sourceId, TabLaunchType launchType, boolean isIncognito,
        boolean willBeSelected, float originX, float originY) {
    super.tabCreated(id, sourceId, launchType, isIncognito, willBeSelected, originX, originY);

    if (willBeSelected) {
        Tab newTab = TabModelUtils.getTabById(getTabModelSelector().getModel(isIncognito), id);
        if (newTab != null) newTab.requestFocus();
    }
}
 
Example 5
Source File: LocationBarLayout.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void backKeyPressed() {
    hideSuggestions();
    UiUtils.hideKeyboard(mUrlBar);
    // Revert the URL to match the current page.
    setUrlToPageUrl();
    // Focus the page.
    Tab currentTab = getCurrentTab();
    if (currentTab != null) currentTab.requestFocus();
}
 
Example 6
Source File: LayoutManagerChromePhone.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
protected void tabCreated(int id, int sourceId, TabLaunchType launchType, boolean isIncognito,
        boolean willBeSelected, float originX, float originY) {
    super.tabCreated(id, sourceId, launchType, isIncognito, willBeSelected, originX, originY);

    if (willBeSelected) {
        Tab newTab = TabModelUtils.getTabById(getTabModelSelector().getModel(isIncognito), id);
        if (newTab != null) newTab.requestFocus();
    }
}
 
Example 7
Source File: LocationBarLayout.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void backKeyPressed() {
    hideSuggestions();
    UiUtils.hideKeyboard(mUrlBar);
    // Revert the URL to match the current page.
    setUrlToPageUrl();
    // Focus the page.
    Tab currentTab = getCurrentTab();
    if (currentTab != null) currentTab.requestFocus();
}
 
Example 8
Source File: LayoutManagerChromePhone.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
protected void tabCreated(int id, int sourceId, TabLaunchType launchType, boolean isIncognito,
        boolean willBeSelected, float originX, float originY) {
    super.tabCreated(id, sourceId, launchType, isIncognito, willBeSelected, originX, originY);

    if (willBeSelected) {
        Tab newTab = TabModelUtils.getTabById(getTabModelSelector().getModel(isIncognito), id);
        if (newTab != null) newTab.requestFocus();
    }
}
 
Example 9
Source File: LocationBarLayout.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void backKeyPressed() {
    hideSuggestions();
    UiUtils.hideKeyboard(mUrlBar);
    // Revert the URL to match the current page.
    setUrlToPageUrl();
    // Focus the page.
    Tab currentTab = getCurrentTab();
    if (currentTab != null) currentTab.requestFocus();
}