Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 48592a3d authored by Teng-Hui Zhu's avatar Teng-Hui Zhu Committed by Android (Google) Code Review
Browse files

Merge "Support javascript to exit full screen video."

parents 792840d4 d7678a16
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -162,6 +162,16 @@ class HTML5VideoViewProxy extends Handler
                mHTML5VideoView.enterFullScreenVideoState(layerId, proxy, webView);
        }

        public static void exitFullScreenVideo(HTML5VideoViewProxy proxy,
                WebView webView) {
            if (!mHTML5VideoView.fullScreenExited() && mHTML5VideoView.isFullScreenMode()) {
                WebChromeClient client = webView.getWebChromeClient();
                if (client != null) {
                    client.onHideCustomView();
                }
            }
        }

        // This is on the UI thread.
        // When native tell Java to play, we need to check whether or not it is
        // still the same video by using videoLayerId and treat it differently.
@@ -682,6 +692,10 @@ class HTML5VideoViewProxy extends Handler
        VideoPlayer.enterFullScreenVideo(layerId, url, this, mWebView);
    }

    public void exitFullScreenVideo() {
        VideoPlayer.exitFullScreenVideo(this, mWebView);
    }

    /**
     * The factory for HTML5VideoViewProxy instances.
     * @param webViewCore is the WebViewCore that is requesting the proxy.
+7 −0
Original line number Diff line number Diff line
@@ -797,6 +797,7 @@ public class WebView extends AbsoluteLayout
    static final int ENTER_FULLSCREEN_VIDEO             = 137;
    static final int UPDATE_SELECTION                   = 138;
    static final int UPDATE_ZOOM_DENSITY                = 139;
    static final int EXIT_FULLSCREEN_VIDEO              = 140;

    private static final int FIRST_PACKAGE_MSG_ID = SCROLL_TO_MSG_ID;
    private static final int LAST_PACKAGE_MSG_ID = HIT_TEST_RESULT;
@@ -8772,6 +8773,12 @@ public class WebView extends AbsoluteLayout
                    }
                    break;

                case EXIT_FULLSCREEN_VIDEO:
                    if (mHTML5VideoViewProxy != null) {
                        mHTML5VideoViewProxy.exitFullScreenVideo();
                    }
                    break;

                case SHOW_FULLSCREEN: {
                    View view = (View) msg.obj;
                    int orientation = msg.arg1;
+11 −0
Original line number Diff line number Diff line
@@ -503,6 +503,17 @@ public final class WebViewCore {
        message.sendToTarget();
    }

    /**
     * Notify the webview that we want to exit the video fullscreen.
     * This is called through JNI by webcore.
     */
    protected void exitFullscreenVideo() {
        if (mWebView == null) return;
        Message message = Message.obtain(mWebView.mPrivateHandler,
                       WebView.EXIT_FULLSCREEN_VIDEO);
        message.sendToTarget();
    }

    /**
     * Clear the picture set. To be called only on the WebCore thread.
     */