Java Code Examples for org.chromium.chrome.browser.compositor.layouts.components.LayoutTab#setAnonymizeToolbar()

The following examples show how to use org.chromium.chrome.browser.compositor.layouts.components.LayoutTab#setAnonymizeToolbar() . 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: Stack.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Creates the {@link StackTab}s needed for display and populates {@link #mStackTabs}.
 * It is called from show() at the beginning of every new draw phase. It tries to reuse old
 * {@link StackTab} instead of creating new ones every time.
 * @param restoreState Whether or not to restore the {@link LayoutTab} state when we rebuild the
 *                     {@link StackTab}s.  There are some properties like maximum content size
 *                     or whether or not to show the toolbar that might have to be restored if
 *                     we're calling this while the switcher is already visible.
 */
private void createStackTabs(boolean restoreState) {
    final int count = mTabModel.getCount();
    if (count == 0) {
        cleanupTabs();
    } else {
        StackTab[] oldTabs = mStackTabs;
        mStackTabs = new StackTab[count];

        final boolean isIncognito = mTabModel.isIncognito();
        final boolean needTitle = !mLayout.isHiding();
        for (int i = 0; i < count; ++i) {
            Tab tab = mTabModel.getTabAt(i);
            int tabId = tab != null ? tab.getId() : Tab.INVALID_TAB_ID;
            mStackTabs[i] = findTabById(oldTabs, tabId);

            float maxContentWidth = -1.f;
            float maxContentHeight = -1.f;

            if (mStackTabs[i] != null && mStackTabs[i].getLayoutTab() != null && restoreState) {
                maxContentWidth = mStackTabs[i].getLayoutTab().getMaxContentWidth();
                maxContentHeight = mStackTabs[i].getLayoutTab().getMaxContentHeight();
            }

            LayoutTab layoutTab = mLayout.createLayoutTab(tabId, isIncognito,
                    Layout.SHOW_CLOSE_BUTTON, needTitle, maxContentWidth, maxContentHeight);
            layoutTab.setInsetBorderVertical(true);
            layoutTab.setShowToolbar(true);
            layoutTab.setToolbarAlpha(0.f);
            layoutTab.setAnonymizeToolbar(!mIsStackForCurrentTabModel
                    || mTabModel.index() != i);

            if (mStackTabs[i] == null) {
                mStackTabs[i] = new StackTab(layoutTab);
            } else {
                mStackTabs[i].setLayoutTab(layoutTab);
            }

            mStackTabs[i].setNewIndex(i);
            // The initial enterStack animation will take care of
            // positioning, scaling, etc.
        }
    }
}
 
Example 2
Source File: Stack.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Creates the {@link StackTab}s needed for display and populates {@link #mStackTabs}.
 * It is called from show() at the beginning of every new draw phase. It tries to reuse old
 * {@link StackTab} instead of creating new ones every time.
 * @param restoreState Whether or not to restore the {@link LayoutTab} state when we rebuild the
 *                     {@link StackTab}s.  There are some properties like maximum content size
 *                     or whether or not to show the toolbar that might have to be restored if
 *                     we're calling this while the switcher is already visible.
 */
private void createStackTabs(boolean restoreState) {
    final int count = mTabModel.getCount();
    if (count == 0) {
        cleanupTabs();
    } else {
        StackTab[] oldTabs = mStackTabs;
        mStackTabs = new StackTab[count];

        final boolean isIncognito = mTabModel.isIncognito();
        final boolean needTitle = !mLayout.isHiding();
        for (int i = 0; i < count; ++i) {
            Tab tab = mTabModel.getTabAt(i);
            int tabId = tab != null ? tab.getId() : Tab.INVALID_TAB_ID;
            mStackTabs[i] = findTabById(oldTabs, tabId);

            float maxContentWidth = -1.f;
            float maxContentHeight = -1.f;

            if (mStackTabs[i] != null && mStackTabs[i].getLayoutTab() != null && restoreState) {
                maxContentWidth = mStackTabs[i].getLayoutTab().getMaxContentWidth();
                maxContentHeight = mStackTabs[i].getLayoutTab().getMaxContentHeight();
            }

            LayoutTab layoutTab = mLayout.createLayoutTab(tabId, isIncognito,
                    Layout.SHOW_CLOSE_BUTTON, needTitle, maxContentWidth, maxContentHeight);
            layoutTab.setInsetBorderVertical(true);
            layoutTab.setShowToolbar(true);
            layoutTab.setToolbarAlpha(0.f);
            layoutTab.setAnonymizeToolbar(!mIsStackForCurrentTabModel
                    || mTabModel.index() != i);

            if (mStackTabs[i] == null) {
                mStackTabs[i] = new StackTab(layoutTab);
            } else {
                mStackTabs[i].setLayoutTab(layoutTab);
            }

            mStackTabs[i].setNewIndex(i);
            // The initial enterStack animation will take care of
            // positioning, scaling, etc.
        }
    }
}
 
Example 3
Source File: Stack.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Creates the {@link StackTab}s needed for display and populates {@link #mStackTabs}.
 * It is called from show() at the beginning of every new draw phase. It tries to reuse old
 * {@link StackTab} instead of creating new ones every time.
 * @param restoreState Whether or not to restore the {@link LayoutTab} state when we rebuild the
 *                     {@link StackTab}s.  There are some properties like maximum content size
 *                     or whether or not to show the toolbar that might have to be restored if
 *                     we're calling this while the switcher is already visible.
 */
private void createStackTabs(boolean restoreState) {
    final int count = mTabModel.getCount();
    if (count == 0) {
        cleanupTabs();
    } else {
        StackTab[] oldTabs = mStackTabs;
        mStackTabs = new StackTab[count];

        final boolean isIncognito = mTabModel.isIncognito();
        final boolean needTitle = !mLayout.isHiding();
        for (int i = 0; i < count; ++i) {
            Tab tab = mTabModel.getTabAt(i);
            int tabId = tab != null ? tab.getId() : Tab.INVALID_TAB_ID;
            mStackTabs[i] = findTabById(oldTabs, tabId);

            float maxContentWidth = -1.f;
            float maxContentHeight = -1.f;

            if (mStackTabs[i] != null && mStackTabs[i].getLayoutTab() != null && restoreState) {
                maxContentWidth = mStackTabs[i].getLayoutTab().getMaxContentWidth();
                maxContentHeight = mStackTabs[i].getLayoutTab().getMaxContentHeight();
            }

            LayoutTab layoutTab = mLayout.createLayoutTab(tabId, isIncognito,
                    Layout.SHOW_CLOSE_BUTTON, needTitle, maxContentWidth, maxContentHeight);
            layoutTab.setInsetBorderVertical(true);
            layoutTab.setShowToolbar(!FeatureUtilities.isChromeHomeEnabled());
            layoutTab.setToolbarAlpha(0.f);
            layoutTab.setAnonymizeToolbar(!mIsStackForCurrentTabModel
                    || mTabModel.index() != i);

            if (mStackTabs[i] == null) {
                mStackTabs[i] = new StackTab(layoutTab);
            } else {
                mStackTabs[i].setLayoutTab(layoutTab);
            }

            mStackTabs[i].setNewIndex(i);
            // The initial enterStack animation will take care of
            // positioning, scaling, etc.
        }
    }
}