Java Code Examples for org.chromium.chrome.browser.tabmodel.TabModelSelector#getTabById()

The following examples show how to use org.chromium.chrome.browser.tabmodel.TabModelSelector#getTabById() . 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: LayoutManagerDocumentTabSwitcher.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void initLayoutTabFromHost(final int tabId) {
    if (getTabModelSelector() == null || getActiveLayout() == null) return;

    TabModelSelector selector = ChromeApplication.getDocumentTabModelSelector();
    Tab tab = selector.getTabById(tabId);
    if (tab == null) return;

    LayoutTab layoutTab = getExistingLayoutTab(tabId);
    if (layoutTab == null) return;

    if (mTitleCache != null && layoutTab.isTitleNeeded()) {
        mTitleCache.getUpdatedTitle(tab, "");
    }
    super.initLayoutTabFromHost(tabId);
}
 
Example 2
Source File: LayoutManagerChrome.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void initLayoutTabFromHost(final int tabId) {
    super.initLayoutTabFromHost(tabId);

    if (getTabModelSelector() == null || getActiveLayout() == null) return;

    TabModelSelector selector = getTabModelSelector();
    Tab tab = selector.getTabById(tabId);
    if (tab == null) return;

    LayoutTab layoutTab = getExistingLayoutTab(tabId);
    if (layoutTab == null) return;

    if (mTitleCache != null && layoutTab.isTitleNeeded()) {
        mTitleCache.getUpdatedTitle(tab, "");
    }
}
 
Example 3
Source File: LayoutManagerDocument.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void initLayoutTabFromHost(final int tabId) {
    if (getTabModelSelector() == null || getActiveLayout() == null) return;

    TabModelSelector selector = getTabModelSelector();
    Tab tab = selector.getTabById(tabId);
    if (tab == null) return;

    LayoutTab layoutTab = mTabCache.get(tabId);
    if (layoutTab == null) return;

    String url = tab.getUrl();
    boolean isNativePage = url != null && url.startsWith(UrlConstants.CHROME_NATIVE_SCHEME);
    int themeColor = tab.getThemeColor();
    boolean canUseLiveTexture =
            tab.getContentViewCore() != null && !tab.isShowingSadTab() && !isNativePage;
    layoutTab.initFromHost(tab.getBackgroundColor(), tab.shouldStall(), canUseLiveTexture,
            themeColor, ColorUtils.getTextBoxColorForToolbarBackground(
                                mContext.getResources(), tab, themeColor),
            ColorUtils.getTextBoxAlphaForToolbarBackground(tab));

    mHost.requestRender();
}
 
Example 4
Source File: LayoutManagerDocument.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void initLayoutTabFromHost(final int tabId) {
    if (getTabModelSelector() == null || getActiveLayout() == null) return;

    TabModelSelector selector = getTabModelSelector();
    Tab tab = selector.getTabById(tabId);
    if (tab == null) return;

    LayoutTab layoutTab = mTabCache.get(tabId);
    if (layoutTab == null) return;

    String url = tab.getUrl();
    boolean isNativePage = url != null && url.startsWith(UrlConstants.CHROME_NATIVE_SCHEME);
    int themeColor = tab.getThemeColor();
    // TODO(xingliu): Remove this override themeColor for Blimp tabs. See crbug.com/644774.
    if (tab.isBlimpTab() && tab.getBlimpContents() != null) {
        themeColor = tab.getBlimpContents().getThemeColor();
    }

    boolean canUseLiveTexture = tab.isBlimpTab()
            || tab.getContentViewCore() != null && !tab.isShowingSadTab() && !isNativePage;

    boolean needsUpdate = layoutTab.initFromHost(tab.getBackgroundColor(), tab.shouldStall(),
            canUseLiveTexture, themeColor, ColorUtils.getTextBoxColorForToolbarBackground(
                                mContext.getResources(), tab, themeColor),
            ColorUtils.getTextBoxAlphaForToolbarBackground(tab));
    if (needsUpdate) requestUpdate();

    mHost.requestRender();
}
 
Example 5
Source File: LayoutManagerDocument.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void initLayoutTabFromHost(final int tabId) {
    if (getTabModelSelector() == null || getActiveLayout() == null) return;

    TabModelSelector selector = getTabModelSelector();
    Tab tab = selector.getTabById(tabId);
    if (tab == null) return;

    LayoutTab layoutTab = mTabCache.get(tabId);
    if (layoutTab == null) return;

    String url = tab.getUrl();
    boolean isNativePage = url != null && url.startsWith(UrlConstants.CHROME_NATIVE_URL_PREFIX);
    int themeColor = tab.getThemeColor();

    boolean canUseLiveTexture =
            tab.getContentViewCore() != null && !tab.isShowingSadTab() && !isNativePage;

    boolean isNtp = tab.getNativePage() instanceof NewTabPage;
    boolean needsUpdate = layoutTab.initFromHost(tab.getBackgroundColor(), tab.shouldStall(),
            canUseLiveTexture, themeColor,
            ColorUtils.getTextBoxColorForToolbarBackground(
                    mContext.getResources(), isNtp, themeColor),
            ColorUtils.getTextBoxAlphaForToolbarBackground(tab));
    if (needsUpdate) requestUpdate();

    mHost.requestRender();
}
 
Example 6
Source File: LayoutManagerChrome.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * @param id The id of the {@link Tab} to search for.
 * @return   A {@link Tab} instance or {@code null} if it could be found.
 */
protected Tab getTabById(int id) {
    TabModelSelector selector = getTabModelSelector();
    return selector == null ? null : selector.getTabById(id);
}
 
Example 7
Source File: LayoutManagerChrome.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * @param id The id of the {@link Tab} to search for.
 * @return   A {@link Tab} instance or {@code null} if it could be found.
 */
protected Tab getTabById(int id) {
    TabModelSelector selector = getTabModelSelector();
    return selector == null ? null : selector.getTabById(id);
}
 
Example 8
Source File: LayoutManagerChrome.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * @param id The id of the {@link Tab} to search for.
 * @return   A {@link Tab} instance or {@code null} if it could be found.
 */
protected Tab getTabById(int id) {
    TabModelSelector selector = getTabModelSelector();
    return selector == null ? null : selector.getTabById(id);
}