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

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

Issue 10823051: ContentShell rendering support on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix intents Created 8 years, 5 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
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);
}

Powered by Google App Engine
This is Rietveld 408576698