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

Unified Diff: content/shell/android/java/src/org/chromium/content_shell/ShellManager.java

Issue 172043002: Fix a crash of the Content Shell for Android when showing videos in a ContentVideoView. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 10 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: content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
===================================================================
--- content/shell/android/java/src/org/chromium/content_shell/ShellManager.java (revision 251875)
+++ content/shell/android/java/src/org/chromium/content_shell/ShellManager.java (working copy)
@@ -4,16 +4,23 @@
package org.chromium.content_shell;
+import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
+import android.view.View;
import android.widget.FrameLayout;
import org.chromium.base.CalledByNative;
+import org.chromium.base.CommandLine;
import org.chromium.base.JNINamespace;
import org.chromium.base.ThreadUtils;
+import org.chromium.content.browser.ActivityContentVideoViewClient;
+import org.chromium.content.browser.ContentVideoViewClient;
import org.chromium.content.browser.ContentView;
+import org.chromium.content.browser.ContentViewClient;
import org.chromium.content.browser.ContentViewRenderView;
+import org.chromium.content.common.ContentSwitches;
import org.chromium.ui.base.WindowAndroid;
/**
@@ -31,13 +38,38 @@
// The target for all content rendering.
private ContentViewRenderView mContentViewRenderView;
+ private ContentViewClient mContentViewClient;
/**
* Constructor for inflating via XML.
*/
- public ShellManager(Context context, AttributeSet attrs) {
+ public ShellManager(final Context context, AttributeSet attrs) {
super(context, attrs);
nativeInit(this);
+ mContentViewClient = new ContentViewClient() {
+ @Override
+ public ContentVideoViewClient getContentVideoViewClient() {
+ return new ActivityContentVideoViewClient((Activity) context) {
+ @Override
+ public void onShowCustomView(View view) {
+ super.onShowCustomView(view);
+ if (CommandLine.getInstance().hasSwitch(
+ ContentSwitches.ENABLE_OVERLAY_FULLSCREEN_VIDEO_SUBTITLE)) {
+ setOverlayVideoMode(true);
+ }
+ }
+
+ @Override
+ public void onDestroyContentVideoView() {
+ super.onDestroyContentVideoView();
+ if (CommandLine.getInstance().hasSwitch(
+ ContentSwitches.ENABLE_OVERLAY_FULLSCREEN_VIDEO_SUBTITLE)) {
+ setOverlayVideoMode(false);
+ }
+ }
+ };
+ }
+ };
}
/**
@@ -105,7 +137,7 @@
LayoutInflater inflater =
(LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
Shell shellView = (Shell) inflater.inflate(R.layout.shell_view, null);
- shellView.initialize(nativeShellPtr, mWindow);
+ shellView.initialize(nativeShellPtr, mWindow, mContentViewClient);
// TODO(tedchoc): Allow switching back to these inactive shells.
if (mActiveShell != null) removeShell(mActiveShell);

Powered by Google App Engine
This is Rietveld 408576698