Index: chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java |
index 86464d8226568fb9a4eda2c99d3a0d236ae4e133..e9dddfb35b11e8385aa218e3aa251a7448f38498 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java |
@@ -122,6 +122,7 @@ import org.chromium.chrome.browser.webapps.AddToHomescreenDialog; |
import org.chromium.chrome.browser.widget.ControlContainer; |
import org.chromium.content.browser.ContentReadbackHandler; |
import org.chromium.content.browser.ContentReadbackHandler.GetBitmapCallback; |
+import org.chromium.content.browser.ContentVideoView; |
import org.chromium.content.browser.ContentViewCore; |
import org.chromium.content.common.ContentSwitches; |
import org.chromium.content_public.browser.LoadUrlParams; |
@@ -1210,6 +1211,23 @@ public abstract class ChromeActivity extends AsyncInitializationActivity |
} |
/** |
+ * Exits the fullscreen mode, if any. Does nothing if no fullscreen is present. |
+ * @return Whether the fullscreen mode is currently showing. |
+ */ |
+ protected boolean exitFullscreenIfShowing() { |
+ ContentVideoView view = ContentVideoView.getContentVideoView(); |
+ if (view != null && view.getContext() == this) { |
+ view.exitFullscreen(false); |
+ return true; |
+ } |
+ if (getFullscreenManager().getPersistentFullscreenMode()) { |
+ getFullscreenManager().setPersistentFullscreenMode(false); |
+ return true; |
+ } |
+ return false; |
+ } |
+ |
+ /** |
* Initializes the {@link CompositorViewHolder} with the relevant content it needs to properly |
* show content on the screen. |
* @param layoutManager A {@link LayoutManagerDocument} instance. This class is |