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();
}
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;
}
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);
}
}
}
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)));
}
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);
}
}
}
Aggregations