Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1924)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentVideoView.java

Issue 2154883003: Make ContentVideoView progress view visible in WebView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Take into account whether Spitzer is enabled Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698