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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContentsClient.java

Issue 13669003: Refactoring ContentVideoViewContextDelegate.java (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 7 years, 6 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: android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java b/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
index 70cd68cf60c0d321ed3ff0b35cad242921930436..643e5910dd65bfc6bde5166639a78338c8bad41a 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
@@ -4,8 +4,8 @@
package org.chromium.android_webview;
-import android.content.pm.ActivityInfo;
import android.content.Context;
+import android.content.pm.ActivityInfo;
import android.graphics.Bitmap;
import android.graphics.Picture;
import android.graphics.Rect;
@@ -23,6 +23,8 @@ import android.webkit.SslErrorHandler;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
+import org.chromium.content.browser.ContentVideoView;
+import org.chromium.content.browser.ContentVideoViewClient;
import org.chromium.content.browser.ContentViewClient;
import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.WebContentsObserverAndroid;
@@ -116,6 +118,10 @@ public abstract class AwContentsClient {
return AwContentsClient.this.shouldOverrideKeyEvent(event);
}
+ @Override
+ final public ContentVideoViewClient getContentVideoViewClient() {
+ return new AwContentVideoViewClient();
+ }
}
final void installWebContentsObserver(ContentViewCore contentViewCore) {
@@ -125,6 +131,35 @@ public abstract class AwContentsClient {
mWebContentsObserver = new AwWebContentsObserver(contentViewCore);
}
+ private class AwContentVideoViewClient implements ContentVideoViewClient {
+ @Override
+ public void onShowCustomView(View view) {
+ WebChromeClient.CustomViewCallback cb = new WebChromeClient.CustomViewCallback() {
+ @Override
+ public void onCustomViewHidden() {
+ ContentVideoView contentVideoView = ContentVideoView.getContentVideoView();
+ if (contentVideoView != null)
+ contentVideoView.exitFullscreen(false);
+ }
+ };
+ AwContentsClient.this.onShowCustomView(view, cb);
+ }
+
+ @Override
+ public void onDestroyContentVideoView() {
+ AwContentsClient.this.onHideCustomView();
+ }
+
+ @Override
+ public View getVideoLoadingProgressView() {
+ return AwContentsClient.this.getVideoLoadingProgressView();
+ }
+
+ @Override
+ public void keepScreenOn(boolean screenOn) {
+ }
+ }
+
final void setDIPScale(double dipScale) {
mDIPScale = dipScale;
}

Powered by Google App Engine
This is Rietveld 408576698