Bug 1197957 - Introduce GeckoView.Window class; r=snorp

GeckoView.Window is a class that acts as the interface between
GeckoView in Java and nsWindow in C++. It will contain native methods
that GeckoView will use to interact with nsWindow.

On initialization, Window.open is called to create a nsWindow and
establish the JNI association between Window and the native nsWindow.
Then, whenever Window instance methods are called, the JNI stubs will
automatically call members of nsWindow.
This commit is contained in:
Jim Chen
2015-09-21 10:13:32 -04:00
parent efd29e7f91
commit 3bedd655b1
4 changed files with 134 additions and 0 deletions

View File

@@ -12,8 +12,10 @@ import java.util.Set;
import org.json.JSONException;
import org.json.JSONObject;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.gfx.LayerView;
import org.mozilla.gecko.mozglue.GeckoLoader;
import org.mozilla.gecko.mozglue.JNIObject;
import org.mozilla.gecko.util.Clipboard;
import org.mozilla.gecko.util.EventCallback;
import org.mozilla.gecko.util.GeckoEventListener;
@@ -104,6 +106,14 @@ public class GeckoView extends LayerView
}
};
@WrapForJNI
private static final class Window extends JNIObject {
static native void open(Window instance, int width, int height);
@Override protected native void disposeNative();
}
private final Window window = new Window();
public GeckoView(Context context) {
super(context);
init(context, null, true);