summaryrefslogtreecommitdiffstats
path: root/content/shell/android
diff options
context:
space:
mode:
Diffstat (limited to 'content/shell/android')
-rw-r--r--content/shell/android/java/src/org/chromium/content_shell/Shell.java8
-rw-r--r--content/shell/android/java/src/org/chromium/content_shell/ShellManager.java36
-rw-r--r--content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java28
3 files changed, 41 insertions, 31 deletions
diff --git a/content/shell/android/java/src/org/chromium/content_shell/Shell.java b/content/shell/android/java/src/org/chromium/content_shell/Shell.java
index 3a442a0..5e21dc0 100644
--- a/content/shell/android/java/src/org/chromium/content_shell/Shell.java
+++ b/content/shell/android/java/src/org/chromium/content_shell/Shell.java
@@ -22,6 +22,7 @@ import android.widget.TextView.OnEditorActionListener;
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
import org.chromium.content.browser.ContentView;
+import org.chromium.content.browser.ContentViewClient;
import org.chromium.content.browser.ContentViewRenderView;
import org.chromium.content.browser.LoadUrlParams;
import org.chromium.ui.base.WindowAndroid;
@@ -43,6 +44,7 @@ public class Shell extends LinearLayout {
// TODO(jrg): a mContentView.destroy() call is needed, both upstream and downstream.
private ContentView mContentView;
+ private ContentViewClient mContentViewClient;
private EditText mUrlTextView;
private ImageButton mPrevButton;
private ImageButton mNextButton;
@@ -85,10 +87,13 @@ public class Shell extends LinearLayout {
*
* @param nativeShell The pointer to the native Shell object.
* @param window The owning window for this shell.
+ * @param client The {@link ContentViewClient} to be bound to any current or new
+ * {@link ContentViewCore}s associated with this shell.
*/
- public void initialize(long nativeShell, WindowAndroid window) {
+ public void initialize(long nativeShell, WindowAndroid window, ContentViewClient client) {
mNativeShell = nativeShell;
mWindow = window;
+ mContentViewClient = client;
}
/**
@@ -246,6 +251,7 @@ public class Shell extends LinearLayout {
@CalledByNative
private void initFromNativeTabContents(long nativeTabContents) {
mContentView = ContentView.newInstance(getContext(), nativeTabContents, mWindow);
+ mContentView.setContentViewClient(mContentViewClient);
if (mContentView.getUrl() != null) mUrlTextView.setText(mContentView.getUrl());
((FrameLayout) findViewById(R.id.contentview_holder)).addView(mContentView,
new FrameLayout.LayoutParams(
diff --git a/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java b/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
index 9303be8..96b4112 100644
--- a/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
+++ b/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
@@ -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 @@ public class ShellManager extends FrameLayout {
// 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 @@ public class ShellManager extends FrameLayout {
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);
diff --git a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java
index 0e5aa74..be8ceaf 100644
--- a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java
+++ b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java
@@ -10,7 +10,6 @@ import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
-import android.view.View;
import android.widget.Toast;
import org.chromium.base.BaseSwitches;
@@ -18,11 +17,8 @@ import org.chromium.base.CommandLine;
import org.chromium.base.MemoryPressureListener;
import org.chromium.base.library_loader.LibraryLoader;
import org.chromium.base.library_loader.ProcessInitException;
-import org.chromium.content.browser.ActivityContentVideoViewClient;
import org.chromium.content.browser.BrowserStartupController;
-import org.chromium.content.browser.ContentVideoViewClient;
import org.chromium.content.browser.ContentView;
-import org.chromium.content.browser.ContentViewClient;
import org.chromium.content.browser.DeviceUtils;
import org.chromium.content.common.ContentSwitches;
import org.chromium.content_shell.Shell;
@@ -116,30 +112,6 @@ public class ContentShellActivity extends Activity {
shellUrl = savedInstanceState.getString(ACTIVE_SHELL_URL_KEY);
}
mShellManager.launchShell(shellUrl);
- getActiveContentView().setContentViewClient(new ContentViewClient() {
- @Override
- public ContentVideoViewClient getContentVideoViewClient() {
- return new ActivityContentVideoViewClient(ContentShellActivity.this) {
- @Override
- public void onShowCustomView(View view) {
- super.onShowCustomView(view);
- if (CommandLine.getInstance().hasSwitch(
- ContentSwitches.ENABLE_OVERLAY_FULLSCREEN_VIDEO_SUBTITLE)) {
- mShellManager.setOverlayVideoMode(true);
- }
- }
-
- @Override
- public void onDestroyContentVideoView() {
- super.onDestroyContentVideoView();
- if (CommandLine.getInstance().hasSwitch(
- ContentSwitches.ENABLE_OVERLAY_FULLSCREEN_VIDEO_SUBTITLE)) {
- mShellManager.setOverlayVideoMode(false);
- }
- }
- };
- }
- });
}
private void initializationFailed() {