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

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

Issue 756983002: [android_webview] Correctly handle ContextWrapper in AwContents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 95ecedc80bba7536588bef4d30ba7c2457a981a3..10542092a70c7bfd95c4496526888c29c9578fd9 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;
@@ -230,7 +228,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;
}
@@ -367,16 +365,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