org.chromium.chrome.browser.tabmodel.AsyncTabParamsManager Java Examples
The following examples show how to use
org.chromium.chrome.browser.tabmodel.AsyncTabParamsManager.
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: TabDelegate.java From delion with Apache License 2.0 | 6 votes |
private Intent createNewTabIntent(AsyncTabCreationParams asyncParams, int parentId) { 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())); intent.setClass(ContextUtils.getApplicationContext(), ChromeLauncherActivity.class); intent.putExtra(IntentHandler.EXTRA_TAB_ID, assignedTabId); intent.putExtra(IntentHandler.EXTRA_OPEN_NEW_INCOGNITO_TAB, mIsIncognito); intent.putExtra(IntentHandler.EXTRA_PARENT_TAB_ID, parentId); 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; }
Example #2
Source File: ActivityDelegate.java From delion with Apache License 2.0 | 6 votes |
/** * Check whether or not the Intent contains an ID for document mode. * @param intent Intent to check. * @return ID for the document that has the given intent as base intent, or * {@link Tab.INVALID_TAB_ID} if it couldn't be retrieved. */ public static int getTabIdFromIntent(Intent intent) { if (intent == null || intent.getData() == null) return Tab.INVALID_TAB_ID; // Avoid AsyncTabCreationParams related flows early returning here. if (AsyncTabParamsManager.hasParamsWithTabToReparent()) { return IntentUtils.safeGetIntExtra( intent, IntentHandler.EXTRA_TAB_ID, Tab.INVALID_TAB_ID); } Uri data = intent.getData(); if (!TextUtils.equals(data.getScheme(), UrlConstants.DOCUMENT_SCHEME)) { return Tab.INVALID_TAB_ID; } try { return Integer.parseInt(data.getHost()); } catch (NumberFormatException e) { return Tab.INVALID_TAB_ID; } }
Example #3
Source File: ActivityDelegate.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * Check whether or not the Intent contains an ID for document mode. * @param intent Intent to check. * @return ID for the document that has the given intent as base intent, or * {@link Tab.INVALID_TAB_ID} if it couldn't be retrieved. */ public static int getTabIdFromIntent(Intent intent) { if (intent == null || intent.getData() == null) return Tab.INVALID_TAB_ID; // Avoid AsyncTabCreationParams related flows early returning here. if (AsyncTabParamsManager.hasParamsWithTabToReparent()) { return IntentUtils.safeGetIntExtra( intent, IntentHandler.EXTRA_TAB_ID, Tab.INVALID_TAB_ID); } Uri data = intent.getData(); if (!TextUtils.equals(data.getScheme(), UrlConstants.DOCUMENT_SCHEME)) { return Tab.INVALID_TAB_ID; } try { return Integer.parseInt(data.getHost()); } catch (NumberFormatException e) { return Tab.INVALID_TAB_ID; } }
Example #4
Source File: ActivityDelegate.java From 365browser with Apache License 2.0 | 6 votes |
/** * Check whether or not the Intent contains an ID for document mode. * @param intent Intent to check. * @return ID for the document that has the given intent as base intent, or * {@link Tab.INVALID_TAB_ID} if it couldn't be retrieved. */ public static int getTabIdFromIntent(Intent intent) { if (intent == null || intent.getData() == null) return Tab.INVALID_TAB_ID; // Avoid AsyncTabCreationParams related flows early returning here. if (AsyncTabParamsManager.hasParamsWithTabToReparent()) { return IntentUtils.safeGetIntExtra( intent, IntentHandler.EXTRA_TAB_ID, Tab.INVALID_TAB_ID); } Uri data = intent.getData(); if (!TextUtils.equals(data.getScheme(), UrlConstants.DOCUMENT_SCHEME)) { return Tab.INVALID_TAB_ID; } try { return Integer.parseInt(data.getHost()); } catch (NumberFormatException e) { return Tab.INVALID_TAB_ID; } }
Example #5
Source File: ChromeActivity.java From delion with Apache License 2.0 | 5 votes |
@Override public void onStart() { if (AsyncTabParamsManager.hasParamsWithTabToReparent()) { mCompositorViewHolder.prepareForTabReparenting(); } super.onStart(); if (mContextReporter != null) mContextReporter.enable(); if (mPartnerBrowserRefreshNeeded) { mPartnerBrowserRefreshNeeded = false; PartnerBrowserCustomizations.initializeAsync(getApplicationContext(), PARTNER_BROWSER_CUSTOMIZATIONS_TIMEOUT_MS); PartnerBrowserCustomizations.setOnInitializeAsyncFinished(new Runnable() { @Override public void run() { if (PartnerBrowserCustomizations.isIncognitoDisabled()) { terminateIncognitoSession(); } } }); } if (mCompositorViewHolder != null) mCompositorViewHolder.onStart(); mSnackbarManager.onStart(); // Explicitly call checkAccessibility() so things are initialized correctly when Chrome has // been re-started after closing due to the last tab being closed when homepage is enabled. // See crbug.com/541546. checkAccessibility(); mScreenWidthDp = getResources().getConfiguration().screenWidthDp; }
Example #6
Source File: ChromeActivity.java From AndroidChromium with Apache License 2.0 | 5 votes |
@Override public void onStart() { if (AsyncTabParamsManager.hasParamsWithTabToReparent()) { mCompositorViewHolder.prepareForTabReparenting(); } super.onStart(); if (mContextReporter != null) mContextReporter.enable(); if (mPartnerBrowserRefreshNeeded) { mPartnerBrowserRefreshNeeded = false; PartnerBrowserCustomizations.initializeAsync(getApplicationContext(), PARTNER_BROWSER_CUSTOMIZATIONS_TIMEOUT_MS); PartnerBrowserCustomizations.setOnInitializeAsyncFinished(new Runnable() { @Override public void run() { if (PartnerBrowserCustomizations.isIncognitoDisabled()) { terminateIncognitoSession(); } } }); } if (mCompositorViewHolder != null) mCompositorViewHolder.onStart(); mSnackbarManager.onStart(); // Explicitly call checkAccessibility() so things are initialized correctly when Chrome has // been re-started after closing due to the last tab being closed when homepage is enabled. // See crbug.com/541546. checkAccessibility(); mScreenWidthDp = getResources().getConfiguration().screenWidthDp; }
Example #7
Source File: ChromeActivity.java From 365browser with Apache License 2.0 | 5 votes |
@Override public void onStart() { if (AsyncTabParamsManager.hasParamsWithTabToReparent()) { mCompositorViewHolder.prepareForTabReparenting(); } super.onStart(); if (mContextReporter != null) mContextReporter.enable(); if (mPartnerBrowserRefreshNeeded) { mPartnerBrowserRefreshNeeded = false; PartnerBrowserCustomizations.initializeAsync(getApplicationContext(), PARTNER_BROWSER_CUSTOMIZATIONS_TIMEOUT_MS); PartnerBrowserCustomizations.setOnInitializeAsyncFinished(new Runnable() { @Override public void run() { if (PartnerBrowserCustomizations.isIncognitoDisabled()) { terminateIncognitoSession(); } } }); } if (mCompositorViewHolder != null) mCompositorViewHolder.onStart(); mSnackbarManager.onStart(); // Explicitly call checkAccessibility() so things are initialized correctly when Chrome has // been re-started after closing due to the last tab being closed when homepage is enabled. // See crbug.com/541546. checkAccessibility(); mUiMode = getResources().getConfiguration().uiMode; mScreenWidthDp = getResources().getConfiguration().screenWidthDp; }
Example #8
Source File: TabDelegate.java From AndroidChromium with Apache License 2.0 | 4 votes |
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; }
Example #9
Source File: TabDelegate.java From 365browser with Apache License 2.0 | 4 votes |
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; }