Java Code Examples for org.chromium.chrome.browser.ChromeApplication#getDocumentTabModelSelector()

The following examples show how to use org.chromium.chrome.browser.ChromeApplication#getDocumentTabModelSelector() . 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 init(TabModelSelector selector, TabCreatorManager creator,
        TabContentManager content, ViewGroup androidContentContainer,
        ContextualSearchManagementDelegate contextualSearchDelegate,
        ReaderModeManagerDelegate readerModeManagerDelegate,
        DynamicResourceLoader dynamicResourceLoader) {
    super.init(selector, creator, content, androidContentContainer, contextualSearchDelegate,
            readerModeManagerDelegate, dynamicResourceLoader);

    mTitleCache = mHost.getTitleCache();
    TabModelSelector documentTabSelector = ChromeApplication.getDocumentTabModelSelector();
    mOverviewListLayout.setTabModelSelector(documentTabSelector, content);
    mOverviewLayout.setTabModelSelector(documentTabSelector, content);

    // TODO(changwan): do we really need this?
    startShowing(getDefaultLayout(), false);
}
 
Example 2
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 3
Source File: LayoutManagerDocument.java    From delion with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void changeTabs() {
    DocumentTabModelSelector selector =
            ChromeApplication.getDocumentTabModelSelector();
    TabModel tabModel = selector.getCurrentModel();
    int currentIndex = tabModel.index();
    if (mLastScroll == ScrollDirection.LEFT) {
        if (currentIndex < tabModel.getCount() - 1) {
            TabModelUtils.setIndex(tabModel, currentIndex + 1);
        }
    } else {
        if (currentIndex > 0) {
            TabModelUtils.setIndex(tabModel, currentIndex - 1);
        }
    }
}
 
Example 4
Source File: LayoutManagerDocument.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void changeTabs() {
    DocumentTabModelSelector selector =
            ChromeApplication.getDocumentTabModelSelector();
    TabModel tabModel = selector.getCurrentModel();
    int currentIndex = tabModel.index();
    if (mLastScroll == ScrollDirection.LEFT) {
        if (currentIndex < tabModel.getCount() - 1) {
            TabModelUtils.setIndex(tabModel, currentIndex + 1);
        }
    } else {
        if (currentIndex > 0) {
            TabModelUtils.setIndex(tabModel, currentIndex - 1);
        }
    }
}
 
Example 5
Source File: LayoutManagerDocument.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void changeTabs() {
    DocumentTabModelSelector selector =
            ChromeApplication.getDocumentTabModelSelector();
    TabModel tabModel = selector.getCurrentModel();
    int currentIndex = tabModel.index();
    if (mLastScroll == ScrollDirection.LEFT) {
        if (currentIndex < tabModel.getCount() - 1) {
            TabModelUtils.setIndex(tabModel, currentIndex + 1);
        }
    } else {
        if (currentIndex > 0) {
            TabModelUtils.setIndex(tabModel, currentIndex - 1);
        }
    }
}