| Index: content/public/android/java/src/org/chromium/content/browser/ContentVideoView.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentVideoView.java b/content/public/android/java/src/org/chromium/content/browser/ContentVideoView.java
|
| index 089c559fa84c35748384d8d878fe76ae8f571bf3..ff4a74e091911045e9da972f686b1879815f037a 100644
|
| --- a/content/public/android/java/src/org/chromium/content/browser/ContentVideoView.java
|
| +++ b/content/public/android/java/src/org/chromium/content/browser/ContentVideoView.java
|
| @@ -153,7 +153,7 @@ public class ContentVideoView extends FrameLayout
|
| mUmaRecorded = false;
|
| mPossibleAccidentalChange = false;
|
| initResources(context);
|
| - mVideoSurfaceView = new VideoSurfaceView(context);
|
| + if (mEmbedder.needsVideoSurfaceView()) mVideoSurfaceView = new VideoSurfaceView(context);
|
| showContentVideoView();
|
| setVisibility(View.VISIBLE);
|
| }
|
| @@ -177,11 +177,12 @@ public class ContentVideoView extends FrameLayout
|
| }
|
|
|
| private void showContentVideoView() {
|
| - mVideoSurfaceView.getHolder().addCallback(this);
|
| - this.addView(mVideoSurfaceView, new FrameLayout.LayoutParams(
|
| - ViewGroup.LayoutParams.WRAP_CONTENT,
|
| - ViewGroup.LayoutParams.WRAP_CONTENT,
|
| - Gravity.CENTER));
|
| + if (mVideoSurfaceView != null) {
|
| + mVideoSurfaceView.getHolder().addCallback(this);
|
| + this.addView(mVideoSurfaceView,
|
| + new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
|
| + ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER));
|
| + }
|
|
|
| mProgressView = mEmbedder.getVideoLoadingProgressView();
|
| if (mProgressView == null) {
|
| @@ -250,8 +251,11 @@ public class ContentVideoView extends FrameLayout
|
| private void onVideoSizeChanged(int width, int height) {
|
| mVideoWidth = width;
|
| mVideoHeight = height;
|
| - // This will trigger the SurfaceView.onMeasure() call.
|
| - mVideoSurfaceView.getHolder().setFixedSize(mVideoWidth, mVideoHeight);
|
| + if (mVideoSurfaceView != null) {
|
| + // This will trigger the SurfaceView.onMeasure() call.
|
| + mVideoSurfaceView.getHolder().setFixedSize(mVideoWidth, mVideoHeight);
|
| + }
|
| +
|
| if (mUmaRecorded) return;
|
|
|
| mProgressView.setVisibility(View.GONE);
|
| @@ -314,10 +318,14 @@ public class ContentVideoView extends FrameLayout
|
| }
|
|
|
| public void removeSurfaceView() {
|
| - removeView(mVideoSurfaceView);
|
| - removeView(mProgressView);
|
| - mVideoSurfaceView = null;
|
| - mProgressView = null;
|
| + if (mVideoSurfaceView != null) {
|
| + removeView(mVideoSurfaceView);
|
| + mVideoSurfaceView = null;
|
| + }
|
| + if (mProgressView != null) {
|
| + removeView(mProgressView);
|
| + mProgressView = null;
|
| + }
|
| }
|
|
|
| @CalledByNative
|
|
|