Chromium Code Reviews| 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..44ff1de2b7d89d8f7dd19ff4c4e3bd369ff45bdf 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,40 @@ public class ShellManager extends FrameLayout { |
| private Shell mActiveShell; |
| + private String mStartupUrl = "http://www.google.com"; |
| + |
| + // 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() { |
| + public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { |
|
Ted C
2012/07/31 20:58:05
add @Override to these methods.
no sievers
2012/07/31 21:17:17
Done.
|
| + nativeSurfaceSetSize(width, height); |
| + } |
| + |
| + public void surfaceCreated(SurfaceHolder holder) { |
| + nativeSurfaceCreated(holder.getSurface()); |
| + mActiveShell.loadUrl(mStartupUrl); |
| + } |
| + |
| + public void surfaceDestroyed(SurfaceHolder holder) { |
| + nativeSurfaceDestroyed(); |
| + } |
| + }); |
| + } |
| + |
| + /** |
| + * Sets the startup URL for new shell windows. |
| + */ |
| + public void setStartupUrl(String url) { |
| + mStartupUrl = url; |
| } |
| /** |
| @@ -49,6 +80,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 +92,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); |
| } |