Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java |
| index 970648e520909234019d3b330707751db92bb8f1..4e3c6e12cb390d4727dd3bbb03cc0ff0f9623db3 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java |
| @@ -19,7 +19,6 @@ import android.provider.Browser; |
| import android.support.annotation.Nullable; |
| import android.support.v4.view.ViewCompat; |
| import android.text.TextUtils; |
| -import android.util.Log; |
| import android.view.ContextThemeWrapper; |
| import android.view.View; |
| import android.view.View.OnClickListener; |
| @@ -31,6 +30,7 @@ import android.widget.FrameLayout.LayoutParams; |
| import org.chromium.base.ApiCompatibilityUtils; |
| import org.chromium.base.ApplicationStatus; |
| import org.chromium.base.ContextUtils; |
| +import org.chromium.base.Log; |
| import org.chromium.base.ObserverList; |
| import org.chromium.base.ObserverList.RewindableIterator; |
| import org.chromium.base.TraceEvent; |
| @@ -346,6 +346,7 @@ public class Tab |
| * {@link WindowAndroid} for reparenting to a new activity. |
| */ |
| private boolean mIsDetachedForReparenting; |
| + private Boolean mIsPendingFullscreen; |
| /** |
| * The UMA object used to report stats for this tab. Note that this may be null under certain |
| @@ -1342,6 +1343,16 @@ public class Tab |
| } |
| /** |
| + * Begins the tab reparenting process, see |
| + * {@link detachAndStartReparenting(Intent, Bundle, Runnable, Boolean). |
| + */ |
| + public boolean detachAndStartReparenting( |
| + Intent intent, Bundle startActivityOptions, Runnable finalizeCallback) { |
| + return detachAndStartReparenting( |
| + intent, startActivityOptions, finalizeCallback, null /* pendingFullscreen */); |
| + } |
| + |
| + /** |
| * 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. |
| * |
| @@ -1351,11 +1362,13 @@ public class Tab |
| * @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}. |
| + * @param pendingFullscreen What state fullscreen should be toggled to after finishing |
| + * reparenting, or null if it should be left untouched. |
| * @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) { |
| + Runnable finalizeCallback, @Nullable Boolean pendingFullscreen) { |
| ChromeActivity activity = getActivity(); |
| if (activity == null) return false; |
| @@ -1376,6 +1389,11 @@ public class Tab |
| TabModelSelector tabModelSelector = getTabModelSelector(); |
| if (tabModelSelector == null) return false; |
| mIsDetachedForReparenting = true; |
| + mIsPendingFullscreen = pendingFullscreen; |
| + |
| + if (getFullscreenManager().getTab() == this) { |
| + getFullscreenManager().setTab(null); |
| + } |
| // 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. |
| @@ -1439,6 +1457,12 @@ public class Tab |
| for (TabObserver observer : mObservers) { |
| observer.onReparentingFinished(this); |
| } |
| + |
| + if (mIsPendingFullscreen != null) { |
|
Yusuf
2017/04/10 17:08:49
see the finalizeCallback in detach.. That is a run
PEConn
2017/04/11 00:54:46
Done.
|
| + mFullscreenManager.setTab(mIsPendingFullscreen ? this : null); |
| + toggleFullscreenMode(mIsPendingFullscreen); |
| + } |
| + mIsPendingFullscreen = null; |
| } |
| /** |