org.chromium.chrome.browser.tab.TabDelegateFactory Java Examples

The following examples show how to use org.chromium.chrome.browser.tab.TabDelegateFactory. 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: SearchActivity.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void finishNativeInitialization() {
    super.finishNativeInitialization();

    mTab = new Tab(TabIdManager.getInstance().generateValidId(Tab.INVALID_TAB_ID),
            Tab.INVALID_TAB_ID, false, this, getWindowAndroid(),
            TabLaunchType.FROM_EXTERNAL_APP, null, null);
    mTab.initialize(WebContentsFactory.createWebContents(false, false), null,
            new TabDelegateFactory(), false, false);
    mTab.loadUrl(new LoadUrlParams("about:blank"));

    mSearchBoxDataProvider.onNativeLibraryReady(mTab);
    mSearchBox.onNativeLibraryReady();

    // Force the user to choose a search engine if they have to.
    final Callback<Boolean> deferredCallback = new Callback<Boolean>() {
        @Override
        public void onResult(Boolean result) {
            if (result == null || !result.booleanValue()) {
                Log.e(TAG, "User failed to select a default search engine.");
                finish();
                return;
            }

            finishDeferredInitialization();
        }
    };
    if (!getActivityDelegate().showSearchEngineDialogIfNeeded(this, deferredCallback)) {
        mHandler.post(new Runnable() {
            @Override
            public void run() {
                finishDeferredInitialization();
            }
        });
    }
}
 
Example #5
Source File: WebappActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
protected TabDelegateFactory createTabDelegateFactory() {
    return new WebappDelegateFactory(this);
}
 
Example #6
Source File: FullScreenActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * @return {@link TabDelegateFactory} to be used while creating the associated {@link Tab}.
 */
protected TabDelegateFactory createTabDelegateFactory() {
    return new FullScreenDelegateFactory();
}
 
Example #7
Source File: ChromeTabbedActivity.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public TabDelegateFactory createDefaultTabDelegateFactory() {
    return new TabbedModeTabDelegateFactory();
}
 
Example #8
Source File: ChromeTabCreator.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * @return The default tab delegate factory to be used if creating new tabs w/o parents.
 */
public TabDelegateFactory createDefaultTabDelegateFactory() {
    return new TabDelegateFactory();
}
 
Example #9
Source File: CustomTabActivity.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public TabDelegateFactory createDefaultTabDelegateFactory() {
    return new CustomTabDelegateFactory(
            mSupportsUrlBarHiding, mIsOpenedByChrome, mVisibilityDelegate);
}
 
Example #10
Source File: WebappActivity.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
protected TabDelegateFactory createTabDelegateFactory() {
    return new WebappDelegateFactory(this);
}
 
Example #11
Source File: FullScreenActivity.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * @return {@link TabDelegateFactory} to be used while creating the associated {@link Tab}.
 */
protected TabDelegateFactory createTabDelegateFactory() {
    return new FullScreenDelegateFactory();
}
 
Example #12
Source File: ChromeTabbedActivity.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public TabDelegateFactory createDefaultTabDelegateFactory() {
    return new TabbedModeTabDelegateFactory();
}
 
Example #13
Source File: ChromeTabCreator.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * @return The default tab delegate factory to be used if creating new tabs w/o parents.
 */
public TabDelegateFactory createDefaultTabDelegateFactory() {
    return new TabDelegateFactory();
}
 
Example #14
Source File: CustomTabActivity.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public TabDelegateFactory createDefaultTabDelegateFactory() {
    return new CustomTabDelegateFactory(
            mSupportsUrlBarHiding, mIsOpenedByChrome, mVisibilityDelegate);
}
 
Example #15
Source File: WebappActivity.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
protected TabDelegateFactory createTabDelegateFactory() {
    return new WebappDelegateFactory(this);
}
 
Example #16
Source File: FullScreenActivity.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * @return {@link TabDelegateFactory} to be used while creating the associated {@link Tab}.
 */
protected TabDelegateFactory createTabDelegateFactory() {
    return new FullScreenDelegateFactory();
}