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

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: using weak reference in native side Created 7 years, 8 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 9473d8ff9e9f6148c1685c22a29204c84aa791dd..faea18c821ad7e266a764838985dab835cef7442 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
@@ -4,6 +4,8 @@
package org.chromium.android_webview;
+import android.content.Context;
+import android.content.pm.ActivityInfo;
import android.graphics.Bitmap;
import android.graphics.Picture;
import android.graphics.Rect;
@@ -21,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;
@@ -196,6 +200,33 @@ public abstract class AwContentsClient extends ContentViewClient {
}
+ public class AwContentVideoViewClient implements ContentVideoViewClient {
joth 2013/04/12 17:56:24 nit - no need to be public
michaelbai 2013/04/18 18:21:59 Done.
+ @Override
+ public void onShowCustomView(View view) {
+ WebChromeClient.CustomViewCallback cb = new WebChromeClient.CustomViewCallback() {
+ @Override
+ public void onCustomViewHidden() {
+ ContentVideoView contentVideoView = ContentVideoView.getContentVideoView();
+ if (contentVideoView != null)
+ contentVideoView.destroyContentVideoView();
joth 2013/04/12 17:56:24 destroyContentVideoView could just be a static met
michaelbai 2013/04/18 18:21:59 Thanks On 2013/04/12 17:56:24, joth wrote:
+ }
+ };
+ AwContentsClient.this.onShowCustomView(view,
+ ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED,
joth 2013/04/12 17:56:24 call 2 param version already?
michaelbai 2013/04/18 18:21:59 Done, actually, this patch was created before that
+ cb);
+ }
+
+ @Override
+ public void onDestroyContentVideoView() {
+ AwContentsClient.this.onHideCustomView();
+ }
+
+ @Override
+ public View getVideoLoadingProgressView() {
+ return AwContentsClient.this.getVideoLoadingProgressView();
+ }
+ }
+
void installWebContentsObserver(ContentViewCore contentViewCore) {
if (mWebContentsObserver != null) {
mWebContentsObserver.detachFromWebContents();
@@ -330,4 +361,9 @@ public abstract class AwContentsClient extends ContentViewClient {
@Override
final public void onContextualActionBarHidden() {
}
+
+ @Override
+ final public ContentVideoViewClient getContentVideoViewClient() {
+ return new AwContentVideoViewClient();
+ }
}

Powered by Google App Engine
This is Rietveld 408576698