org.chromium.chrome.browser.ntp.ForeignSessionHelper.ForeignSessionTab Java Examples

The following examples show how to use org.chromium.chrome.browser.ntp.ForeignSessionHelper.ForeignSessionTab. 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: RecentTabsRowAdapter.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private void openAllTabs() {
    ForeignSessionTab firstTab = null;
    for (ForeignSessionWindow window : mForeignSession.windows) {
        for (ForeignSessionTab tab : window.tabs) {
            if (firstTab == null) {
                firstTab = tab;
            } else {
                mRecentTabsManager.openForeignSessionTab(
                        mForeignSession, tab, WindowOpenDisposition.NEW_BACKGROUND_TAB);
            }
        }
    }
    // Open the first tab last because calls to openForeignSessionTab after one for
    // CURRENT_TAB are ignored.
    if (firstTab != null) {
        mRecentTabsManager.openForeignSessionTab(
                mForeignSession, firstTab, WindowOpenDisposition.CURRENT_TAB);
    }
}
 
Example #2
Source File: RecentTabsRowAdapter.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreateContextMenuForChild(int childPosition, ContextMenu menu,
        Activity activity) {
    final ForeignSessionTab foreignSessionTab = getChild(childPosition);
    OnMenuItemClickListener listener = new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            mRecentTabsManager.openForeignSessionTab(mForeignSession, foreignSessionTab,
                    WindowOpenDisposition.NEW_BACKGROUND_TAB);
            return true;
        }
    };
    menu.add(R.string.contextmenu_open_in_new_tab).setOnMenuItemClickListener(listener);
}
 
Example #3
Source File: RecentTabsRowAdapter.java    From delion with Apache License 2.0 6 votes vote down vote up
private void openAllTabs() {
    ForeignSessionTab firstTab = null;
    for (ForeignSessionWindow window : mForeignSession.windows) {
        for (ForeignSessionTab tab : window.tabs) {
            if (firstTab == null) {
                firstTab = tab;
            } else {
                mRecentTabsManager.openForeignSessionTab(
                        mForeignSession, tab, WindowOpenDisposition.NEW_BACKGROUND_TAB);
            }
        }
    }
    // Open the first tab last because calls to openForeignSessionTab after one for
    // CURRENT_TAB are ignored.
    if (firstTab != null) {
        mRecentTabsManager.openForeignSessionTab(
                mForeignSession, firstTab, WindowOpenDisposition.CURRENT_TAB);
    }
}
 
Example #4
Source File: RecentTabsRowAdapter.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private void openAllTabs() {
    ForeignSessionTab firstTab = null;
    for (ForeignSessionWindow window : mForeignSession.windows) {
        for (ForeignSessionTab tab : window.tabs) {
            if (firstTab == null) {
                firstTab = tab;
            } else {
                mRecentTabsManager.openForeignSessionTab(
                        mForeignSession, tab, WindowOpenDisposition.NEW_BACKGROUND_TAB);
            }
        }
    }
    // Open the first tab last because calls to openForeignSessionTab after one for
    // CURRENT_TAB are ignored.
    if (firstTab != null) {
        mRecentTabsManager.openForeignSessionTab(
                mForeignSession, firstTab, WindowOpenDisposition.CURRENT_TAB);
    }
}
 
Example #5
Source File: RecentTabsRowAdapter.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onChildClick(int childPosition) {
    RecordHistogram.recordEnumeratedHistogram("HistoryPage.OtherDevicesMenu",
            OtherSessionsActions.LINK_CLICKED, OtherSessionsActions.LIMIT);
    ForeignSessionTab foreignSessionTab = getChild(childPosition);
    mRecentTabsManager.openForeignSessionTab(mForeignSession, foreignSessionTab,
            WindowOpenDisposition.CURRENT_TAB);
    return true;
}
 
Example #6
Source File: RecentTabsRowAdapter.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreateContextMenuForChild(int childPosition, ContextMenu menu,
        Activity activity) {
    final ForeignSessionTab foreignSessionTab = getChild(childPosition);
    OnMenuItemClickListener listener = new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            mRecentTabsManager.openForeignSessionTab(mForeignSession, foreignSessionTab,
                    WindowOpenDisposition.NEW_BACKGROUND_TAB);
            return true;
        }
    };
    menu.add(R.string.contextmenu_open_in_new_tab).setOnMenuItemClickListener(listener);
}
 
Example #7
Source File: RecentTabsRowAdapter.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onChildClick(int childPosition) {
    RecordHistogram.recordEnumeratedHistogram("HistoryPage.OtherDevicesMenu",
            OtherSessionsActions.LINK_CLICKED, OtherSessionsActions.LIMIT);
    ForeignSessionTab foreignSessionTab = getChild(childPosition);
    mRecentTabsManager.openForeignSessionTab(mForeignSession, foreignSessionTab,
            WindowOpenDisposition.CURRENT_TAB);
    return true;
}
 
Example #8
Source File: RecentTabsRowAdapter.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void configureChildView(int childPosition, ViewHolder viewHolder) {
    ForeignSessionTab sessionTab = getChild(childPosition);
    viewHolder.textView.setText(TextUtils.isEmpty(sessionTab.title) ? sessionTab.url
            : sessionTab.title);
    loadSyncedFavicon(viewHolder, sessionTab.url);
}
 
