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

The following examples show how to use org.chromium.chrome.browser.tab.Tab#getDelegateFactory() . 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: ChromeTabCreator.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public boolean createTabWithWebContents(Tab parent, WebContents webContents, int parentId,
        TabLaunchType type, String url) {
    // The parent tab was already closed.  Do not open child tabs.
    if (mTabModel.isClosurePending(parentId)) return false;

    // If parent is in the same tab model, place the new tab next to it.
    int position = TabModel.INVALID_TAB_INDEX;
    int index = TabModelUtils.getTabIndexById(mTabModel, parentId);
    if (index != TabModel.INVALID_TAB_INDEX) position = index + 1;

    boolean openInForeground = mOrderController.willOpenInForeground(type, mIncognito);
    TabDelegateFactory delegateFactory = parent == null ? new TabDelegateFactory()
            : parent.getDelegateFactory();
    Tab tab = Tab.createLiveTab(Tab.INVALID_TAB_ID, mActivity, mIncognito,
            mNativeWindow, type, parentId, !openInForeground);
    tab.initialize(webContents, mTabContentManager, delegateFactory, !openInForeground, false);
    mTabModel.addTab(tab, position, type);
    return true;
}
 
Example 2
Source File: ChromeTabCreator.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public boolean createTabWithWebContents(Tab parent, WebContents webContents, int parentId,
        TabLaunchType type, String url) {
    // The parent tab was already closed.  Do not open child tabs.
    if (mTabModel.isClosurePending(parentId)) return false;

    // If parent is in the same tab model, place the new tab next to it.
    int position = TabModel.INVALID_TAB_INDEX;
    int index = TabModelUtils.getTabIndexById(mTabModel, parentId);
    if (index != TabModel.INVALID_TAB_INDEX) position = index + 1;

    boolean openInForeground = mOrderController.willOpenInForeground(type, mIncognito);
    TabDelegateFactory delegateFactory = parent == null ? createDefaultTabDelegateFactory()
            : parent.getDelegateFactory();
    Tab tab = Tab.createLiveTab(Tab.INVALID_TAB_ID, mActivity, mIncognito,
            mNativeWindow, type, parentId, !openInForeground);
    tab.initialize(webContents, mTabContentManager, delegateFactory, !openInForeground, false);
    mTabModel.addTab(tab, position, type);
    return true;
}
 
Example 3
Source File: ChromeTabCreator.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public boolean createTabWithWebContents(Tab parent, WebContents webContents, int parentId,
        TabLaunchType type, String url) {
    // The parent tab was already closed.  Do not open child tabs.
    if (mTabModel.isClosurePending(parentId)) return false;

    // If parent is in the same tab model, place the new tab next to it.
    int position = TabModel.INVALID_TAB_INDEX;
    int index = TabModelUtils.getTabIndexById(mTabModel, parentId);
    if (index != TabModel.INVALID_TAB_INDEX) position = index + 1;

    boolean openInForeground = mOrderController.willOpenInForeground(type, mIncognito);
    TabDelegateFactory delegateFactory = parent == null ? createDefaultTabDelegateFactory()
            : parent.getDelegateFactory();
    Tab tab = Tab.createLiveTab(Tab.INVALID_TAB_ID, mActivity, mIncognito,
            mNativeWindow, type, parentId, !openInForeground);
    tab.initialize(webContents, mTabContentManager, delegateFactory, !openInForeground, false);
    mTabModel.addTab(tab, position, type);
    return true;
}
 
Example 4
Source File: TabPersistentStore.java    From delion with Apache License 2.0 5 votes vote down vote up
public void addTabToSaveQueue(Tab tab) {
    // TODO(ianwen): remove this check once we figure out a better plan to disable tab saving.
    if (tab.getDelegateFactory() instanceof CustomTabDelegateFactory) {
        return;
    }
    if (!mTabsToSave.contains(tab) && tab.isTabStateDirty() && !isTabUrlContentScheme(tab)) {
        mTabsToSave.addLast(tab);
    }
    saveNextTab();
}