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


Java TabReparentingParams类代码示例

本文整理汇总了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);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:31,代码来源:Tab.java

示例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);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:45,代码来源:Tab.java

示例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;
}
 
开发者ID:JackyAndroid,项目名称:AndroidChromium,代码行数:53,代码来源:Tab.java

示例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);
    }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:45,代码来源:Tab.java


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