本文整理匯總了Java中org.chromium.chrome.browser.tabmodel.TabReparentingParams類的典型用法代碼示例。如果您正苦於以下問題:Java TabReparentingParams類的具體用法?Java TabReparentingParams怎麽用?Java TabReparentingParams使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TabReparentingParams類屬於org.chromium.chrome.browser.tabmodel包,在下文中一共展示了TabReparentingParams類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: detach
import org.chromium.chrome.browser.tabmodel.TabReparentingParams; //導入依賴的package包/類
/**
* Detaches a tab from its current activity if any.
*
* In details, this function:
* - Tags the tab using mIsDetached.
* - Registers some information for later reparenting in {@link AsyncTabParamsManager}.
* - Removes the tab from its current {@link TabModelSelector}, effectively severing
* the {@link Activity} to {@link Tab} link.
*
* @param intent to be stored within a {@link TabReparentingParams}
* @param finalizeCallback to be stored within a {@link TabReparentingParams}
*/
private void detach(Intent intent, Runnable finalizeCallback) {
mIsDetached = true;
// Add the tab to AsyncTabParamsManager before removing it from the current model to
// ensure the global count of tabs is correct. See crbug.com/611806.
if (intent == null) intent = new Intent();
intent.putExtra(IntentHandler.EXTRA_TAB_ID, mId);
AsyncTabParamsManager.add(mId, new TabReparentingParams(this, intent, finalizeCallback));
TabModelSelector tabModelSelector = getTabModelSelector();
if (tabModelSelector != null) {
tabModelSelector.getModel(mIncognito).removeTab(this);
}
// TODO(yusufo): We can't call updateWindowAndroid here and set mWindowAndroid to null
// because many code paths (including navigation) expect the tab to always be associated
// with an activity, and will crash. crbug.com/657007
if (mContentViewCore != null) mContentViewCore.updateWindowAndroid(null);
attachTabContentManager(null);
}
示例2: attachAndFinishReparenting
import org.chromium.chrome.browser.tabmodel.TabReparentingParams; //導入依賴的package包/類
/**
* Finishes the tab reparenting process. Attaches the tab to the new activity, and updates the
* tab and related objects to reference the new activity. This updates many delegates inside the
* tab and {@link ContentViewCore} both on java and native sides.
*
* @param activity The new activity this tab should be associated with.
* @param tabDelegateFactory The new delegate factory this tab should be using.
* @Param reparentingParams The TabReparentingParams associated with this reparenting process.
*/
public void attachAndFinishReparenting(ChromeActivity activity,
TabDelegateFactory tabDelegateFactory, TabReparentingParams reparentingParams) {
// TODO(yusufo): Share these calls with the construction related calls.
// crbug.com/590281
updateWindowAndroid(activity.getWindowAndroid());
// Update for the controllers that need the Compositor from the new Activity.
attachTabContentManager(activity.getTabContentManager());
mFullscreenManager = activity.getFullscreenManager();
activity.getCompositorViewHolder().prepareForTabReparenting();
// Update the delegate factory, then recreate and propagate all delegates.
mDelegateFactory = tabDelegateFactory;
mWebContentsDelegate = mDelegateFactory.createWebContentsDelegate(this);
nativeUpdateDelegates(mNativeTabAndroid,
mWebContentsDelegate, mDelegateFactory.createContextMenuPopulator(this));
mBrowserControlsVisibilityDelegate =
mDelegateFactory.createBrowserControlsVisibilityDelegate(this);
setInterceptNavigationDelegate(mDelegateFactory.createInterceptNavigationDelegate(this));
getAppBannerManager().setIsEnabledForTab(mDelegateFactory.canShowAppBanners(this));
reparentingParams.finalizeTabReparenting();
mIsDetachedForReparenting = false;
// Reload the NativePage (if any), since the old NativePage has a reference to the old
// activity.
maybeShowNativePage(getUrl(), true);
mIsTabStateDirty = true;
for (TabObserver observer : mObservers) {
observer.onReparentingFinished(this);
}
}
示例3: detachAndStartReparenting
import org.chromium.chrome.browser.tabmodel.TabReparentingParams; //導入依賴的package包/類
/**
* Begins the tab reparenting process. Detaches the tab from its current activity and fires
* an Intent to reparent the tab into its new host activity.
*
* @param intent An optional intent with the desired component, flags, or extras to use when
* launching the new host activity. This intent's URI and action will be
* overriden. This may be null if no intent customization is needed.
* @param startActivityOptions Options to pass to {@link Activity#startActivity(Intent, Bundle)}
* @param finalizeCallback A callback that will be called after the tab is attached to the new
* host activity in {@link #attachAndFinishReparenting}.
* @return Whether reparenting succeeded. If false, the tab was not removed and the intent was
* not fired.
*/
public boolean detachAndStartReparenting(Intent intent, Bundle startActivityOptions,
Runnable finalizeCallback) {
ChromeActivity activity = getActivity();
if (activity == null) return false;
if (intent == null) intent = new Intent();
if (intent.getComponent() == null) {
intent.setClass(mThemedApplicationContext, ChromeLauncherActivity.class);
}
intent.setAction(Intent.ACTION_VIEW);
if (TextUtils.isEmpty(intent.getDataString())) intent.setData(Uri.parse(getUrl()));
if (isIncognito()) {
intent.putExtra(IntentHandler.EXTRA_OPEN_NEW_INCOGNITO_TAB, true);
}
IntentHandler.addTrustedIntentExtras(intent, activity);
if (ChromeFeatureList.isEnabled(ChromeFeatureList.TAB_REPARENTING)) {
TabModelSelector tabModelSelector = getTabModelSelector();
if (tabModelSelector == null) return false;
mIsDetachedForReparenting = true;
// Add the tab to AsyncTabParamsManager before removing it from the current model to
// ensure the global count of tabs is correct. See crbug.com/611806.
intent.putExtra(IntentHandler.EXTRA_TAB_ID, mId);
AsyncTabParamsManager.add(mId,
new TabReparentingParams(this, intent, finalizeCallback));
tabModelSelector.getModel(mIncognito).removeTab(this);
// TODO(yusufo): We can't call updateWindowAndroid here and set mWindowAndroid to null
// because many code paths (including navigation) expect the tab to always be associated
// with an activity, and will crash. crbug.com/657007
if (mContentViewCore != null) mContentViewCore.updateWindowAndroid(null);
attachTabContentManager(null);
}
activity.startActivity(intent, startActivityOptions);
return true;
}
示例4: attachAndFinishReparenting
import org.chromium.chrome.browser.tabmodel.TabReparentingParams; //導入依賴的package包/類
/**
* Finishes the tab reparenting process. Attaches the tab to the new activity, and updates the
* tab and related objects to reference the new activity. This updates many delegates inside the
* tab and {@link ContentViewCore} both on java and native sides.
*
* @param activity The new activity this tab should be associated with.
* @param tabDelegateFactory The new delegate factory this tab should be using.
* @Param reparentingParams The TabReparentingParams associated with this reparenting process.
*/
public void attachAndFinishReparenting(ChromeActivity activity,
TabDelegateFactory tabDelegateFactory, TabReparentingParams reparentingParams) {
// TODO(yusufo): Share these calls with the construction related calls.
// crbug.com/590281
updateWindowAndroid(activity.getWindowAndroid());
// Update for the controllers that need the Compositor from the new Activity.
attachTabContentManager(activity.getTabContentManager());
mFullscreenManager = activity.getFullscreenManager();
activity.getCompositorViewHolder().prepareForTabReparenting();
// Update the delegate factory, then recreate and propagate all delegates.
mDelegateFactory = tabDelegateFactory;
mWebContentsDelegate = mDelegateFactory.createWebContentsDelegate(this);
nativeUpdateDelegates(mNativeTabAndroid,
mWebContentsDelegate, mDelegateFactory.createContextMenuPopulator(this));
mBrowserControlsVisibilityDelegate =
mDelegateFactory.createBrowserControlsVisibilityDelegate(this);
setInterceptNavigationDelegate(mDelegateFactory.createInterceptNavigationDelegate(this));
getAppBannerManager().setIsEnabledForTab(mDelegateFactory.canShowAppBanners(this));
reparentingParams.finalizeTabReparenting();
mIsDetached = false;
nativeAttachDetachedTab(mNativeTabAndroid);
// Reload the NativePage (if any), since the old NativePage has a reference to the old
// activity.
maybeShowNativePage(getUrl(), true);
mIsTabStateDirty = true;
for (TabObserver observer : mObservers) {
observer.onReparentingFinished(this);
}
}