1999-10-07 <Ed Burns <ed.burns@sun.com>>
* This change fixes http://bugzilla.mozilla.org/show_bug.cgi?id=15793 which caused one to have to copy the component.reg and components directory. It also causes webclient to do autoregistration. It also adds a debugging method to BrowserControlMozillaShim.java nativeDebugBreak(). This changes makes webclient depend on having mozilla sources from 10/5/99 or later. Reviewed by Mark Lin <marklin@eng.sun.com> Approved by Ed Burns <edburns@acm.org>, module owner git-svn-id: svn://10.0.0.236/trunk@50183 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -31,7 +31,7 @@ import java.awt.Rectangle;
|
||||
*
|
||||
* <B>Lifetime And Scope</B> <P>
|
||||
*
|
||||
* @version $Id: BrowserControlImpl.java,v 1.2 1999-09-03 19:28:44 edburns%acm.org Exp $
|
||||
* @version $Id: BrowserControlImpl.java,v 1.3 1999-10-08 00:48:01 edburns%acm.org Exp $
|
||||
*
|
||||
* @see org.mozilla.webclient.BrowserControl
|
||||
*
|
||||
@@ -69,7 +69,8 @@ public class BrowserControlImpl extends Object implements BrowserControl
|
||||
|
||||
public BrowserControlImpl(int windowPtr, Rectangle bounds) throws Exception
|
||||
{
|
||||
nativeWebShell = BrowserControlMozillaShim.webShellCreate(windowPtr, bounds);
|
||||
nativeWebShell = BrowserControlMozillaShim.webShellCreate(windowPtr,
|
||||
bounds);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -244,7 +245,7 @@ public static void main(String [] args)
|
||||
// BrowserControlImpl me = new BrowserControlImpl();
|
||||
Log.setApplicationName("BrowserControlImpl");
|
||||
Log.setApplicationVersion("0.0");
|
||||
Log.setApplicationVersionDate("$Id: BrowserControlImpl.java,v 1.2 1999-09-03 19:28:44 edburns%acm.org Exp $");
|
||||
Log.setApplicationVersionDate("$Id: BrowserControlImpl.java,v 1.3 1999-10-08 00:48:01 edburns%acm.org Exp $");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ import java.awt.*;
|
||||
* There is one instance of this class and all of the exposed methods
|
||||
* are static.
|
||||
|
||||
* @version $Id: BrowserControlMozillaShim.java,v 1.3 1999-09-03 19:28:45 edburns%acm.org Exp $
|
||||
* @version $Id: BrowserControlMozillaShim.java,v 1.4 1999-10-08 00:48:02 edburns%acm.org Exp $
|
||||
*
|
||||
* @see org.mozilla.webclient.BrowserControlImpl
|
||||
|
||||
@@ -85,25 +85,19 @@ public BrowserControlMozillaShim()
|
||||
// Class methods
|
||||
//
|
||||
|
||||
public static void initialize () throws Exception
|
||||
/**
|
||||
|
||||
* it is safe to call this method multiple times, it is guaranteed
|
||||
* to only actually do something once.
|
||||
|
||||
*/
|
||||
|
||||
public static void initialize(String verifiedBinDirAbsolutePath) throws Exception
|
||||
{
|
||||
if (!initialized) {
|
||||
instance = new BrowserControlMozillaShim();
|
||||
|
||||
// PENDING(mark): Try loading the native library in your own implemntation specfic canvas
|
||||
// class (ie. Win32BrowserControlCanvas or MotifBrowserControlCanvas.
|
||||
// The Unix port needs this. If this is a problem, let me know ASAP.
|
||||
// - Mark
|
||||
/*
|
||||
try {
|
||||
System.loadLibrary("webclient");
|
||||
}
|
||||
catch (java.lang.UnsatisfiedLinkError e) {
|
||||
throw new Exception("Unable to open native webclient library");
|
||||
}
|
||||
*/
|
||||
|
||||
instance.nativeInitialize();
|
||||
instance.nativeInitialize(verifiedBinDirAbsolutePath);
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
@@ -281,11 +275,14 @@ public static void widgetUpdate (int widgetPtr)
|
||||
//
|
||||
|
||||
public static int webShellCreate (int windowPtr,
|
||||
Rectangle bounds) throws Exception
|
||||
Rectangle bounds) throws Exception
|
||||
{
|
||||
synchronized(lock) {
|
||||
if (initialized) {
|
||||
return(instance.nativeWebShellCreate(windowPtr, bounds.x, bounds.y, bounds.width + 1, bounds.height + 1));
|
||||
return(instance.nativeWebShellCreate(windowPtr,
|
||||
bounds.x, bounds.y,
|
||||
bounds.width + 1,
|
||||
bounds.height + 1));
|
||||
}
|
||||
else {
|
||||
throw new Exception("Error: unable to create native nsIWebShell");
|
||||
@@ -504,7 +501,7 @@ public static boolean webShellRefresh(int webShellPtr) throws Exception
|
||||
// Native interfaces
|
||||
//
|
||||
|
||||
private native void nativeInitialize () throws Exception;
|
||||
private native void nativeInitialize (String verifiedBinDirAbsolutePath) throws Exception;
|
||||
private native void nativeTerminate () throws Exception;
|
||||
|
||||
|
||||
@@ -573,6 +570,8 @@ private native String nativeWebShellGetURL (int webShellPtr, int aHistoryIndex
|
||||
*/
|
||||
private native boolean nativeWebShellRefresh (int webShellPtr) throws Exception;
|
||||
|
||||
public static native void nativeDebugBreak(String fileName, int lineNumber);
|
||||
|
||||
//
|
||||
// General Methods
|
||||
//
|
||||
@@ -589,7 +588,7 @@ public static void main(String [] args)
|
||||
BrowserControlMozillaShim me = new BrowserControlMozillaShim();
|
||||
Log.setApplicationName("BrowserControlMozillaShim");
|
||||
Log.setApplicationVersion("0.0");
|
||||
Log.setApplicationVersionDate("$Id: BrowserControlMozillaShim.java,v 1.3 1999-09-03 19:28:45 edburns%acm.org Exp $");
|
||||
Log.setApplicationVersionDate("$Id: BrowserControlMozillaShim.java,v 1.4 1999-10-08 00:48:02 edburns%acm.org Exp $");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.mozilla.webclient.*;
|
||||
* This is a test application for using the BrowserControl.
|
||||
|
||||
*
|
||||
* @version $Id: EmbeddedMozilla.java,v 1.2 1999-09-03 19:28:45 edburns%acm.org Exp $
|
||||
* @version $Id: EmbeddedMozilla.java,v 1.3 1999-10-08 00:48:04 edburns%acm.org Exp $
|
||||
*
|
||||
* @see org.mozilla.webclient.BrowserControlCanvasFactory
|
||||
|
||||
@@ -46,17 +46,27 @@ public class EmbeddedMozilla extends Frame implements ActionListener {
|
||||
private BrowserControl browserControl;
|
||||
private Panel controlPanel;
|
||||
private Panel buttonsPanel;
|
||||
|
||||
public static void printUsage()
|
||||
{
|
||||
System.out.println("usage: java org.mozilla.webclient.test.EmbeddedMozilla <path> [url]");
|
||||
System.out.println(" <path> is the absolute path to the native browser bin directory, ");
|
||||
System.out.println(" including the bin.");
|
||||
}
|
||||
|
||||
|
||||
public static void main (String[] arg) {
|
||||
String urlArg =(0 < arg.length) ? arg[0] : "http://www.mozilla.org/";
|
||||
if (1 > arg.length) {
|
||||
printUsage();
|
||||
System.exit(-1);
|
||||
}
|
||||
String urlArg =(2 == arg.length) ? arg[1] : "http://www.mozilla.org/";
|
||||
|
||||
EmbeddedMozilla gecko =
|
||||
new EmbeddedMozilla("Embedded Mozilla", urlArg);
|
||||
new EmbeddedMozilla("Embedded Mozilla", arg[0], urlArg);
|
||||
} // main()
|
||||
|
||||
|
||||
public EmbeddedMozilla (String title, String url) {
|
||||
public EmbeddedMozilla (String title, String binDir, String url) {
|
||||
super(title);
|
||||
System.out.println("constructed with " + url);
|
||||
|
||||
@@ -96,8 +106,17 @@ public class EmbeddedMozilla extends Frame implements ActionListener {
|
||||
controlPanel.add(buttonsPanel, BorderLayout.WEST);
|
||||
|
||||
// Create the browser
|
||||
BrowserControlCanvas browser =
|
||||
BrowserControlCanvasFactory.newBrowserControlCanvas();
|
||||
BrowserControlCanvas browser = null;
|
||||
|
||||
try {
|
||||
BrowserControlCanvasFactory.setAppData(binDir);
|
||||
browser = BrowserControlCanvasFactory.newBrowserControlCanvas();
|
||||
}
|
||||
catch(Exception e) {
|
||||
System.out.println("Can't create BrowserControlCanvas: " +
|
||||
e.getMessage());
|
||||
}
|
||||
|
||||
browser.setSize(defaultWidth, defaultHeight);
|
||||
|
||||
// Add the control panel and the browser
|
||||
|
||||
Reference in New Issue
Block a user