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

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

Issue 778183002: [android_webview] Correctly handle ContextWrapper in AwContents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2214
Patch Set: Created 6 years 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 40439888c787ba13f76cd1b42140cde337c1b904..b2d6e0a4f987f2f405e9ad230b7967f7afaf6fe7 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
@@ -4,10 +4,8 @@
package org.chromium.content.browser;
-import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
-import android.content.ContextWrapper;
import android.content.DialogInterface;
import android.graphics.Point;
import android.provider.Settings;
@@ -231,7 +229,7 @@ public class ContentVideoView extends FrameLayout
mCurrentState = STATE_ERROR;
- if (!isActivityContext(getContext())) {
+ if (ContentViewCore.activityFromContext(getContext()) == null) {
Log.w(TAG, "Unable to show alert dialog because it requires an activity context");
return;
}
@@ -424,16 +422,6 @@ public class ContentVideoView extends FrameLayout
return videoView;
}
- private static boolean isActivityContext(Context context) {
- // Only retrieve the base context if the supplied context is a ContextWrapper but not
- // an Activity, given that Activity is already a subclass of ContextWrapper.
- if (context instanceof ContextWrapper && !(context instanceof Activity)) {
- context = ((ContextWrapper) context).getBaseContext();
- return isActivityContext(context);
- }
- return context instanceof Activity;
- }
-
public void removeSurfaceView() {
removeView(mVideoSurfaceView);
removeView(mProgressView);

Powered by Google App Engine
This is Rietveld 408576698