Example #9
Source File: RecentTabsRowAdapter.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public ForeignSessionTab getChild(int childPosition) {
    for (ForeignSessionWindow window : mForeignSession.windows) {
        if (childPosition < window.tabs.size()) {
            return window.tabs.get(childPosition);
        }
        childPosition -= window.tabs.size();
    }
    assert false;
    return null;
}
 
Example #10
Source File: RecentTabsRowAdapter.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreateContextMenuForChild(int childPosition, ContextMenu menu,
        Activity activity) {
    final ForeignSessionTab foreignSessionTab = getChild(childPosition);
    OnMenuItemClickListener listener = new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            mRecentTabsManager.openForeignSessionTab(mForeignSession, foreignSessionTab,
                    WindowOpenDisposition.NEW_BACKGROUND_TAB);
            return true;
        }
    };
    menu.add(R.string.contextmenu_open_in_new_tab).setOnMenuItemClickListener(listener);
}
 
Example #11
Source File: RecentTabsRowAdapter.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void configureChildView(int childPosition, ViewHolder viewHolder) {
    ForeignSessionTab sessionTab = getChild(childPosition);
    viewHolder.textView.setText(TextUtils.isEmpty(sessionTab.title) ? sessionTab.url
            : sessionTab.title);
    loadSyncedFavicon(viewHolder, sessionTab.url);
}
 
Example #12
Source File: RecentTabsRowAdapter.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public ForeignSessionTab getChild(int childPosition) {
    for (ForeignSessionWindow window : mForeignSession.windows) {
        if (childPosition < window.tabs.size()) {
            return window.tabs.get(childPosition);
        }
        childPosition -= window.tabs.size();
    }
    assert false;
    return null;
}
 
Example #13
Source File: RecentTabsRowAdapter.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onChildClick(int childPosition) {
    RecordHistogram.recordEnumeratedHistogram("HistoryPage.OtherDevicesMenu",
            OtherSessionsActions.LINK_CLICKED, OtherSessionsActions.LIMIT);
    ForeignSessionTab foreignSessionTab = getChild(childPosition);
    mRecentTabsManager.openForeignSessionTab(mForeignSession, foreignSessionTab,
            WindowOpenDisposition.CURRENT_TAB);
    return true;
}
 
Example #14
Source File: RecentTabsRowAdapter.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void configureChildView(int childPosition, ViewHolder viewHolder) {
    ForeignSessionTab sessionTab = getChild(childPosition);
    viewHolder.textView.setText(TextUtils.isEmpty(sessionTab.title) ? sessionTab.url
            : sessionTab.title);
    loadSyncedFavicon(viewHolder, sessionTab.url);
}
 
Example #15
Source File: RecentTabsRowAdapter.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public ForeignSessionTab getChild(int childPosition) {
    for (ForeignSessionWindow window : mForeignSession.windows) {
        if (childPosition < window.tabs.size()) {
            return window.tabs.get(childPosition);
        }
        childPosition -= window.tabs.size();
    }
    assert false;
    return null;
}
 
Example #16
Source File: RecentTabsManager.java    From delion with Apache License 2.0 3 votes vote down vote up
/**
 * Opens a new tab navigating to ForeignSessionTab.
 *
 * @param session The foreign session that the tab belongs to.
 * @param tab The tab to open.
 * @param windowDisposition The WindowOpenDisposition flag.
 */
public void openForeignSessionTab(ForeignSession session, ForeignSessionTab tab,
        int windowDisposition) {
    if (mIsDestroyed) return;
    NewTabPageUma.recordAction(NewTabPageUma.ACTION_OPENED_FOREIGN_SESSION);
    mForeignSessionHelper.openForeignSessionTab(mTab, session, tab, windowDisposition);
}
 
Example #17
Source File: RecentTabsManager.java    From 365browser with Apache License 2.0 3 votes vote down vote up
/**
 * Opens a new tab navigating to ForeignSessionTab.
 *
 * @param session The foreign session that the tab belongs to.
 * @param tab The tab to open.
 * @param windowDisposition The WindowOpenDisposition flag.
 */
public void openForeignSessionTab(ForeignSession session, ForeignSessionTab tab,
        int windowDisposition) {
    if (mIsDestroyed) return;
    RecordUserAction.record("MobileRecentTabManagerTabFromOtherDeviceOpened");
    mForeignSessionHelper.openForeignSessionTab(mTab, session, tab, windowDisposition);
}
 
Example #18
Source File: RecentTabsManager.java    From AndroidChromium with Apache License 2.0 3 votes vote down vote up
/**
 * Opens a new tab navigating to ForeignSessionTab.
 *
 * @param session The foreign session that the tab belongs to.
 * @param tab The tab to open.
 * @param windowDisposition The WindowOpenDisposition flag.
 */
public void openForeignSessionTab(ForeignSession session, ForeignSessionTab tab,
        int windowDisposition) {
    if (mIsDestroyed) return;
    NewTabPageUma.recordAction(NewTabPageUma.ACTION_OPENED_FOREIGN_SESSION);
    mForeignSessionHelper.openForeignSessionTab(mTab, session, tab, windowDisposition);
}