| Index: android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java
|
| diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java b/android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java
|
| index a5dd9e17f429790a1392d0b0f214fa6f7ed98c0d..c2614c265f7485f707d166623a6ed8e7a0d8339e 100644
|
| --- a/android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java
|
| +++ b/android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java
|
| @@ -19,10 +19,10 @@ import org.chromium.content.browser.ContentViewClient;
|
| * ContentViewClient implementation for WebView
|
| */
|
| public class AwContentViewClient extends ContentViewClient implements ContentVideoViewClient {
|
| - private AwContentsClient mAwContentsClient;
|
| - private AwSettings mAwSettings;
|
| - private AwContents mAwContents;
|
| - private Context mContext;
|
| + private final AwContentsClient mAwContentsClient;
|
| + private final AwSettings mAwSettings;
|
| + private final AwContents mAwContents;
|
| + private final Context mContext;
|
|
|
| public AwContentViewClient(
|
| AwContentsClient awContentsClient, AwSettings awSettings, AwContents awContents,
|
| @@ -66,26 +66,7 @@ public class AwContentViewClient extends ContentViewClient implements ContentVid
|
| }
|
|
|
| @Override
|
| - public void enterFullscreenVideo(View view) {
|
| - final FrameLayout viewGroup = new FrameLayout(mContext);
|
| - viewGroup.addView(view);
|
| - viewGroup.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
|
| - @Override
|
| - public void onViewDetachedFromWindow(View v) {
|
| - // Intentional no-op (see onDestroyContentVideoView).
|
| - }
|
| -
|
| - @Override
|
| - public void onViewAttachedToWindow(View v) {
|
| - if (mAwContents.isFullScreen()) {
|
| - return;
|
| - }
|
| - View fullscreenView = mAwContents.enterFullScreen();
|
| - if (fullscreenView != null) {
|
| - viewGroup.addView(fullscreenView);
|
| - }
|
| - }
|
| - });
|
| + public void enterFullscreenVideo(View videoView) {
|
| WebChromeClient.CustomViewCallback cb = new WebChromeClient.CustomViewCallback() {
|
| @Override
|
| public void onCustomViewHidden() {
|
| @@ -94,17 +75,54 @@ public class AwContentViewClient extends ContentViewClient implements ContentVid
|
| contentVideoView.exitFullscreen(false);
|
| }
|
| };
|
| - mAwContentsClient.onShowCustomView(viewGroup, cb);
|
| + enterFullscreen(videoView, cb);
|
| }
|
|
|
| @Override
|
| public void exitFullscreenVideo() {
|
| - mAwContents.exitFullScreen();
|
| - mAwContentsClient.onHideCustomView();
|
| + exitFullscreen();
|
| }
|
|
|
| @Override
|
| public View getVideoLoadingProgressView() {
|
| return mAwContentsClient.getVideoLoadingProgressView();
|
| }
|
| +
|
| + @Override
|
| + public void enterFullscreen() {
|
| + WebChromeClient.CustomViewCallback cb = new WebChromeClient.CustomViewCallback() {
|
| + @Override
|
| + public void onCustomViewHidden() {
|
| + mAwContents.requestExitFullscreen();
|
| + }
|
| + };
|
| + enterFullscreen(null, cb);
|
| + }
|
| +
|
| + @Override
|
| + public void exitFullscreen() {
|
| + mAwContents.exitFullScreen();
|
| + mAwContentsClient.onHideCustomView();
|
| + }
|
| +
|
| + private void enterFullscreen(View videoView, WebChromeClient.CustomViewCallback cb) {
|
| + if (mAwContents.isFullScreen()) {
|
| + return;
|
| + }
|
| + View fullscreenView = mAwContents.enterFullScreen();
|
| + if (fullscreenView == null) {
|
| + return;
|
| + }
|
| +
|
| + if (videoView == null) {
|
| + // The fullscreenView contains the non-video element in fullscreen.
|
| + mAwContentsClient.onShowCustomView(fullscreenView, cb);
|
| + } else {
|
| + // The videoView contains the video and the fullscreenView the html5 controls.
|
| + FrameLayout viewGroup = new FrameLayout(mContext);
|
| + viewGroup.addView(videoView);
|
| + viewGroup.addView(fullscreenView);
|
| + mAwContentsClient.onShowCustomView(viewGroup, cb);
|
| + }
|
| + }
|
| }
|
|
|