当前位置: 首页>>代码示例>>Java>>正文


Java ServiceTabLauncher类代码示例

本文整理汇总了Java中org.chromium.chrome.browser.ServiceTabLauncher的典型用法代码示例。如果您正苦于以下问题:Java ServiceTabLauncher类的具体用法?Java ServiceTabLauncher怎么用?Java ServiceTabLauncher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ServiceTabLauncher类属于org.chromium.chrome.browser包,在下文中一共展示了ServiceTabLauncher类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createNewTabIntent

import org.chromium.chrome.browser.ServiceTabLauncher; //导入依赖的package包/类
private Intent createNewTabIntent(
        AsyncTabCreationParams asyncParams, int parentId, boolean isChromeUI) {
    int assignedTabId = TabIdManager.getInstance().generateValidId(Tab.INVALID_TAB_ID);
    AsyncTabParamsManager.add(assignedTabId, asyncParams);

    Intent intent = new Intent(
            Intent.ACTION_VIEW, Uri.parse(asyncParams.getLoadUrlParams().getUrl()));

    ComponentName componentName = asyncParams.getComponentName();
    if (componentName == null) {
        intent.setClass(ContextUtils.getApplicationContext(), ChromeLauncherActivity.class);
    } else {
        intent.setComponent(componentName);
    }

    Map<String, String> extraHeaders = asyncParams.getLoadUrlParams().getExtraHeaders();
    if (extraHeaders != null && !extraHeaders.isEmpty()) {
        Bundle bundle = new Bundle();
        for (Map.Entry<String, String> header : extraHeaders.entrySet()) {
            bundle.putString(header.getKey(), header.getValue());
        }
        intent.putExtra(Browser.EXTRA_HEADERS, bundle);
    }

    intent.putExtra(IntentHandler.EXTRA_TAB_ID, assignedTabId);
    intent.putExtra(IntentHandler.EXTRA_OPEN_NEW_INCOGNITO_TAB, mIsIncognito);
    intent.putExtra(IntentHandler.EXTRA_PARENT_TAB_ID, parentId);

    if (isChromeUI) {
        intent.putExtra(Browser.EXTRA_APPLICATION_ID,
                ContextUtils.getApplicationContext().getPackageName());
        intent.putExtra(Browser.EXTRA_CREATE_NEW_TAB, true);
    }

    Activity parentActivity = ActivityDelegate.getActivityForTabId(parentId);
    if (parentActivity != null && parentActivity.getIntent() != null) {
        intent.putExtra(IntentHandler.EXTRA_PARENT_INTENT, parentActivity.getIntent());
    }

    if (asyncParams.getRequestId() != null) {
        intent.putExtra(ServiceTabLauncher.LAUNCH_REQUEST_ID_EXTRA,
                asyncParams.getRequestId().intValue());
    }

    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return intent;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:48,代码来源:TabDelegate.java

示例2: createNewTabIntent

import org.chromium.chrome.browser.ServiceTabLauncher; //导入依赖的package包/类
private Intent createNewTabIntent(
        AsyncTabCreationParams asyncParams, int parentId, boolean isChromeUI) {
    int assignedTabId = TabIdManager.getInstance().generateValidId(Tab.INVALID_TAB_ID);
    AsyncTabParamsManager.add(assignedTabId, asyncParams);

    Intent intent = new Intent(
            Intent.ACTION_VIEW, Uri.parse(asyncParams.getLoadUrlParams().getUrl()));

    ComponentName componentName = asyncParams.getComponentName();
    if (componentName == null) {
        intent.setClass(ContextUtils.getApplicationContext(), ChromeLauncherActivity.class);
    } else {
        intent.setComponent(componentName);
    }

    Map<String, String> extraHeaders = asyncParams.getLoadUrlParams().getExtraHeaders();
    if (extraHeaders != null && !extraHeaders.isEmpty()) {
        Bundle bundle = new Bundle();
        for (Map.Entry<String, String> header : extraHeaders.entrySet()) {
            bundle.putString(header.getKey(), header.getValue());
        }
        intent.putExtra(Browser.EXTRA_HEADERS, bundle);
    }

    intent.putExtra(IntentHandler.EXTRA_TAB_ID, assignedTabId);
    intent.putExtra(IntentHandler.EXTRA_OPEN_NEW_INCOGNITO_TAB, mIsIncognito);
    intent.putExtra(IntentHandler.EXTRA_PARENT_TAB_ID, parentId);

    if (mIsIncognito || isChromeUI) {
        intent.putExtra(Browser.EXTRA_APPLICATION_ID,
                ContextUtils.getApplicationContext().getPackageName());
    }

    if (isChromeUI) intent.putExtra(Browser.EXTRA_CREATE_NEW_TAB, true);

    Activity parentActivity = ActivityDelegate.getActivityForTabId(parentId);
    if (parentActivity != null && parentActivity.getIntent() != null) {
        intent.putExtra(IntentHandler.EXTRA_PARENT_INTENT, parentActivity.getIntent());
    }

    if (asyncParams.getRequestId() != null) {
        intent.putExtra(ServiceTabLauncher.LAUNCH_REQUEST_ID_EXTRA,
                asyncParams.getRequestId().intValue());
    }

    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return intent;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:49,代码来源:TabDelegate.java


注:本文中的org.chromium.chrome.browser.ServiceTabLauncher类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。