Search in sources :

Example 1 with Session

use of org.mozilla.rocket.tabs.Session in project Rocket by mozilla-tw.

the class PrivateWebContextMenu method openInNewTab.

private static void openInNewTab(final TabView source, final Dialog dialog, final String url) {
    final SessionManager session = TabsSessionProvider.getOrThrow(dialog.getOwnerActivity());
    final List<Session> tabs = session.getTabs();
    String parentId = null;
    // Try to find parent tab for new tab
    for (final Session tab : tabs) {
        if (tab.getEngineSession().getTabView() == source) {
            parentId = tab.getId();
            break;
        }
    }
    Bundle args = TabUtil.argument(parentId, false, false);
    args.putInt(BrowserFragment.EXTRA_NEW_TAB_SRC, BrowserFragment.SRC_CONTEXT_MENU);
    session.addTab(url, args);
    TelemetryWrapper.addNewTabFromContextMenu();
}
Also used : SessionManager(org.mozilla.rocket.tabs.SessionManager) Bundle(android.os.Bundle) Session(org.mozilla.rocket.tabs.Session)

Example 2 with Session

use of org.mozilla.rocket.tabs.Session in project Rocket by mozilla-tw.

the class WebContextMenu method openInNewTab.

private static void openInNewTab(final TabView source, final Dialog dialog, final String url) {
    final SessionManager session = TabsSessionProvider.getOrThrow(dialog.getOwnerActivity());
    final List<Session> tabs = session.getTabs();
    String parentId = null;
    // Try to find parent tab for new tab
    for (final Session tab : tabs) {
        if (tab.getEngineSession().getTabView() == source) {
            parentId = tab.getId();
            break;
        }
    }
    Bundle args = TabUtil.argument(parentId, false, false);
    args.putInt(BrowserFragment.EXTRA_NEW_TAB_SRC, BrowserFragment.SRC_CONTEXT_MENU);
    session.addTab(url, args);
    TelemetryWrapper.addNewTabFromContextMenu();
}
Also used : SessionManager(org.mozilla.rocket.tabs.SessionManager) Bundle(android.os.Bundle) Session(org.mozilla.rocket.tabs.Session)

Aggregations

Bundle (android.os.Bundle)2 Session (org.mozilla.rocket.tabs.Session)2 SessionManager (org.mozilla.rocket.tabs.SessionManager)2