Java Code Examples for org.chromium.chrome.browser.tabmodel.TabCreatorManager#TabCreator

The following examples show how to use org.chromium.chrome.browser.tabmodel.TabCreatorManager#TabCreator . 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: ReaderModeManager.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Open a link from the panel in a new tab.
 * @param url The URL to load.
 */
public void createNewTab(String url) {
    if (mChromeActivity == null) return;

    Tab currentTab = mTabModelSelector.getCurrentTab();
    if (currentTab == null) return;

    TabCreatorManager.TabCreator tabCreator =
            mChromeActivity.getTabCreator(currentTab.isIncognito());
    if (tabCreator == null) return;

    tabCreator.createNewTab(new LoadUrlParams(url, PageTransition.LINK),
            TabModel.TabLaunchType.FROM_LINK, mChromeActivity.getActivityTab());
}
 
Example 2
Source File: ReaderModeManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Open a link from the panel in a new tab.
 * @param url The URL to load.
 */
public void createNewTab(String url) {
    if (mChromeActivity == null) return;

    Tab currentTab = mTabModelSelector.getCurrentTab();
    if (currentTab == null) return;

    TabCreatorManager.TabCreator tabCreator =
            mChromeActivity.getTabCreator(currentTab.isIncognito());
    if (tabCreator == null) return;

    tabCreator.createNewTab(new LoadUrlParams(url, PageTransition.LINK),
            TabModel.TabLaunchType.FROM_LINK, mChromeActivity.getActivityTab());
}
 
Example 3
Source File: ChromeActivity.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public TabCreatorManager.TabCreator getTabCreator(boolean incognito) {
    if (!mTabModelsInitialized) {
        throw new IllegalStateException(
                "Attempting to access TabCreator before initialization");
    }
    return incognito ? mIncognitoTabCreator : mRegularTabCreator;
}
 
Example 4
Source File: ReaderModeManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Open a link from the panel in a new tab.
 * @param url The URL to load.
 */
@Override
public void createNewTab(String url) {
    if (mChromeActivity == null) return;

    Tab currentTab = mTabModelSelector.getCurrentTab();
    if (currentTab == null) return;

    TabCreatorManager.TabCreator tabCreator =
            mChromeActivity.getTabCreator(currentTab.isIncognito());
    if (tabCreator == null) return;

    tabCreator.createNewTab(new LoadUrlParams(url, PageTransition.LINK),
            TabModel.TabLaunchType.FROM_LINK, mChromeActivity.getActivityTab());
}
 
Example 5
Source File: ChromeActivity.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public TabCreatorManager.TabCreator getTabCreator(boolean incognito) {
    if (!mTabModelsInitialized) {
        throw new IllegalStateException(
                "Attempting to access TabCreator before initialization");
    }
    return incognito ? mIncognitoTabCreator : mRegularTabCreator;
}
 
Example 6
Source File: ChromeActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public TabCreatorManager.TabCreator getTabCreator(boolean incognito) {
    return incognito ? mIncognitoTabCreator : mRegularTabCreator;
}
 
Example 7
Source File: ChromeActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Sets the {@link ChromeTabCreator}s owned by this {@link ChromeActivity}.
 * @param regularTabCreator A {@link ChromeTabCreator} instance.
 */
public void setTabCreators(TabCreatorManager.TabCreator regularTabCreator,
        TabCreatorManager.TabCreator incognitoTabCreator) {
    mRegularTabCreator = regularTabCreator;
    mIncognitoTabCreator = incognitoTabCreator;
}
 
Example 8
Source File: ChromeActivity.java    From delion with Apache License 2.0 2 votes vote down vote up
/**
 * Convenience method that returns a tab creator for the currently selected {@link TabModel}.
 * @return A tab creator for the currently selected {@link TabModel}.
 */
public TabCreatorManager.TabCreator getCurrentTabCreator() {
    return getTabCreator(getTabModelSelector().isIncognitoSelected());
}
 
Example 9
Source File: ChromeActivity.java    From AndroidChromium with Apache License 2.0 2 votes vote down vote up
/**
 * Convenience method that returns a tab creator for the currently selected {@link TabModel}.
 * @return A tab creator for the currently selected {@link TabModel}.
 */
public TabCreatorManager.TabCreator getCurrentTabCreator() {
    return getTabCreator(getTabModelSelector().isIncognitoSelected());
}
 
Example 10
Source File: ChromeActivity.java    From 365browser with Apache License 2.0 2 votes vote down vote up
/**
 * Convenience method that returns a tab creator for the currently selected {@link TabModel}.
 * @return A tab creator for the currently selected {@link TabModel}.
 */
public TabCreatorManager.TabCreator getCurrentTabCreator() {
    return getTabCreator(getTabModelSelector().isIncognitoSelected());
}