Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
index 6df0969e7f63b7aea34bffa68193d68262514912..b2f59d67e6b9341e9f5159048bc8e0a35fc3f231 100644 |
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
@@ -776,6 +776,21 @@ public class ContentViewCore |
hidePopupDialog(); |
resetGestureDetectors(); |
} |
+ |
+ @Override |
+ public void didFinishLoad(long frameId, String validatedUrl, boolean isMainFrame) { |
+ if (isMainFrame) { |
+ setMediaAutoplayEnabled(false); |
+ } |
+ } |
+ |
+ @Override |
+ public void didFailLoad(boolean isProvisionalLoad, |
+ boolean isMainFrame, int errorCode, String description, String failingUrl) { |
+ if (isMainFrame) { |
+ setMediaAutoplayEnabled(false); |
+ } |
+ } |
}; |
sendOrientationChangeEvent(); |
@@ -3157,6 +3172,10 @@ public class ContentViewCore |
} |
} |
+ public void setMediaAutoplayEnabled(boolean isEnabled) { |
+ nativeSetMediaAutoplayEnabled(mNativeContentViewCore, isEnabled); |
+ } |
+ |
private boolean onAnimate(long frameTimeMicros) { |
if (mNativeContentViewCore == 0) return false; |
return nativeOnAnimate(mNativeContentViewCore, frameTimeMicros); |
@@ -3377,6 +3396,9 @@ public class ContentViewCore |
private native void nativeDetachExternalVideoSurface( |
long nativeContentViewCoreImpl, int playerId); |
+ private native void nativeSetMediaAutoplayEnabled(long nativeContentViewCoreImpl, |
+ boolean isEnabled); |
+ |
private native void nativeSetAccessibilityEnabled( |
long nativeContentViewCoreImpl, boolean enabled); |