Search in sources :

Example 1 with LayoutTab

use of org.chromium.chrome.browser.compositor.layouts.components.LayoutTab in project AndroidChromium by JackyAndroid.

the class LayoutManagerDocument method initLayoutTabFromHost.

@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();
}
Also used : LayoutTab(org.chromium.chrome.browser.compositor.layouts.components.LayoutTab) Tab(org.chromium.chrome.browser.tab.Tab) DocumentTabModelSelector(org.chromium.chrome.browser.tabmodel.document.DocumentTabModelSelector) TabModelSelector(org.chromium.chrome.browser.tabmodel.TabModelSelector) LayoutTab(org.chromium.chrome.browser.compositor.layouts.components.LayoutTab)

Example 2 with LayoutTab

use of org.chromium.chrome.browser.compositor.layouts.components.LayoutTab in project AndroidChromium by JackyAndroid.

the class LayoutManagerDocument method createLayoutTab.

@Override
public LayoutTab createLayoutTab(int id, boolean incognito, boolean showCloseButton, boolean isTitleNeeded, float maxContentWidth, float maxContentHeight) {
    LayoutTab tab = mTabCache.get(id);
    if (tab == null) {
        tab = new LayoutTab(id, incognito, mLastContentWidthDp, mLastContentHeightDp, showCloseButton, isTitleNeeded);
        mTabCache.put(id, tab);
    } else {
        tab.init(mLastContentWidthDp, mLastContentHeightDp, showCloseButton, isTitleNeeded);
    }
    if (maxContentWidth > 0.f)
        tab.setMaxContentWidth(maxContentWidth);
    if (maxContentHeight > 0.f)
        tab.setMaxContentHeight(maxContentHeight);
    return tab;
}
Also used : LayoutTab(org.chromium.chrome.browser.compositor.layouts.components.LayoutTab)

Example 3 with LayoutTab

use of org.chromium.chrome.browser.compositor.layouts.components.LayoutTab in project AndroidChromium by JackyAndroid.

the class LayoutManagerDocumentTabSwitcher method startHiding.

@Override
public void startHiding(int nextTabId, boolean hintAtTabSelection) {
    super.startHiding(nextTabId, hintAtTabSelection);
    Layout layoutBeingHidden = getActiveLayout();
    if (isOverviewLayout(layoutBeingHidden)) {
        boolean showToolbar = true;
        if (layoutBeingHidden == mOverviewLayout) {
            final LayoutTab tab = layoutBeingHidden.getLayoutTab(nextTabId);
            // Note: this value is reversed in LayoutManagerChrome#startHiding.
            showToolbar = tab != null ? tab.showToolbar() : true;
        }
        boolean delayAnimation = false;
        for (OverviewModeObserver observer : mOverviewModeObservers) {
            observer.onOverviewModeStartedHiding(showToolbar, delayAnimation);
        }
    }
}
Also used : OverviewListLayout(org.chromium.chrome.browser.widget.OverviewListLayout) StackLayout(org.chromium.chrome.browser.compositor.layouts.phone.StackLayout) LayoutTab(org.chromium.chrome.browser.compositor.layouts.components.LayoutTab)

Example 4 with LayoutTab

use of org.chromium.chrome.browser.compositor.layouts.components.LayoutTab in project AndroidChromium by JackyAndroid.

the class SimpleAnimationLayout method ensureSourceTabCreated.

private void ensureSourceTabCreated(int sourceTabId) {
    if (mLayoutTabs != null && mLayoutTabs.length == 1 && mLayoutTabs[0].getId() == sourceTabId) {
        return;
    }
    // Just draw the source tab on the screen.
    TabModel sourceModel = mTabModelSelector.getModelForTabId(sourceTabId);
    if (sourceModel == null)
        return;
    LayoutTab sourceLayoutTab = createLayoutTab(sourceTabId, sourceModel.isIncognito(), NO_CLOSE_BUTTON, NO_TITLE);
    sourceLayoutTab.setBorderAlpha(0.0f);
    mLayoutTabs = new LayoutTab[] { sourceLayoutTab };
    updateCacheVisibleIds(new LinkedList<Integer>(Arrays.asList(sourceTabId)));
}
Also used : LayoutTab(org.chromium.chrome.browser.compositor.layouts.components.LayoutTab) TabModel(org.chromium.chrome.browser.tabmodel.TabModel)

Example 5 with LayoutTab

use of org.chromium.chrome.browser.compositor.layouts.components.LayoutTab in project AndroidChromium by JackyAndroid.

the class LayoutManagerChrome method startHiding.

@Override
public void startHiding(int nextTabId, boolean hintAtTabSelection) {
    super.startHiding(nextTabId, hintAtTabSelection);
    Layout layoutBeingHidden = getActiveLayout();
    if (isOverviewLayout(layoutBeingHidden)) {
        boolean showToolbar = true;
        if (mEnableAnimations && layoutBeingHidden == mOverviewLayout) {
            final LayoutTab tab = layoutBeingHidden.getLayoutTab(nextTabId);
            showToolbar = tab != null ? !tab.showToolbar() : true;
        }
        boolean creatingNtp = layoutBeingHidden == mOverviewLayout && mCreatingNtp;
        for (OverviewModeObserver observer : mOverviewModeObservers) {
            observer.onOverviewModeStartedHiding(showToolbar, creatingNtp);
        }
    }
}
Also used : OverviewListLayout(org.chromium.chrome.browser.widget.OverviewListLayout) LayoutTab(org.chromium.chrome.browser.compositor.layouts.components.LayoutTab)

Aggregations

LayoutTab (org.chromium.chrome.browser.compositor.layouts.components.LayoutTab)26 TabModel (org.chromium.chrome.browser.tabmodel.TabModel)4 ChromeAnimation (org.chromium.chrome.browser.compositor.layouts.ChromeAnimation)3 Animatable (org.chromium.chrome.browser.compositor.layouts.ChromeAnimation.Animatable)3 Resources (android.content.res.Resources)2 Tab (org.chromium.chrome.browser.tab.Tab)2 OverviewListLayout (org.chromium.chrome.browser.widget.OverviewListLayout)2 Interpolator (android.view.animation.Interpolator)1 ArrayList (java.util.ArrayList)1 Layout (org.chromium.chrome.browser.compositor.layouts.Layout)1 StackLayout (org.chromium.chrome.browser.compositor.layouts.phone.StackLayout)1 SceneLayer (org.chromium.chrome.browser.compositor.scene_layer.SceneLayer)1 TabModelSelector (org.chromium.chrome.browser.tabmodel.TabModelSelector)1 DocumentTabModelSelector (org.chromium.chrome.browser.tabmodel.document.DocumentTabModelSelector)1 BakedBezierInterpolator (org.chromium.ui.interpolators.BakedBezierInterpolator)1