| Index: content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
|
| 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 feb6c84963a566cd0877d4562fe11c1357ea8423..e97ba20978a0f1e4b40a235b79e27a0d339badbf 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
|
| @@ -7,6 +7,9 @@ package org.chromium.content_shell;
|
| import android.content.Context;
|
| import android.util.AttributeSet;
|
| import android.view.LayoutInflater;
|
| +import android.view.Surface;
|
| +import android.view.SurfaceView;
|
| +import android.view.SurfaceHolder;
|
| import android.widget.FrameLayout;
|
|
|
| import org.chromium.base.CalledByNative;
|
| @@ -20,12 +23,43 @@ public class ShellManager extends FrameLayout {
|
|
|
| private Shell mActiveShell;
|
|
|
| + private String mStartupUrl = ContentShellActivity.DEFAULT_SHELL_URL;
|
| +
|
| + // The target for all content rendering.
|
| + private SurfaceView mSurfaceView;
|
| +
|
| /**
|
| * Constructor for inflating via XML.
|
| */
|
| public ShellManager(Context context, AttributeSet attrs) {
|
| super(context, attrs);
|
| nativeInit(this);
|
| +
|
| + mSurfaceView = new SurfaceView(context);
|
| + mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {
|
| + @Override
|
| + public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
|
| + nativeSurfaceSetSize(width, height);
|
| + }
|
| +
|
| + @Override
|
| + public void surfaceCreated(SurfaceHolder holder) {
|
| + nativeSurfaceCreated(holder.getSurface());
|
| + mActiveShell.loadUrl(mStartupUrl);
|
| + }
|
| +
|
| + @Override
|
| + public void surfaceDestroyed(SurfaceHolder holder) {
|
| + nativeSurfaceDestroyed();
|
| + }
|
| + });
|
| + }
|
| +
|
| + /**
|
| + * Sets the startup URL for new shell windows.
|
| + */
|
| + public void setStartupUrl(String url) {
|
| + mStartupUrl = url;
|
| }
|
|
|
| /**
|
| @@ -49,6 +83,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.setSurfaceView(mSurfaceView);
|
|
|
| removeAllViews();
|
| addView(shellView, new FrameLayout.LayoutParams(
|
| @@ -60,4 +95,7 @@ public class ShellManager extends FrameLayout {
|
|
|
| private static native void nativeInit(Object shellManagerInstance);
|
| private static native void nativeLaunchShell(String url);
|
| + private static native void nativeSurfaceCreated(Surface surface);
|
| + private static native void nativeSurfaceDestroyed();
|
| + private static native void nativeSurfaceSetSize(int width, int height);
|
| }
|
|
|