本文整理汇总了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;
}
示例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;
}