Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.C.properties6
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.motif.OS.properties3
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.mozilla.XPCOM.properties4
-rw-r--r--bundles/org.eclipse.swt/.classpath_carbon2
-rw-r--r--bundles/org.eclipse.swt/.classpath_gtk2
-rwxr-xr-xbundles/org.eclipse.swt/.classpath_motif1
-rwxr-xr-xbundles/org.eclipse.swt/.classpath_win322
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/carbon/org/eclipse/swt/browser/MozillaDelegate.java95
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java221
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/gtk/org/eclipse/swt/browser/MozillaDelegate.java157
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/Download.java369
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/DownloadFactory.java100
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/DownloadFactory_1_8.java100
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/Download_1_8.java391
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/FilePicker.java291
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/FilePickerFactory.java100
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/HelperAppLauncherDialog.java203
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/HelperAppLauncherDialogFactory.java100
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/InputStream.java129
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/Mozilla.java2151
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/MozillaDelegate.java116
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/PromptDialog.java220
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/PromptService.java450
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/PromptServiceFactory.java100
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/WindowCreator.java182
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/internal/mozilla/XPCOMObject.java1023
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/Download.java345
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/DownloadFactory.java74
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/DownloadFactory_1_8.java76
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/Download_1_8.java343
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/FilePicker.java88
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/FilePickerFactory.java72
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/HelperAppLauncherDialog.java144
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/HelperAppLauncherDialogFactory.java74
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/InputStream.java84
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/Mozilla.java2144
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/PromptService.java439
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/PromptServiceFactory.java74
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/WindowCreator.java136
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/internal/mozilla/XPCOMObject.java827
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/MozillaDelegate.java66
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/swt_xpcom.rc45
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h1
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcomglue.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsID.java29
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/Mozilla.java2267
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/cocoa_custom.c25
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/make_macosx.mak40
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java1
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/cocoa/Cocoa.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/common/library/c.c16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/common/library/c.h5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/common/library/c_stats.c5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/common/library/c_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/common/library/c_structs.c (renamed from bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/LONG.java)22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/C.java39
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/LONG.java (renamed from bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/LONG.java)4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_freebsd.mak1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_solaris.mak1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_linux.mak1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os.c16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.c5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/build.bat5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/make_win32.mak67
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java12
72 files changed, 4356 insertions, 9785 deletions
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.C.properties b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.C.properties
index 79e6cd9eec..8de443dd7f 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.C.properties
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.C.properties
@@ -16,6 +16,9 @@ C_PTR_sizeof=
C_free=
C_free_0=cast=(void *)
+C_getenv=
+C_getenv_0=cast=(const char *)
+
C_malloc=
C_malloc_0=
@@ -145,6 +148,9 @@ org_eclipse_swt_internal_Compatibility=flags=no_gen
org_eclipse_swt_internal_Converter=flags=no_gen
+org_eclipse_swt_internal_LONG=flags=no_gen
+LONG_value=
+
org_eclipse_swt_internal_Library=flags=no_gen
org_eclipse_swt_internal_Lock=flags=no_gen
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.motif.OS.properties b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.motif.OS.properties
index 5d602496af..f74c84b2e0 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.motif.OS.properties
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.motif.OS.properties
@@ -2111,9 +2111,6 @@ OS_close_0=
OS_fd_set_sizeof=
-OS_getenv=
-OS_getenv_0=cast=(const char *)
-
OS_iconv=
OS_iconv_0=cast=(iconv_t)
OS_iconv_1=cast=(void *)
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.mozilla.XPCOM.properties b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.mozilla.XPCOM.properties
index 1e59f138fe..a0c2ed291c 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.mozilla.XPCOM.properties
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.mozilla.XPCOM.properties
@@ -843,10 +843,6 @@ XPCOM_nsID_Equals=flags=cpp
XPCOM_nsID_Equals_0=cast=(nsID *)
XPCOM_nsID_Equals_1=cast=(nsID *),flags=struct
-XPCOM_nsID_Parse=flags=cpp
-XPCOM_nsID_Parse_0=cast=(nsID *)
-XPCOM_nsID_Parse_1=cast=(const char *)
-
XPCOM_nsID_delete=flags=delete
XPCOM_nsID_delete_0=cast=(nsID *)
diff --git a/bundles/org.eclipse.swt/.classpath_carbon b/bundles/org.eclipse.swt/.classpath_carbon
index fbc4b21b2c..df6ef38eed 100644
--- a/bundles/org.eclipse.swt/.classpath_carbon
+++ b/bundles/org.eclipse.swt/.classpath_carbon
@@ -26,7 +26,9 @@
<classpathentry kind="src" path="Eclipse SWT Program/common"/>
<classpathentry kind="src" path="Eclipse SWT Program/carbon"/>
<classpathentry kind="src" path="Eclipse SWT Browser/common"/>
+ <classpathentry kind="src" path="Eclipse SWT Browser/mozilla"/>
<classpathentry kind="src" path="Eclipse SWT Browser/carbon"/>
+ <classpathentry kind="src" path="Eclipse SWT Mozilla/common"/>
<classpathentry kind="src" path="Eclipse SWT OpenGL/carbon"/>
<classpathentry kind="src" path="Eclipse SWT OpenGL/common"/>
<classpathentry kind="src" path="Eclipse SWT Theme/carbon"/>
diff --git a/bundles/org.eclipse.swt/.classpath_gtk b/bundles/org.eclipse.swt/.classpath_gtk
index ef6abe5b99..1a72586799 100644
--- a/bundles/org.eclipse.swt/.classpath_gtk
+++ b/bundles/org.eclipse.swt/.classpath_gtk
@@ -30,7 +30,7 @@
<classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/>
<classpathentry kind="src" path="Eclipse SWT Browser/common"/>
<classpathentry kind="src" path="Eclipse SWT Browser/mozilla"/>
- <classpathentry kind="src" path="Eclipse SWT Mozilla/gtk"/>
+ <classpathentry kind="src" path="Eclipse SWT Browser/gtk"/>
<classpathentry kind="src" path="Eclipse SWT Mozilla/common"/>
<classpathentry kind="src" path="Eclipse SWT OpenGL/gtk"/>
<classpathentry kind="src" path="Eclipse SWT OpenGL/glx"/>
diff --git a/bundles/org.eclipse.swt/.classpath_motif b/bundles/org.eclipse.swt/.classpath_motif
index f11fe17ced..d6db4e33a6 100755
--- a/bundles/org.eclipse.swt/.classpath_motif
+++ b/bundles/org.eclipse.swt/.classpath_motif
@@ -36,6 +36,7 @@
<classpathentry kind="src" path="Eclipse SWT Program/cde"/>
<classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/>
<classpathentry kind="src" path="Eclipse SWT Browser/common"/>
+ <classpathentry kind="src" path="Eclipse SWT Browser/mozilla"/>
<classpathentry kind="src" path="Eclipse SWT Browser/motif"/>
<classpathentry kind="src" path="Eclipse SWT Mozilla/common"/>
<classpathentry kind="src" path="Eclipse SWT OpenGL/motif"/>
diff --git a/bundles/org.eclipse.swt/.classpath_win32 b/bundles/org.eclipse.swt/.classpath_win32
index 2e3058d399..794b1e7e5c 100755
--- a/bundles/org.eclipse.swt/.classpath_win32
+++ b/bundles/org.eclipse.swt/.classpath_win32
@@ -25,6 +25,8 @@
<classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/>
<classpathentry kind="src" path="Eclipse SWT Browser/common"/>
<classpathentry kind="src" path="Eclipse SWT Browser/win32"/>
+ <classpathentry kind="src" path="Eclipse SWT Browser/mozilla"/>
+ <classpathentry kind="src" path="Eclipse SWT Mozilla/common"/>
<classpathentry kind="src" path="Eclipse SWT OpenGL/win32"/>
<classpathentry kind="src" path="Eclipse SWT OpenGL/common"/>
<classpathentry kind="src" path="Eclipse SWT Theme/win32"/>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/carbon/org/eclipse/swt/browser/MozillaDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/carbon/org/eclipse/swt/browser/MozillaDelegate.java
new file mode 100644
index 0000000000..e61aa8ad25
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/carbon/org/eclipse/swt/browser/MozillaDelegate.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.browser;
+
+import java.awt.Frame;
+import java.util.Hashtable;
+
+import org.eclipse.swt.awt.SWT_AWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.internal.LONG;
+import org.eclipse.swt.internal.carbon.*;
+import org.eclipse.swt.internal.cocoa.Cocoa;
+import org.eclipse.swt.widgets.*;
+
+class MozillaDelegate {
+ Browser browser;
+ Frame frame;
+ static Hashtable handles = new Hashtable ();
+
+MozillaDelegate (Browser browser) {
+ super ();
+ this.browser = browser;
+}
+
+static Browser findBrowser (int handle) {
+ LONG value = (LONG)handles.get (new LONG (handle));
+ if (value != null) {
+ Display display = Display.getCurrent ();
+ return (Browser)display.findWidget (value.value);
+ }
+ return null;
+}
+
+static char[] mbcsToWcs (String codePage, byte [] buffer) {
+ int encoding = OS.CFStringGetSystemEncoding ();
+ int cfstring = OS.CFStringCreateWithBytes (OS.kCFAllocatorDefault, buffer, buffer.length, encoding, false);
+ char[] chars = null;
+ if (cfstring != 0) {
+ int length = OS.CFStringGetLength (cfstring);
+ chars = new char [length];
+ if (length != 0) {
+ CFRange range = new CFRange ();
+ range.length = length;
+ OS.CFStringGetCharacters (cfstring, range, chars);
+ }
+ OS.CFRelease (cfstring);
+ }
+ return chars;
+}
+
+public static byte[] wcsToMbcs (String codePage, String string, boolean terminate) {
+ char[] chars = new char [string.length()];
+ string.getChars (0, chars.length, chars, 0);
+ int cfstring = OS.CFStringCreateWithCharacters (OS.kCFAllocatorDefault, chars, chars.length);
+ byte[] buffer = null;
+ if (cfstring != 0) {
+ CFRange range = new CFRange ();
+ range.length = chars.length;
+ int encoding = OS.CFStringGetSystemEncoding ();
+ int[] size = new int[1];
+ int numChars = OS.CFStringGetBytes (cfstring, range, encoding, (byte)'?', true, null, 0, size);
+ buffer = new byte [size[0] + (terminate ? 1 : 0)];
+ if (numChars != 0) {
+ numChars = OS.CFStringGetBytes (cfstring, range, encoding, (byte)'?', true, buffer, size[0], size);
+ }
+ OS.CFRelease (cfstring);
+ }
+ return buffer;
+}
+
+int getHandle () {
+ frame = SWT_AWT.new_Frame (browser);
+ int embedHandle = (int)Cocoa.getNativeHandleFromAWT (frame);
+ handles.put (new LONG (embedHandle), new LONG (browser.handle));
+ return embedHandle;
+}
+
+void onDispose (int embedHandle) {
+ handles.remove (new LONG (embedHandle));
+ frame.dispose ();
+}
+
+void setSize (int embedHandle, int width, int height) {
+ // TODO
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java
index a11c05363b..51488e882a 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java
@@ -30,7 +30,6 @@ import org.eclipse.swt.widgets.*;
public class Browser extends Composite {
WebBrowser webBrowser;
- /* Package Name */
static final String PACKAGE_PREFIX = "org.eclipse.swt.browser."; //$NON-NLS-1$
static final String NO_INPUT_METHOD = "org.eclipse.swt.internal.gtk.noInputMethod"; //$NON-NLS-1$
@@ -64,44 +63,50 @@ public class Browser extends Composite {
*
* @since 3.0
*/
-public Browser(Composite parent, int style) {
- super (checkParent(parent), checkStyle (style));
+public Browser (Composite parent, int style) {
+ super (checkParent (parent), checkStyle (style));
+ String platform = SWT.getPlatform ();
+ Display display = parent.getDisplay ();
+ if ("gtk".equals (platform)) display.setData (NO_INPUT_METHOD, null); //$NON-NLS-1$
String className = null;
- if ((style & SWT.NONE /*MOZILLA*/) != 0) { // TODO
- className = "org.eclipse.swt.browser.Mozilla";
+ if ((style & SWT.MOZILLA) != 0) {
+ className = "org.eclipse.swt.browser.Mozilla"; //$NON-NLS-1$
} else {
- String platform = SWT.getPlatform();
- if ("win32".equals(platform)) {
- className = "org.eclipse.swt.browser.IE";
- } else if ("motif".equals(platform)) {
- className = "org.eclipse.swt.browser.Mozilla";
- } else if ("gtk".equals(platform)) {
- className = "org.eclipse.swt.browser.Mozilla";
- } else if ("carbon".equals(platform)) {
- className = "org.eclipse.swt.browser.Safari";
- } else if ("photon".equals(platform)) {
- className = "org.eclipse.swt.browser.Voyager";
+ if ("win32".equals (platform)) { //$NON-NLS-1$
+ className = "org.eclipse.swt.browser.IE"; //$NON-NLS-1$
+ } else if ("motif".equals (platform)) { //$NON-NLS-1$
+ className = "org.eclipse.swt.browser.Mozilla"; //$NON-NLS-1$
+ } else if ("gtk".equals (platform)) { //$NON-NLS-1$
+ className = "org.eclipse.swt.browser.Mozilla"; //$NON-NLS-1$
+ } else if ("carbon".equals (platform)) { //$NON-NLS-1$
+ className = "org.eclipse.swt.browser.Safari"; //$NON-NLS-1$
+ } else if ("photon".equals (platform)) { //$NON-NLS-1$
+ className = "org.eclipse.swt.browser.Voyager"; //$NON-NLS-1$
} else {
- SWT.error(SWT.ERROR_NO_HANDLES);
+ dispose ();
+ SWT.error (SWT.ERROR_NO_HANDLES);
}
}
try {
- Class clazz = Class.forName(className);
- webBrowser = (WebBrowser)clazz.newInstance();
+ Class clazz = Class.forName (className);
+ webBrowser = (WebBrowser)clazz.newInstance ();
} catch (ClassNotFoundException e) {
} catch (IllegalAccessException e) {
} catch (InstantiationException e) {
}
- if (webBrowser == null) SWT.error(SWT.ERROR_NO_HANDLES);
+ if (webBrowser == null) {
+ dispose ();
+ SWT.error (SWT.ERROR_NO_HANDLES);
+ }
- webBrowser.setBrowser(this);
- webBrowser.create(parent, style);
+ webBrowser.setBrowser (this);
+ webBrowser.create (parent, style);
}
-static Composite checkParent(Composite parent) {
- String platform = SWT.getPlatform();
- if (!"gtk".equals(platform)) return parent;
+static Composite checkParent (Composite parent) {
+ String platform = SWT.getPlatform ();
+ if (!"gtk".equals (platform)) return parent; //$NON-NLS-1$
/*
* Note. Mozilla provides all IM suport needed for text input in webpages.
@@ -109,11 +114,11 @@ static Composite checkParent(Composite parent) {
* undetermine results to happen (hungs and crashes). The fix is to prevent
* SWT from creating an input method context for the Browser widget.
*/
- if (parent != null && !parent.isDisposed()) {
- Display display = parent.getDisplay();
+ if (parent != null && !parent.isDisposed ()) {
+ Display display = parent.getDisplay ();
if (display != null) {
- if (display.getThread() == Thread.currentThread ()) {
- display.setData (NO_INPUT_METHOD, "true");
+ if (display.getThread () == Thread.currentThread ()) {
+ display.setData (NO_INPUT_METHOD, "true"); //$NON-NLS-1$
}
}
}
@@ -121,18 +126,16 @@ static Composite checkParent(Composite parent) {
}
static int checkStyle(int style) {
- if ((style & SWT.NONE /*MOZILLA*/) != 0) {
+ String platform = SWT.getPlatform ();
+ if ((style & SWT.MOZILLA) != 0) {
+ if ("carbon".equals (platform)) return style | SWT.EMBEDDED; //$NON-NLS-1$
return style;
}
- String platform = SWT.getPlatform();
- if ("win32".equals(platform)) {
+ if ("win32".equals (platform)) { //$NON-NLS-1$
return style & ~SWT.BORDER;
- } else if ("motif".equals(platform)) {
+ } else if ("motif".equals (platform)) { //$NON-NLS-1$
return style | SWT.EMBEDDED;
- } else if ("gtk".equals(platform)) {
- } else if ("carbon".equals(platform)) {
- } else if ("photon".equals(platform)) {
}
return style;
}
@@ -143,7 +146,7 @@ static int checkStyle(int style) {
* @since 3.2
*/
public static void clearSessions () {
- WebBrowser.clearSessions();
+ WebBrowser.clearSessions ();
}
/**
@@ -167,10 +170,10 @@ public static void clearSessions () {
*
* @since 3.0
*/
-public void addCloseWindowListener(CloseWindowListener listener) {
+public void addCloseWindowListener (CloseWindowListener listener) {
checkWidget();
- if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- webBrowser.addCloseWindowListener(listener);
+ if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ webBrowser.addCloseWindowListener (listener);
}
/**
@@ -195,10 +198,10 @@ public void addCloseWindowListener(CloseWindowListener listener) {
*
* @since 3.0
*/
-public void addLocationListener(LocationListener listener) {
+public void addLocationListener (LocationListener listener) {
checkWidget();
- if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- webBrowser.addLocationListener(listener);
+ if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ webBrowser.addLocationListener (listener);
}
/**
@@ -222,10 +225,10 @@ public void addLocationListener(LocationListener listener) {
*
* @since 3.0
*/
-public void addOpenWindowListener(OpenWindowListener listener) {
+public void addOpenWindowListener (OpenWindowListener listener) {
checkWidget();
- if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- webBrowser.addOpenWindowListener(listener);
+ if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ webBrowser.addOpenWindowListener (listener);
}
/**
@@ -246,10 +249,10 @@ public void addOpenWindowListener(OpenWindowListener listener) {
*
* @since 3.0
*/
-public void addProgressListener(ProgressListener listener) {
+public void addProgressListener (ProgressListener listener) {
checkWidget();
- if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- webBrowser.addProgressListener(listener);
+ if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ webBrowser.addProgressListener (listener);
}
/**
@@ -273,10 +276,10 @@ public void addProgressListener(ProgressListener listener) {
*
* @since 3.0
*/
-public void addStatusTextListener(StatusTextListener listener) {
+public void addStatusTextListener (StatusTextListener listener) {
checkWidget();
- if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- webBrowser.addStatusTextListener(listener);
+ if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ webBrowser.addStatusTextListener (listener);
}
/**
@@ -297,10 +300,10 @@ public void addStatusTextListener(StatusTextListener listener) {
*
* @since 3.0
*/
-public void addTitleListener(TitleListener listener) {
+public void addTitleListener (TitleListener listener) {
checkWidget();
- if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- webBrowser.addTitleListener(listener);
+ if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ webBrowser.addTitleListener (listener);
}
/**
@@ -321,10 +324,10 @@ public void addTitleListener(TitleListener listener) {
*
* @since 3.0
*/
-public void addVisibilityWindowListener(VisibilityWindowListener listener) {
+public void addVisibilityWindowListener (VisibilityWindowListener listener) {
checkWidget();
- if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- webBrowser.addVisibilityWindowListener(listener);
+ if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ webBrowser.addVisibilityWindowListener (listener);
}
/**
@@ -341,16 +344,16 @@ public void addVisibilityWindowListener(VisibilityWindowListener listener) {
*
* @since 3.0
*/
-public boolean back() {
+public boolean back () {
checkWidget();
- return webBrowser.back();
+ return webBrowser.back ();
}
-protected void checkSubclass() {
- String name = getClass().getName();
- int index = name.lastIndexOf('.');
- if (!name.substring(0, index + 1).equals(PACKAGE_PREFIX)) {
- SWT.error(SWT.ERROR_INVALID_SUBCLASS);
+protected void checkSubclass () {
+ String name = getClass ().getName ();
+ int index = name.lastIndexOf ('.');
+ if (!name.substring (0, index + 1).equals (PACKAGE_PREFIX)) {
+ SWT.error (SWT.ERROR_INVALID_SUBCLASS);
}
}
@@ -375,10 +378,10 @@ protected void checkSubclass() {
*
* @since 3.1
*/
-public boolean execute(String script) {
+public boolean execute (String script) {
checkWidget();
- if (script == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return webBrowser.execute(script);
+ if (script == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ return webBrowser.execute (script);
}
/**
@@ -395,9 +398,9 @@ public boolean execute(String script) {
*
* @since 3.0
*/
-public boolean forward() {
+public boolean forward () {
checkWidget();
- return webBrowser.forward();
+ return webBrowser.forward ();
}
/**
@@ -413,9 +416,9 @@ public boolean forward() {
*
* @see #back
*/
-public boolean isBackEnabled() {
+public boolean isBackEnabled () {
checkWidget();
- return webBrowser.isBackEnabled();
+ return webBrowser.isBackEnabled ();
}
/**
@@ -431,9 +434,9 @@ public boolean isBackEnabled() {
*
* @see #forward
*/
-public boolean isForwardEnabled() {
+public boolean isForwardEnabled () {
checkWidget();
- return webBrowser.isForwardEnabled();
+ return webBrowser.isForwardEnabled ();
}
/**
@@ -450,15 +453,15 @@ public boolean isForwardEnabled() {
*
* @since 3.0
*/
-public String getUrl() {
+public String getUrl () {
checkWidget();
- return webBrowser.getUrl();
+ return webBrowser.getUrl ();
}
public boolean isFocusControl () {
checkWidget();
- if (webBrowser.isFocusControl()) return true;
- return super.isFocusControl();
+ if (webBrowser.isFocusControl ()) return true;
+ return super.isFocusControl ();
}
/**
@@ -471,9 +474,9 @@ public boolean isFocusControl () {
*
* @since 3.0
*/
-public void refresh() {
+public void refresh () {
checkWidget();
- webBrowser.refresh();
+ webBrowser.refresh ();
}
/**
@@ -493,10 +496,10 @@ public void refresh() {
*
* @since 3.0
*/
-public void removeCloseWindowListener(CloseWindowListener listener) {
+public void removeCloseWindowListener (CloseWindowListener listener) {
checkWidget();
- if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- webBrowser.removeCloseWindowListener(listener);
+ if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ webBrowser.removeCloseWindowListener (listener);
}
/**
@@ -516,10 +519,10 @@ public void removeCloseWindowListener(CloseWindowListener listener) {
*
* @since 3.0
*/
-public void removeLocationListener(LocationListener listener) {
+public void removeLocationListener (LocationListener listener) {
checkWidget();
- if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- webBrowser.removeLocationListener(listener);
+ if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ webBrowser.removeLocationListener (listener);
}
/**
@@ -539,10 +542,10 @@ public void removeLocationListener(LocationListener listener) {
*
* @since 3.0
*/
-public void removeOpenWindowListener(OpenWindowListener listener) {
+public void removeOpenWindowListener (OpenWindowListener listener) {
checkWidget();
- if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- webBrowser.removeOpenWindowListener(listener);
+ if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ webBrowser.removeOpenWindowListener (listener);
}
/**
@@ -563,10 +566,10 @@ public void removeOpenWindowListener(OpenWindowListener listener) {
*
* @since 3.0
*/
-public void removeProgressListener(ProgressListener listener) {
+public void removeProgressListener (ProgressListener listener) {
checkWidget();
- if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- webBrowser.removeProgressListener(listener);
+ if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ webBrowser.removeProgressListener (listener);
}
/**
@@ -586,10 +589,10 @@ public void removeProgressListener(ProgressListener listener) {
*
* @since 3.0
*/
-public void removeStatusTextListener(StatusTextListener listener) {
+public void removeStatusTextListener (StatusTextListener listener) {
checkWidget();
- if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- webBrowser.removeStatusTextListener(listener);
+ if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ webBrowser.removeStatusTextListener (listener);
}
/**
@@ -610,10 +613,10 @@ public void removeStatusTextListener(StatusTextListener listener) {
*
* @since 3.0
*/
-public void removeTitleListener(TitleListener listener) {
+public void removeTitleListener (TitleListener listener) {
checkWidget();
- if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- webBrowser.removeTitleListener(listener);
+ if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ webBrowser.removeTitleListener (listener);
}
/**
@@ -634,10 +637,10 @@ public void removeTitleListener(TitleListener listener) {
*
* @since 3.0
*/
-public void removeVisibilityWindowListener(VisibilityWindowListener listener) {
+public void removeVisibilityWindowListener (VisibilityWindowListener listener) {
checkWidget();
- if (listener == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- webBrowser.removeVisibilityWindowListener(listener);
+ if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ webBrowser.removeVisibilityWindowListener (listener);
}
/**
@@ -665,10 +668,10 @@ public void removeVisibilityWindowListener(VisibilityWindowListener listener) {
*
* @since 3.0
*/
-public boolean setText(String html) {
+public boolean setText (String html) {
checkWidget();
- if (html == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return webBrowser.setText(html);
+ if (html == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ return webBrowser.setText (html);
}
/**
@@ -691,10 +694,10 @@ public boolean setText(String html) {
*
* @since 3.0
*/
-public boolean setUrl(String url) {
+public boolean setUrl (String url) {
checkWidget();
- if (url == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return webBrowser.setUrl(url);
+ if (url == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ return webBrowser.setUrl (url);
}
/**
@@ -707,8 +710,8 @@ public boolean setUrl(String url) {
*
* @since 3.0
*/
-public void stop() {
+public void stop () {
checkWidget();
- webBrowser.stop();
+ webBrowser.stop ();
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/gtk/org/eclipse/swt/browser/MozillaDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/gtk/org/eclipse/swt/browser/MozillaDelegate.java
new file mode 100644
index 0000000000..e1ffc6fd36
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/gtk/org/eclipse/swt/browser/MozillaDelegate.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.browser;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.widgets.*;
+
+class MozillaDelegate {
+ Browser browser;
+ int /*long*/ mozillaHandle;
+ static Callback eventCallback;
+ static int /*long*/ eventProc;
+ static final int STOP_PROPOGATE = 1;
+ static final String ADD_WIDGET_KEY = "org.eclipse.swt.internal.addWidget"; //$NON-NLS-1$
+
+ static boolean IsLinux;
+ static {
+ String osName = System.getProperty ("os.name").toLowerCase (); //$NON-NLS-1$
+ IsLinux = osName.startsWith ("linux"); //$NON-NLS-1$
+ }
+
+MozillaDelegate (Browser browser) {
+ super ();
+ if (!IsLinux) {
+ browser.dispose ();
+ SWT.error (SWT.ERROR_NO_HANDLES, null, " [Unsupported platform]"); //$NON-NLS-1$
+ }
+ this.browser = browser;
+}
+
+static int /*long*/ eventProc (int /*long*/ handle, int /*long*/ gdkEvent, int /*long*/ pointer) {
+ Widget widget = Display.getCurrent ().findWidget (handle);
+ if (widget != null && widget instanceof Browser) {
+ return ((Mozilla)((Browser)widget).webBrowser).delegate.gtk_event (handle, gdkEvent, pointer);
+ }
+ return 0;
+}
+
+static Browser findBrowser (int /*long*/ handle) {
+ /*
+ * Note. On GTK, Mozilla is embedded into a GtkHBox handle
+ * and not directly into the parent Composite handle.
+ */
+ int /*long*/ parent = OS.gtk_widget_get_parent (handle);
+ Display display = Display.getCurrent ();
+ return (Browser)display.findWidget (parent);
+}
+
+public static char[] mbcsToWcs (String codePage, byte [] buffer) {
+ return Converter.mbcsToWcs (codePage, buffer);
+}
+
+public static byte[] wcsToMbcs (String codePage, String string, boolean terminate) {
+ return Converter.wcsToMbcs (codePage, string, terminate);
+}
+
+int /*long*/ getHandle () {
+ if (eventCallback == null) {
+ eventCallback = new Callback (getClass (), "eventProc", 3); //$NON-NLS-1$
+ eventProc = eventCallback.getAddress ();
+ if (eventProc == 0) {
+ browser.dispose ();
+ Mozilla.error (SWT.ERROR_NO_MORE_CALLBACKS);
+ }
+ }
+
+ /*
+ * Bug in Mozilla Linux GTK. Embedding Mozilla into a GtkFixed
+ * handle causes problems with some Mozilla plug-ins. For some
+ * reason, the Flash plug-in causes the child of the GtkFixed
+ * handle to be resized to 1 when the Flash document is loaded.
+ * That could be due to gtk_container_resize_children being called
+ * by Mozilla - or one of its plug-ins - on the GtkFixed handle,
+ * causing the child of the GtkFixed handle to be resized to 1.
+ * The workaround is to embed Mozilla into a GtkHBox handle.
+ */
+ int /*long*/ embedHandle = OS.gtk_hbox_new (false, 0);
+ OS.gtk_container_add (browser.handle, embedHandle);
+ OS.gtk_widget_show (embedHandle);
+
+ /*
+ * Feature in Mozilla. GtkEvents such as key down, key pressed may be consumed
+ * by Mozilla and never be received by the parent embedder. The workaround
+ * is to find the top Mozilla gtk widget that receives all the Mozilla GtkEvents,
+ * i.e. the first child of the parent embedder. Then hook event callbacks and
+ * forward the event to the parent embedder before Mozilla received and consumed
+ * them.
+ */
+ int /*long*/ list = OS.gtk_container_get_children (embedHandle);
+ if (list != 0) {
+ mozillaHandle = OS.g_list_data (list);
+ OS.g_list_free (list);
+
+ if (mozillaHandle != 0) {
+ browser.getDisplay ().setData (ADD_WIDGET_KEY, new Object[] {new LONG (mozillaHandle), browser});
+
+ /* Note. Callback to get events before Mozilla receives and consumes them. */
+ OS.g_signal_connect (mozillaHandle, OS.event, eventProc, 0);
+
+ /*
+ * Note. Callback to get the events not consumed by Mozilla - and to block
+ * them so that they don't get propagated to the parent handle twice.
+ * This hook is set after Mozilla and is therefore called after Mozilla's
+ * handler because GTK dispatches events in their order of registration.
+ */
+ OS.g_signal_connect (mozillaHandle, OS.key_press_event, eventProc, STOP_PROPOGATE);
+ OS.g_signal_connect (mozillaHandle, OS.key_release_event, eventProc, STOP_PROPOGATE);
+ }
+ }
+ return embedHandle;
+}
+
+int /*long*/ gtk_event (int /*long*/ handle, int /*long*/ gdkEvent, int /*long*/ pointer) {
+ /*
+ * Stop the propagation of events that are not consumed by Mozilla, before
+ * they reach the parent embedder. These event have already been received.
+ */
+ if (pointer == STOP_PROPOGATE) return 1;
+
+ GdkEvent event = new GdkEvent ();
+ OS.memmove (event, gdkEvent, GdkEvent.sizeof);
+ switch (event.type) {
+ case OS.GDK_KEY_PRESS:
+ case OS.GDK_KEY_RELEASE:
+ case OS.GDK_BUTTON_PRESS:
+ case OS.GDK_BUTTON_RELEASE: {
+ /*
+ * Forward the event to the parent embedder before Mozilla receives it,
+ * as Mozilla may or may not consume it.
+ */
+ OS.gtk_widget_event (browser.handle, gdkEvent);
+ break;
+ }
+ }
+ return 0;
+}
+
+void onDispose (int /*long*/ embedHandle) {
+ browser.getDisplay ().setData (ADD_WIDGET_KEY, new Object[] {new LONG (mozillaHandle), null});
+}
+
+void setSize (int /*long*/ embedHandle, int width, int height) {
+ OS.gtk_widget_set_size_request (embedHandle, width, height);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/Download.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/Download.java
deleted file mode 100644
index dff153cc57..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/Download.java
+++ /dev/null
@@ -1,369 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.browser;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.mozilla.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-class Download {
- XPCOMObject supports;
- XPCOMObject download;
- XPCOMObject progressDialog;
- XPCOMObject webProgressListener;
- nsIHelperAppLauncher helperAppLauncher;
- int refCount = 0;
-
- Shell shell;
- Label status;
- Button cancel;
-
-public Download() {
- createCOMInterfaces();
-}
-
-int AddRef() {
- refCount++;
- return refCount;
-}
-
-void createCOMInterfaces() {
- /* Create each of the interfaces that this object implements */
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- };
-
- download = new XPCOMObject(new int[]{2, 0, 0, 7, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return Init(args[0], args[1], args[2],args[3], args[4], args[5], args[6]);}
- public int /*long*/ method4(int /*long*/[] args) {return GetSource(args[0]);}
- public int /*long*/ method5(int /*long*/[] args) {return GetTarget(args[0]);}
- public int /*long*/ method6(int /*long*/[] args) {return GetPersist(args[0]);}
- public int /*long*/ method7(int /*long*/[] args) {return GetPercentComplete(args[0]);}
- public int /*long*/ method8(int /*long*/[] args) {return GetDisplayName(args[0]);}
- public int /*long*/ method9(int /*long*/[] args) {return SetDisplayName(args[0]);}
- public int /*long*/ method10(int /*long*/[] args) {return GetStartTime(args[0]);}
- public int /*long*/ method11(int /*long*/[] args) {return GetMIMEInfo(args[0]);}
- public int /*long*/ method12(int /*long*/[] args) {return GetListener(args[0]);}
- public int /*long*/ method13(int /*long*/[] args) {return SetListener(args[0]);}
- public int /*long*/ method14(int /*long*/[] args) {return GetObserver(args[0]);}
- public int /*long*/ method15(int /*long*/[] args) {return SetObserver(args[0]);}
- };
-
- progressDialog = new XPCOMObject(new int[]{2, 0, 0, 7, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return Init(args[0], args[1], args[2],args[3], args[4], args[5], args[6]);}
- public int /*long*/ method4(int /*long*/[] args) {return GetSource(args[0]);}
- public int /*long*/ method5(int /*long*/[] args) {return GetTarget(args[0]);}
- public int /*long*/ method6(int /*long*/[] args) {return GetPersist(args[0]);}
- public int /*long*/ method7(int /*long*/[] args) {return GetPercentComplete(args[0]);}
- public int /*long*/ method8(int /*long*/[] args) {return GetDisplayName(args[0]);}
- public int /*long*/ method9(int /*long*/[] args) {return SetDisplayName(args[0]);}
- public int /*long*/ method10(int /*long*/[] args) {return GetStartTime(args[0]);}
- public int /*long*/ method11(int /*long*/[] args) {return GetMIMEInfo(args[0]);}
- public int /*long*/ method12(int /*long*/[] args) {return GetListener(args[0]);}
- public int /*long*/ method13(int /*long*/[] args) {return SetListener(args[0]);}
- public int /*long*/ method14(int /*long*/[] args) {return GetObserver(args[0]);}
- public int /*long*/ method15(int /*long*/[] args) {return SetObserver(args[0]);}
- public int /*long*/ method16(int /*long*/[] args) {return Open(args[0]);}
- public int /*long*/ method17(int /*long*/[] args) {return GetCancelDownloadOnClose(args[0]);}
- public int /*long*/ method18(int /*long*/[] args) {return SetCancelDownloadOnClose(args[0]);}
- public int /*long*/ method19(int /*long*/[] args) {return GetDialog(args[0]);}
- public int /*long*/ method20(int /*long*/[] args) {return SetDialog(args[0]);}
- };
-
- webProgressListener = new XPCOMObject(new int[]{2, 0, 0, 4, 6, 3, 4, 3}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return OnStateChange(args[0], args[1], args[2],args[3]);}
- public int /*long*/ method4(int /*long*/[] args) {return OnProgressChange(args[0], args[1], args[2],args[3],args[4],args[5]);}
- public int /*long*/ method5(int /*long*/[] args) {return OnLocationChange(args[0], args[1], args[2]);}
- public int /*long*/ method6(int /*long*/[] args) {return OnStatusChange(args[0], args[1], args[2],args[3]);}
- public int /*long*/ method7(int /*long*/[] args) {return OnSecurityChange(args[0], args[1], args[2]);}
- };
-}
-
-void disposeCOMInterfaces() {
- if (supports != null) {
- supports.dispose();
- supports = null;
- }
- if (download != null) {
- download.dispose();
- download = null;
- }
- if (progressDialog != null) {
- progressDialog.dispose();
- progressDialog = null;
- }
- if (webProgressListener != null) {
- webProgressListener.dispose();
- webProgressListener = null;
- }
-}
-
-int /*long*/ getAddress() {
- return progressDialog.getAddress();
-}
-
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
- if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
-
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIDownload.NS_IDOWNLOAD_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {download.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIProgressDialog.NS_IPROGRESSDIALOG_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {progressDialog.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {webProgressListener.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
- return XPCOM.NS_ERROR_NO_INTERFACE;
-}
-
-int Release() {
- refCount--;
- if (refCount == 0) disposeCOMInterfaces();
- return refCount;
-}
-
-/* nsIDownload */
-
-/* Note. The argument startTime is defined as a PRInt64. This translates into two java ints. */
-public int /*long*/ Init(int /*long*/ aSource, int /*long*/ aTarget, int /*long*/ aDisplayName, int /*long*/ aMIMEInfo, int /*long*/ startTime1, int /*long*/ startTime2, int /*long*/ aPersist) {
- nsIURI source = new nsIURI(aSource);
- int /*long*/ aSpec = XPCOM.nsEmbedCString_new();
- int rc = source.GetHost(aSpec);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- int length = XPCOM.nsEmbedCString_Length(aSpec);
- int /*long*/ buffer = XPCOM.nsEmbedCString_get(aSpec);
- byte[] dest = new byte[length];
- XPCOM.memmove(dest, buffer, length);
- XPCOM.nsEmbedCString_delete(aSpec);
- String url = new String(dest);
-
- /*
- * As of mozilla 1.7 the second argument of the nsIDownload interface's
- * Init function changed from nsILocalFile to nsIURI. Detect which of
- * these interfaces the second argument implements and act accordingly.
- */
- String filename = null;
- nsISupports supports = new nsISupports(aTarget);
- int /*long*/[] result = new int /*long*/[1];
- rc = supports.QueryInterface(nsIURI.NS_IURI_IID, result);
- if (rc == 0) { /* >= 1.7 */
- nsIURI target = new nsIURI(result[0]);
- result[0] = 0;
- int /*long*/ aPath = XPCOM.nsEmbedCString_new();
- rc = target.GetPath(aPath);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- length = XPCOM.nsEmbedCString_Length(aPath);
- buffer = XPCOM.nsEmbedCString_get(aPath);
- dest = new byte[length];
- XPCOM.memmove(dest, buffer, length);
- XPCOM.nsEmbedCString_delete(aPath);
- filename = new String(dest);
- int separator = filename.lastIndexOf(System.getProperty("file.separator")); //$NON-NLS-1$
- filename = filename.substring(separator + 1);
- target.Release();
- } else { /* < 1.7 */
- nsILocalFile target = new nsILocalFile(aTarget);
- int /*long*/ aNativeTarget = XPCOM.nsEmbedCString_new();
- rc = target.GetNativeLeafName(aNativeTarget);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- length = XPCOM.nsEmbedCString_Length(aNativeTarget);
- buffer = XPCOM.nsEmbedCString_get(aNativeTarget);
- dest = new byte[length];
- XPCOM.memmove(dest, buffer, length);
- XPCOM.nsEmbedCString_delete(aNativeTarget);
- filename = new String(dest);
- }
-
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- if (event.widget == cancel) {
- shell.close();
- }
- if (helperAppLauncher != null) {
- helperAppLauncher.Cancel();
- helperAppLauncher.Release();
- }
- shell = null;
- helperAppLauncher = null;
- }
- };
- shell = new Shell(SWT.DIALOG_TRIM);
- String msg = Compatibility.getMessage("SWT_Download_File", new Object[] {filename}); //$NON-NLS-1$
- shell.setText(msg);
- GridLayout gridLayout = new GridLayout();
- gridLayout.marginHeight = 15;
- gridLayout.marginWidth = 15;
- gridLayout.verticalSpacing = 20;
- shell.setLayout(gridLayout);
- msg = Compatibility.getMessage("SWT_Download_Location", new Object[] {filename, url}); //$NON-NLS-1$
- new Label(shell, SWT.SIMPLE).setText(msg);
- status = new Label(shell, SWT.SIMPLE);
- msg = Compatibility.getMessage("SWT_Download_Started"); //$NON-NLS-1$
- status.setText(msg);
- GridData data = new GridData ();
- data.grabExcessHorizontalSpace = true;
- data.grabExcessVerticalSpace = true;
- status.setLayoutData (data);
-
- cancel = new Button(shell, SWT.PUSH);
- cancel.setText(SWT.getMessage("SWT_Cancel")); //$NON-NLS-1$
- data = new GridData ();
- data.horizontalAlignment = GridData.CENTER;
- cancel.setLayoutData (data);
- cancel.addListener(SWT.Selection, listener);
- shell.addListener(SWT.Close, listener);
- shell.pack();
- shell.open();
- return XPCOM.NS_OK;
-}
-
-public int /*long*/ GetSource(int /*long*/ aSource) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ GetTarget(int /*long*/ aTarget) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ GetPersist(int /*long*/ aPersist) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ GetPercentComplete(int /*long*/ aPercentComplete) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ GetDisplayName(int /*long*/ aDisplayName) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ SetDisplayName(int /*long*/ aDisplayName) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ GetStartTime(int /*long*/ aStartTime) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ GetMIMEInfo(int /*long*/ aMIMEInfo) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ GetListener(int /*long*/ aListener) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ SetListener(int /*long*/ aListener) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ GetObserver(int /*long*/ aObserver) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ SetObserver(int /*long*/ aObserver) {
- if (aObserver != 0) {
- nsISupports supports = new nsISupports(aObserver);
- int /*long*/[] result = new int /*long*/[1];
- int rc = supports.QueryInterface(nsIHelperAppLauncher.NS_IHELPERAPPLAUNCHER_IID, result);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- if (result[0] == 0) Mozilla.error(XPCOM.NS_ERROR_NO_INTERFACE);
- helperAppLauncher = new nsIHelperAppLauncher(result[0]);
- }
- return XPCOM.NS_OK;
-}
-
-/* nsIProgressDialog */
-public int /*long*/ Open(int /*long*/ aParent) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ GetCancelDownloadOnClose(int /*long*/ aCancelDownloadOnClose) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ SetCancelDownloadOnClose(int /*long*/ aCancelDownloadOnClose) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ GetDialog(int /*long*/ aDialog) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ SetDialog(int /*long*/ aDialog) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* nsIWebProgressListener */
-
-int /*long*/ OnStateChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aStateFlags, int /*long*/ aStatus) {
- if ((aStateFlags & nsIWebProgressListener.STATE_STOP) != 0) {
- if (helperAppLauncher != null) helperAppLauncher.Release();
- helperAppLauncher = null;
- if (shell != null && !shell.isDisposed()) shell.dispose();
- shell = null;
- }
- return XPCOM.NS_OK;
-}
-
-int /*long*/ OnProgressChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aCurSelfProgress, int /*long*/ aMaxSelfProgress, int /*long*/ aCurTotalProgress, int /*long*/ aMaxTotalProgress) {
- int currentKBytes = (int)/*64*/aCurTotalProgress / 1024;
- int totalKBytes = (int)/*64*/aMaxTotalProgress / 1024;
- if (shell != null & !shell.isDisposed()) {
- Object[] arguments = {new Integer(currentKBytes), new Integer(totalKBytes)};
- String statusMsg = Compatibility.getMessage("SWT_Download_Status", arguments); //$NON-NLS-1$
- status.setText(statusMsg);
- shell.layout(true);
- shell.getDisplay().update();
- }
- return XPCOM.NS_OK;
-}
-
-int /*long*/ OnLocationChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aLocation) {
- return XPCOM.NS_OK;
-}
-
-int /*long*/ OnStatusChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aStatus, int /*long*/ aMessage) {
- return XPCOM.NS_OK;
-}
-
-int /*long*/ OnSecurityChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ state) {
- return XPCOM.NS_OK;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/DownloadFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/DownloadFactory.java
deleted file mode 100644
index 467bc0e30f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/DownloadFactory.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.browser;
-
-import org.eclipse.swt.internal.C;
-import org.eclipse.swt.internal.mozilla.*;
-
-class DownloadFactory {
- XPCOMObject supports;
- XPCOMObject factory;
- int refCount = 0;
-
-public DownloadFactory() {
- createCOMInterfaces();
-}
-
-int AddRef() {
- refCount++;
- return refCount;
-}
-
-void createCOMInterfaces() {
- /* Create each of the interfaces that this object implements */
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- };
-
- factory = new XPCOMObject(new int[]{2, 0, 0, 3, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return CreateInstance(args[0], args[1], args[2]);}
- public int /*long*/ method4(int /*long*/[] args) {return LockFactory(args[0]);}
- };
-}
-
-void disposeCOMInterfaces() {
- if (supports != null) {
- supports.dispose();
- supports = null;
- }
- if (factory != null) {
- factory.dispose();
- factory = null;
- }
-}
-
-int /*long*/ getAddress() {
- return factory.getAddress();
-}
-
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
- if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
-
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIFactory.NS_IFACTORY_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {factory.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
-
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
- return XPCOM.NS_ERROR_NO_INTERFACE;
-}
-
-int Release() {
- refCount--;
- if (refCount == 0) disposeCOMInterfaces();
- return refCount;
-}
-
-/* nsIFactory */
-
-public int /*long*/ CreateInstance(int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
- Download download = new Download();
- download.AddRef();
- XPCOM.memmove(result, new int /*long*/[] {download.getAddress()}, C.PTR_SIZEOF);
- return XPCOM.NS_OK;
-}
-
-public int /*long*/ LockFactory(int /*long*/ lock) {
- return XPCOM.NS_OK;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/DownloadFactory_1_8.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/DownloadFactory_1_8.java
deleted file mode 100644
index 53bf8eacd9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/DownloadFactory_1_8.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.browser;
-
-import org.eclipse.swt.internal.C;
-import org.eclipse.swt.internal.mozilla.*;
-
-class DownloadFactory_1_8 {
- XPCOMObject supports;
- XPCOMObject factory;
- int refCount = 0;
-
-public DownloadFactory_1_8() {
- createCOMInterfaces();
-}
-
-int AddRef() {
- refCount++;
- return refCount;
-}
-
-void createCOMInterfaces() {
- /* Create each of the interfaces that this object implements */
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- };
-
- factory = new XPCOMObject(new int[]{2, 0, 0, 3, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return CreateInstance(args[0], args[1], args[2]);}
- public int /*long*/ method4(int /*long*/[] args) {return LockFactory(args[0]);}
- };
-}
-
-void disposeCOMInterfaces() {
- if (supports != null) {
- supports.dispose();
- supports = null;
- }
- if (factory != null) {
- factory.dispose();
- factory = null;
- }
-}
-
-int /*long*/ getAddress() {
- return factory.getAddress();
-}
-
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
- if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
-
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIFactory.NS_IFACTORY_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {factory.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
-
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
- return XPCOM.NS_ERROR_NO_INTERFACE;
-}
-
-int Release() {
- refCount--;
- if (refCount == 0) disposeCOMInterfaces();
- return refCount;
-}
-
-/* nsIFactory */
-
-public int /*long*/ CreateInstance(int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
- Download_1_8 download = new Download_1_8();
- download.AddRef();
- XPCOM.memmove(result, new int /*long*/[] {download.getAddress()}, C.PTR_SIZEOF);
- return XPCOM.NS_OK;
-}
-
-public int /*long*/ LockFactory(int /*long*/ lock) {
- return XPCOM.NS_OK;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/Download_1_8.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/Download_1_8.java
deleted file mode 100644
index 373820af3c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/Download_1_8.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.browser;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.mozilla.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-class Download_1_8 {
- XPCOMObject supports;
- XPCOMObject download;
- XPCOMObject progressDialog;
- XPCOMObject webProgressListener;
- nsICancelable cancelable;
- int refCount = 0;
-
- Shell shell;
- Label status;
- Button cancel;
-
- static final boolean is32 = C.PTR_SIZEOF == 4;
-
-public Download_1_8() {
- createCOMInterfaces();
-}
-
-int AddRef() {
- refCount++;
- return refCount;
-}
-
-void createCOMInterfaces() {
- /* Create each of the interfaces that this object implements */
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- };
-
- download = new XPCOMObject(new int[]{2, 0, 0, 4, 6, 3, 4, 3, is32 ? 10 : 6, is32 ? 8 : 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return OnStateChange(args[0], args[1], args[2], args[3]);}
- public int /*long*/ method4(int /*long*/[] args) {return OnProgressChange(args[0], args[1], args[2], args[3], args[4], args[5]);}
- public int /*long*/ method5(int /*long*/[] args) {return OnLocationChange(args[0], args[1], args[2]);}
- public int /*long*/ method6(int /*long*/[] args) {return OnStatusChange(args[0], args[1], args[2], args[3]);}
- public int /*long*/ method7(int /*long*/[] args) {return OnSecurityChange(args[0], args[1], args[2]);}
- public int /*long*/ method8(int /*long*/[] args) {
- if (args.length == 10) {
- return OnProgressChange64_32(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]);
- } else {
- return OnProgressChange64(args[0], args[1], args[2], args[3], args[4], args[5]);
- }
- }
- public int /*long*/ method9(int /*long*/[] args) {
- if (args.length == 8) {
- return Init_32(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
- } else {
- return Init(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
- }
- }
- public int /*long*/ method10(int /*long*/[] args) {return GetTargetFile(args[0]);}
- public int /*long*/ method11(int /*long*/[] args) {return GetPercentComplete(args[0]);}
- public int /*long*/ method12(int /*long*/[] args) {return GetAmountTransferred(args[0]);}
- public int /*long*/ method13(int /*long*/[] args) {return GetSize(args[0]);}
- public int /*long*/ method14(int /*long*/[] args) {return GetSource(args[0]);}
- public int /*long*/ method15(int /*long*/[] args) {return GetTarget(args[0]);}
- public int /*long*/ method16(int /*long*/[] args) {return GetCancelable(args[0]);}
- public int /*long*/ method17(int /*long*/[] args) {return GetDisplayName(args[0]);}
- public int /*long*/ method18(int /*long*/[] args) {return GetStartTime(args[0]);}
- public int /*long*/ method19(int /*long*/[] args) {return GetMIMEInfo(args[0]);}
- };
-
- progressDialog = new XPCOMObject(new int[]{2, 0, 0, 4, 6, 3, 4, 3, is32 ? 10 : 6, is32 ? 8 : 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return OnStateChange(args[0], args[1], args[2], args[3]);}
- public int /*long*/ method4(int /*long*/[] args) {return OnProgressChange(args[0], args[1], args[2], args[3], args[4], args[5]);}
- public int /*long*/ method5(int /*long*/[] args) {return OnLocationChange(args[0], args[1], args[2]);}
- public int /*long*/ method6(int /*long*/[] args) {return OnStatusChange(args[0], args[1], args[2], args[3]);}
- public int /*long*/ method7(int /*long*/[] args) {return OnSecurityChange(args[0], args[1], args[2]);}
- public int /*long*/ method8(int /*long*/[] args) {
- if (args.length == 10) {
- return OnProgressChange64_32(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]);
- } else {
- return OnProgressChange64(args[0], args[1], args[2], args[3], args[4], args[5]);
- }
- }
- public int /*long*/ method9(int /*long*/[] args) {
- if (args.length == 8) {
- return Init_32(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
- } else {
- return Init(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
- }
- }
- public int /*long*/ method10(int /*long*/[] args) {return GetTargetFile(args[0]);}
- public int /*long*/ method11(int /*long*/[] args) {return GetPercentComplete(args[0]);}
- public int /*long*/ method12(int /*long*/[] args) {return GetAmountTransferred(args[0]);}
- public int /*long*/ method13(int /*long*/[] args) {return GetSize(args[0]);}
- public int /*long*/ method14(int /*long*/[] args) {return GetSource(args[0]);}
- public int /*long*/ method15(int /*long*/[] args) {return GetTarget(args[0]);}
- public int /*long*/ method16(int /*long*/[] args) {return GetCancelable(args[0]);}
- public int /*long*/ method17(int /*long*/[] args) {return GetDisplayName(args[0]);}
- public int /*long*/ method18(int /*long*/[] args) {return GetStartTime(args[0]);}
- public int /*long*/ method19(int /*long*/[] args) {return GetMIMEInfo(args[0]);}
- public int /*long*/ method20(int /*long*/[] args) {return Open(args[0]);}
- public int /*long*/ method21(int /*long*/[] args) {return GetCancelDownloadOnClose(args[0]);}
- public int /*long*/ method22(int /*long*/[] args) {return SetCancelDownloadOnClose(args[0]);}
- public int /*long*/ method23(int /*long*/[] args) {return GetObserver(args[0]);}
- public int /*long*/ method24(int /*long*/[] args) {return SetObserver(args[0]);}
- public int /*long*/ method25(int /*long*/[] args) {return GetDialog(args[0]);}
- public int /*long*/ method26(int /*long*/[] args) {return SetDialog(args[0]);}
- };
-
- webProgressListener = new XPCOMObject(new int[]{2, 0, 0, 4, 6, 3, 4, 3}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return OnStateChange(args[0], args[1], args[2],args[3]);}
- public int /*long*/ method4(int /*long*/[] args) {return OnProgressChange(args[0], args[1], args[2],args[3],args[4],args[5]);}
- public int /*long*/ method5(int /*long*/[] args) {return OnLocationChange(args[0], args[1], args[2]);}
- public int /*long*/ method6(int /*long*/[] args) {return OnStatusChange(args[0], args[1], args[2],args[3]);}
- public int /*long*/ method7(int /*long*/[] args) {return OnSecurityChange(args[0], args[1], args[2]);}
- };
-}
-
-void disposeCOMInterfaces() {
- if (supports != null) {
- supports.dispose();
- supports = null;
- }
- if (download != null) {
- download.dispose();
- download = null;
- }
- if (progressDialog != null) {
- progressDialog.dispose();
- progressDialog = null;
- }
- if (webProgressListener != null) {
- webProgressListener.dispose();
- webProgressListener = null;
- }
-}
-
-int /*long*/ getAddress() {
- return progressDialog.getAddress();
-}
-
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
- if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
-
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIDownload_1_8.NS_IDOWNLOAD_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {download.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIProgressDialog_1_8.NS_IPROGRESSDIALOG_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {progressDialog.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {webProgressListener.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
- return XPCOM.NS_ERROR_NO_INTERFACE;
-}
-
-int Release() {
- refCount--;
- if (refCount == 0) disposeCOMInterfaces();
- return refCount;
-}
-
-/* nsIDownload */
-
-/* Note. The argument startTime is defined as a PRInt64. This translates into two java ints. */
-public int Init_32(int /*long*/ aSource, int /*long*/ aTarget, int /*long*/ aDisplayName, int /*long*/ aMIMEInfo, int /*long*/ startTime1, int /*long*/ startTime2, int /*long*/ aTempFile, int /*long*/ aCancelable) {
- long startTime = (startTime2 << 32) + startTime1;
- return Init (aSource, aTarget, aDisplayName, aMIMEInfo, startTime, aTempFile, aCancelable);
-}
-
-public int Init(int /*long*/ aSource, int /*long*/ aTarget, int /*long*/ aDisplayName, int /*long*/ aMIMEInfo, long startTime, int /*long*/ aTempFile, int /*long*/ aCancelable) {
- cancelable = new nsICancelable(aCancelable);
- nsIURI source = new nsIURI(aSource);
- int /*long*/ aSpec = XPCOM.nsEmbedCString_new();
- int rc = source.GetHost(aSpec);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- int length = XPCOM.nsEmbedCString_Length(aSpec);
- int /*long*/ buffer = XPCOM.nsEmbedCString_get(aSpec);
- byte[] dest = new byte[length];
- XPCOM.memmove(dest, buffer, length);
- XPCOM.nsEmbedCString_delete(aSpec);
- String url = new String(dest);
-
- nsIURI target = new nsIURI(aTarget);
- int /*long*/ aPath = XPCOM.nsEmbedCString_new();
- rc = target.GetPath(aPath);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- length = XPCOM.nsEmbedCString_Length(aPath);
- buffer = XPCOM.nsEmbedCString_get(aPath);
- dest = new byte[length];
- XPCOM.memmove(dest, buffer, length);
- XPCOM.nsEmbedCString_delete(aPath);
- String filename = new String(dest);
- int separator = filename.lastIndexOf(System.getProperty("file.separator")); //$NON-NLS-1$
- filename = filename.substring(separator + 1);
-
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- if (event.widget == cancel) {
- shell.close();
- }
- if (cancelable != null) {
- int rc = cancelable.Cancel(XPCOM.NS_BINDING_ABORTED);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- }
- shell = null;
- cancelable = null;
- }
- };
- shell = new Shell(SWT.DIALOG_TRIM);
- String msg = Compatibility.getMessage("SWT_Download_File", new Object[] {filename}); //$NON-NLS-1$
- shell.setText(msg);
- GridLayout gridLayout = new GridLayout();
- gridLayout.marginHeight = 15;
- gridLayout.marginWidth = 15;
- gridLayout.verticalSpacing = 20;
- shell.setLayout(gridLayout);
- msg = Compatibility.getMessage("SWT_Download_Location", new Object[] {filename, url}); //$NON-NLS-1$
- new Label(shell, SWT.SIMPLE).setText(msg);
- status = new Label(shell, SWT.SIMPLE);
- msg = Compatibility.getMessage("SWT_Download_Started"); //$NON-NLS-1$
- status.setText(msg);
- GridData data = new GridData ();
- data.grabExcessHorizontalSpace = true;
- data.grabExcessVerticalSpace = true;
- status.setLayoutData (data);
-
- cancel = new Button(shell, SWT.PUSH);
- cancel.setText(SWT.getMessage("SWT_Cancel")); //$NON-NLS-1$
- data = new GridData ();
- data.horizontalAlignment = GridData.CENTER;
- cancel.setLayoutData (data);
- cancel.addListener(SWT.Selection, listener);
- shell.addListener(SWT.Close, listener);
- shell.pack();
- shell.open();
- return XPCOM.NS_OK;
-}
-
-int /*long*/ GetAmountTransferred(int /*long*/ arg0) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-int /*long*/ GetCancelable(int /*long*/ arg0) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ GetDisplayName(int /*long*/ aDisplayName) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ GetMIMEInfo(int /*long*/ aMIMEInfo) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ GetPercentComplete(int /*long*/ aPercentComplete) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-int /*long*/ GetSize(int /*long*/ arg0) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ GetSource(int /*long*/ aSource) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ GetStartTime(int /*long*/ aStartTime) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ GetTarget(int /*long*/ aTarget) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-int /*long*/ GetTargetFile(int /*long*/ arg0) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* nsIProgressDialog */
-public int /*long*/ GetCancelDownloadOnClose(int /*long*/ aCancelDownloadOnClose) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ GetDialog(int /*long*/ aDialog) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ GetObserver(int /*long*/ aObserver) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ Open(int /*long*/ aParent) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ SetCancelDownloadOnClose(int /*long*/ aCancelDownloadOnClose) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ SetDialog(int /*long*/ aDialog) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ SetObserver(int /*long*/ aObserver) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* nsIWebProgressListener */
-
-int /*long*/ OnLocationChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aLocation) {
- return XPCOM.NS_OK;
-}
-
-int /*long*/ OnProgressChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aCurSelfProgress, int /*long*/ aMaxSelfProgress, int /*long*/ aCurTotalProgress, int /*long*/ aMaxTotalProgress) {
- return OnProgressChange64(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
-}
-
-/* Note. The last 4 args in the original interface are defined as PRInt64. These each translate into two java ints. */
-int /*long*/ OnProgressChange64_32(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aCurSelfProgress1, int /*long*/ aCurSelfProgress2, int /*long*/ aMaxSelfProgress1, int /*long*/ aMaxSelfProgress2, int /*long*/ aCurTotalProgress1, int /*long*/ aCurTotalProgress2, int /*long*/ aMaxTotalProgress1, int /*long*/ aMaxTotalProgress2) {
- long aCurSelfProgress = (aCurSelfProgress2 << 32) + aCurSelfProgress1;
- long aMaxSelfProgress = (aMaxSelfProgress2 << 32) + aMaxSelfProgress1;
- long aCurTotalProgress = (aCurTotalProgress2 << 32) + aCurTotalProgress1;
- long aMaxTotalProgress = (aMaxTotalProgress2 << 32) + aMaxTotalProgress1;
- return OnProgressChange64(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
-}
-
-int /*long*/ OnProgressChange64(int /*long*/ aWebProgress, int /*long*/ aRequest, long aCurSelfProgress, long aMaxSelfProgress, long aCurTotalProgress, long aMaxTotalProgress) {
- long currentKBytes = aCurTotalProgress / 1024;
- long totalKBytes = aMaxTotalProgress / 1024;
- if (shell != null & !shell.isDisposed()) {
- Object[] arguments = {new Long(currentKBytes), new Long(totalKBytes)};
- String statusMsg = Compatibility.getMessage("SWT_Download_Status", arguments); //$NON-NLS-1$
- status.setText(statusMsg);
- shell.layout(true);
- shell.getDisplay().update();
- }
- return XPCOM.NS_OK;
-}
-
-int /*long*/ OnSecurityChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ state) {
- return XPCOM.NS_OK;
-}
-
-int /*long*/ OnStateChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aStateFlags, int /*long*/ aStatus) {
- if ((aStateFlags & nsIWebProgressListener.STATE_STOP) != 0) {
- cancelable = null;
- if (shell != null && !shell.isDisposed()) shell.dispose();
- shell = null;
- }
- return XPCOM.NS_OK;
-}
-
-int /*long*/ OnStatusChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aStatus, int /*long*/ aMessage) {
- return XPCOM.NS_OK;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/FilePicker.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/FilePicker.java
deleted file mode 100644
index 28e3cdb486..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/FilePicker.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.browser;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.internal.C;
-import org.eclipse.swt.internal.Converter;
-import org.eclipse.swt.internal.mozilla.*;
-import org.eclipse.swt.widgets.*;
-
-class FilePicker {
- XPCOMObject supports;
- XPCOMObject filePicker;
-
- int refCount = 0;
-
- int mode;
- int /*long*/ parentHandle;
- String[] files, masks;
- String defaultFilename, directory, title;
-
- static final String SEPARATOR = System.getProperty ("file.separator"); //$NON-NLS-1$
-
-public FilePicker () {
- createCOMInterfaces ();
-}
-
-int AddRef () {
- refCount++;
- return refCount;
-}
-
-void createCOMInterfaces () {
- /* Create each of the interfaces that this object implements */
- supports = new XPCOMObject (new int[] {2, 0, 0}){
- public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface(args [0], args [1]);}
- public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
- public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
- };
-
- filePicker = new XPCOMObject (new int[] {2, 0, 0, 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}) {
- public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args [0], args [1]);}
- public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
- public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
- public int /*long*/ method3 (int /*long*/[] args) {return Init (args [0], args [1], args [2]);}
- public int /*long*/ method4 (int /*long*/[] args) {return AppendFilters (args [0]);}
- public int /*long*/ method5 (int /*long*/[] args) {return AppendFilter (args [0], args [1]);}
- public int /*long*/ method6 (int /*long*/[] args) {return GetDefaultString (args [0]);}
- public int /*long*/ method7 (int /*long*/[] args) {return SetDefaultString (args [0]);}
- public int /*long*/ method8 (int /*long*/[] args) {return GetDefaultExtension (args [0]);}
- public int /*long*/ method9 (int /*long*/[] args) {return SetDefaultExtension (args [0]);}
- public int /*long*/ method10 (int /*long*/[] args) {return GetFilterIndex (args [0]);}
- public int /*long*/ method11 (int /*long*/[] args) {return SetFilterIndex (args [0]);}
- public int /*long*/ method12 (int /*long*/[] args) {return GetDisplayDirectory (args [0]);}
- public int /*long*/ method13 (int /*long*/[] args) {return SetDisplayDirectory (args [0]);}
- public int /*long*/ method14 (int /*long*/[] args) {return GetFile (args [0]);}
- public int /*long*/ method15 (int /*long*/[] args) {return GetFileURL (args [0]);}
- public int /*long*/ method16 (int /*long*/[] args) {return GetFiles (args [0]);}
- public int /*long*/ method17 (int /*long*/[] args) {return Show (args [0]);}
- };
-}
-
-void disposeCOMInterfaces () {
- if (supports != null) {
- supports.dispose ();
- supports = null;
- }
- if (filePicker != null) {
- filePicker.dispose ();
- filePicker = null;
- }
-}
-
-int /*long*/ getAddress () {
- return filePicker.getAddress ();
-}
-
-int /*long*/ QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
- if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID ();
- XPCOM.memmove (guid, riid, nsID.sizeof);
-
- if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF);
- AddRef ();
- return XPCOM.NS_OK;
- }
- if (guid.Equals (nsIFilePicker.NS_IFILEPICKER_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {filePicker.getAddress ()}, C.PTR_SIZEOF);
- AddRef ();
- return XPCOM.NS_OK;
- }
- XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
- return XPCOM.NS_ERROR_NO_INTERFACE;
-}
-
-int Release () {
- refCount--;
- if (refCount == 0) disposeCOMInterfaces ();
- return refCount;
-}
-
-/* nsIFilePicker */
-
-int /*long*/ Init (int /*long*/ parent, int /*long*/ title, int /*long*/ mode) {
- parentHandle = parent;
- this.mode = (int)/*64*/mode;
- if (title != 0) {
- int length = XPCOM.strlen_PRUnichar (title);
- char[] chars = new char [length];
- XPCOM.memmove (chars, title, length * 2);
- this.title = new String (chars);
- }
-
- return XPCOM.NS_OK;
-}
-
-int /*long*/ Show (int /*long*/ _retval) {
- if (mode == nsIFilePicker.modeGetFolder) {
- /* picking a directory */
- int result = showDirectoryPicker ();
- XPCOM.memmove (_retval, new int /*long*/[] {result}, C.PTR_SIZEOF);
- return XPCOM.NS_OK;
- }
-
- /* picking a file */
- int style = mode == nsIFilePicker.modeSave ? SWT.SAVE : SWT.OPEN;
- if (mode == nsIFilePicker.modeOpenMultiple) style |= SWT.MULTI;
- Shell parent;
- if (parentHandle != 0) {
- parent = Shell.motif_new (Display.getCurrent (), parentHandle);
- } else {
- parent = new Shell (Display.getCurrent ());
- }
- FileDialog dialog = new FileDialog (parent, style);
- if (title != null) dialog.setText (title);
- if (directory != null) dialog.setFilterPath (directory);
- if (masks != null) dialog.setFilterExtensions (masks);
- if (defaultFilename != null) dialog.setFileName (defaultFilename);
- String filename = dialog.open ();
- files = dialog.getFileNames ();
- directory = dialog.getFilterPath ();
- title = defaultFilename = null;
- masks = null;
- int result = filename == null ? nsIFilePicker.returnCancel : nsIFilePicker.returnOK;
- XPCOM.memmove (_retval, new int /*long*/[] {result}, C.PTR_SIZEOF);
- return XPCOM.NS_OK;
-}
-
-int showDirectoryPicker () {
- Shell parent;
- if (parentHandle != 0) {
- parent = Shell.motif_new (Display.getCurrent (), parentHandle);
- } else {
- parent = new Shell (Display.getCurrent ());
- }
- DirectoryDialog dialog = new DirectoryDialog (parent, SWT.NONE);
- if (title != null) dialog.setText (title);
- if (directory != null) dialog.setFilterPath (directory);
- directory = dialog.open ();
- title = defaultFilename = null;
- files = masks = null;
- return directory == null ? nsIFilePicker.returnCancel : nsIFilePicker.returnOK;
-}
-
-int /*long*/ GetFiles (int /*long*/ aFiles) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-int /*long*/ GetFileURL (int /*long*/ aFileURL) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-int /*long*/ GetFile (int /*long*/ aFile) {
- String filename = ""; //$NON-NLS-1$
- if (directory != null) filename += directory + SEPARATOR;
- if (files != null && files.length > 0) filename += files [0];
- nsEmbedString path = new nsEmbedString (filename);
- int /*long*/[] file = new int /*long*/[1];
- int rc = XPCOM.NS_NewLocalFile (path.getAddress (), true, file);
- path.dispose ();
- if (rc != XPCOM.NS_OK) Mozilla.error (rc);
- if (file [0] == 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER);
- XPCOM.memmove (aFile, file, C.PTR_SIZEOF);
- return XPCOM.NS_OK;
-}
-
-int /*long*/ SetDisplayDirectory (int /*long*/ aDisplayDirectory) {
- if (aDisplayDirectory == 0) return XPCOM.NS_OK;
- nsILocalFile file = new nsILocalFile (aDisplayDirectory);
- int /*long*/ pathname = XPCOM.nsEmbedCString_new ();
- file.GetNativePath (pathname);
- int length = XPCOM.nsEmbedCString_Length (pathname);
- int /*long*/ buffer = XPCOM.nsEmbedCString_get (pathname);
- byte[] bytes = new byte [length];
- XPCOM.memmove (bytes, buffer, length);
- XPCOM.nsEmbedCString_delete (pathname);
- char[] chars = Converter.mbcsToWcs (null, bytes);
- directory = new String (chars);
- return XPCOM.NS_OK;
-}
-
-int /*long*/ GetDisplayDirectory (int /*long*/ aDisplayDirectory) {
- String directoryName = directory != null ? directory : ""; //$NON-NLS-1$
- nsEmbedString path = new nsEmbedString (directoryName);
- int /*long*/[] file = new int /*long*/[1];
- int rc = XPCOM.NS_NewLocalFile (path.getAddress (), true, file);
- path.dispose ();
- if (rc != XPCOM.NS_OK) Mozilla.error (rc);
- if (file [0] == 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER);
- XPCOM.memmove (aDisplayDirectory, file, C.PTR_SIZEOF);
- return XPCOM.NS_OK;
-}
-
-int /*long*/ SetFilterIndex (int /*long*/ aFilterIndex) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-int /*long*/ GetFilterIndex (int /*long*/ aFilterIndex) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-int /*long*/ SetDefaultExtension (int /*long*/ aDefaultExtension) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-int /*long*/ GetDefaultExtension (int /*long*/ aDefaultExtension) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-int /*long*/ SetDefaultString (int /*long*/ aDefaultString) {
- if (aDefaultString == 0) return XPCOM.NS_OK;
- int length = XPCOM.strlen_PRUnichar (aDefaultString);
- char[] chars = new char [length];
- XPCOM.memmove (chars, aDefaultString, length * 2);
- defaultFilename = new String (chars);
- return XPCOM.NS_OK;
-}
-
-int /*long*/ GetDefaultString (int /*long*/ aDefaultString) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-int /*long*/ AppendFilter (int /*long*/ title, int /*long*/ filter) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-int /*long*/ AppendFilters (int /*long*/ filterMask) {
- String[] addFilters = null;
- switch ((int)/*64*/filterMask) {
- case nsIFilePicker.filterAll:
- case nsIFilePicker.filterApps:
- masks = null; /* this is equivalent to no filter */
- break;
- case nsIFilePicker.filterHTML:
- addFilters = new String[] {"*.htm;*.html"}; //$NON-NLS-1$
- break;
- case nsIFilePicker.filterImages:
- addFilters = new String[] {"*.gif;*.jpeg;*.jpg;*.png"}; //$NON-NLS-1$
- break;
- case nsIFilePicker.filterText:
- addFilters = new String[] {"*.txt"}; //$NON-NLS-1$
- break;
- case nsIFilePicker.filterXML:
- addFilters = new String[] {"*.xml"}; //$NON-NLS-1$
- break;
- case nsIFilePicker.filterXUL:
- addFilters = new String[] {"*.xul"}; //$NON-NLS-1$
- break;
- }
- if (masks == null) {
- masks = addFilters;
- } else {
- if (addFilters != null) {
- String[] newFilters = new String [masks.length + addFilters.length];
- System.arraycopy (masks, 0, newFilters, 0, masks.length);
- System.arraycopy (addFilters, 0, newFilters, masks.length, addFilters.length);
- masks = newFilters;
- }
- }
- return XPCOM.NS_OK;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/FilePickerFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/FilePickerFactory.java
deleted file mode 100644
index 7d8b96c9fb..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/FilePickerFactory.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.browser;
-
-import org.eclipse.swt.internal.C;
-import org.eclipse.swt.internal.mozilla.*;
-
-class FilePickerFactory {
- XPCOMObject supports;
- XPCOMObject factory;
- int refCount = 0;
-
-public FilePickerFactory() {
- createCOMInterfaces();
-}
-
-int AddRef() {
- refCount++;
- return refCount;
-}
-
-void createCOMInterfaces() {
- /* Create each of the interfaces that this object implements */
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- };
-
- factory = new XPCOMObject(new int[]{2, 0, 0, 3, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return CreateInstance(args[0], args[1], args[2]);}
- public int /*long*/ method4(int /*long*/[] args) {return LockFactory(args[0]);}
- };
-}
-
-void disposeCOMInterfaces() {
- if (supports != null) {
- supports.dispose();
- supports = null;
- }
- if (factory != null) {
- factory.dispose();
- factory = null;
- }
-}
-
-int /*long*/ getAddress() {
- return factory.getAddress();
-}
-
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
- if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
-
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIFactory.NS_IFACTORY_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {factory.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
-
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
- return XPCOM.NS_ERROR_NO_INTERFACE;
-}
-
-int Release() {
- refCount--;
- if (refCount == 0) disposeCOMInterfaces();
- return refCount;
-}
-
-/* nsIFactory */
-
-public int /*long*/ CreateInstance(int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
- FilePicker picker = new FilePicker ();
- picker.AddRef();
- XPCOM.memmove(result, new int /*long*/[] {picker.getAddress()}, C.PTR_SIZEOF);
- return XPCOM.NS_OK;
-}
-
-public int /*long*/ LockFactory(int /*long*/ lock) {
- return XPCOM.NS_OK;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/HelperAppLauncherDialog.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/HelperAppLauncherDialog.java
deleted file mode 100644
index a5c7a70f3d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/HelperAppLauncherDialog.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.browser;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.C;
-import org.eclipse.swt.internal.mozilla.*;
-import org.eclipse.swt.widgets.*;
-
-class HelperAppLauncherDialog {
- XPCOMObject supports;
- XPCOMObject helperAppLauncherDialog;
- int refCount = 0;
-
-public HelperAppLauncherDialog() {
- createCOMInterfaces();
-}
-
-int AddRef() {
- refCount++;
- return refCount;
-}
-
-void createCOMInterfaces() {
- /* Create each of the interfaces that this object implements */
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- };
-
- helperAppLauncherDialog = new XPCOMObject(new int[]{2, 0, 0, 3, 5}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return Show(args[0], args[1], args[2]);}
- public int /*long*/ method4(int /*long*/[] args) {return PromptForSaveToFile(args[0], args[1], args[2], args[3], args[4]);}
- };
-}
-
-void disposeCOMInterfaces() {
- if (supports != null) {
- supports.dispose();
- supports = null;
- }
- if (helperAppLauncherDialog != null) {
- helperAppLauncherDialog.dispose();
- helperAppLauncherDialog = null;
- }
-}
-
-int /*long*/ getAddress() {
- return helperAppLauncherDialog.getAddress();
-}
-
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
- if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
-
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIHelperAppLauncherDialog.NS_IHELPERAPPLAUNCHERDIALOG_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {helperAppLauncherDialog.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
-
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
- return XPCOM.NS_ERROR_NO_INTERFACE;
-}
-
-int Release() {
- refCount--;
- /*
- * Note. This instance lives as long as the download it is binded to.
- * Its reference count is expected to go down to 0 when the download
- * has completed or when it has been cancelled. E.g. when the user
- * cancels the File Dialog, cancels or closes the Download Dialog
- * and when the Download Dialog goes away after the download is completed.
- */
- if (refCount == 0) disposeCOMInterfaces();
- return refCount;
-}
-
-/* nsIHelperAppLauncherDialog */
-
-public int /*long*/ Show(int /*long*/ aLauncher, int /*long*/ aContext, int /*long*/ aReason) {
- /*
- * The interface for nsIHelperAppLauncher changed as of mozilla 1.8. Query the received
- * nsIHelperAppLauncher for the new interface, and if it is not found then fall back to
- * the old interface.
- */
- nsISupports supports = new nsISupports(aLauncher);
- int /*long*/[] result = new int /*long*/[1];
- int rc = supports.QueryInterface(nsIHelperAppLauncher_1_8.NS_IHELPERAPPLAUNCHER_IID, result);
- if (rc == 0) { /* >= 1.8 */
- nsIHelperAppLauncher_1_8 helperAppLauncher = new nsIHelperAppLauncher_1_8(aLauncher);
- rc = helperAppLauncher.SaveToDisk(0, false);
- helperAppLauncher.Release();
- return rc;
- }
- nsIHelperAppLauncher helperAppLauncher = new nsIHelperAppLauncher(aLauncher); /* < 1.8 */
- return helperAppLauncher.SaveToDisk(0, false);
-}
-
-public int /*long*/ PromptForSaveToFile(int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ arg3, int /*long*/ arg4) {
- int /*long*/ aDefaultFile, aSuggestedFileExtension, _retval;
- boolean hasLauncher = false;
-
- /*
- * The interface for nsIHelperAppLauncherDialog changed as of mozilla 1.5 when an
- * extra argument was added to the PromptForSaveToFile method (this resulted in all
- * subsequent arguments shifting right). The workaround is to provide an XPCOMObject
- * that fits the newer API, and to use the first argument's type to infer whether
- * the old or new nsIHelperAppLauncherDialog interface is being used (and by extension
- * the ordering of the arguments). In mozilla >= 1.5 the first argument is an
- * nsIHelperAppLauncher.
- */
- /*
- * The interface for nsIHelperAppLauncher changed as of mozilla 1.8, so the first
- * argument must be queried for both the old and new nsIHelperAppLauncher interfaces.
- */
- nsISupports support = new nsISupports(arg0);
- int /*long*/[] result = new int /*long*/[1];
- int rc = support.QueryInterface(nsIHelperAppLauncher_1_8.NS_IHELPERAPPLAUNCHER_IID, result);
- boolean usingMozilla18 = rc == 0;
- if (usingMozilla18) {
- hasLauncher = true;
- nsISupports supports = new nsISupports(result[0]);
- supports.Release();
- } else {
- result[0] = 0;
- rc = support.QueryInterface(nsIHelperAppLauncher.NS_IHELPERAPPLAUNCHER_IID, result);
- if (rc == 0) {
- hasLauncher = true;
- nsISupports supports = new nsISupports(result[0]);
- supports.Release();
- }
- }
- result[0] = 0;
-
- if (hasLauncher) { /* >= 1.5 */
- aDefaultFile = arg2;
- aSuggestedFileExtension = arg3;
- _retval = arg4;
- } else { /* 1.4 */
- aDefaultFile = arg1;
- aSuggestedFileExtension = arg2;
- _retval = arg3;
- }
-
- int length = XPCOM.strlen_PRUnichar(aDefaultFile);
- char[] dest = new char[length];
- XPCOM.memmove(dest, aDefaultFile, length * 2);
- String defaultFile = new String(dest);
-
- length = XPCOM.strlen_PRUnichar(aSuggestedFileExtension);
- dest = new char[length];
- XPCOM.memmove(dest, aSuggestedFileExtension, length * 2);
- String suggestedFileExtension = new String(dest);
-
- Shell shell = new Shell();
- FileDialog fileDialog = new FileDialog(shell, SWT.SAVE);
- fileDialog.setFileName(defaultFile);
- fileDialog.setFilterExtensions(new String[] {suggestedFileExtension});
- String name = fileDialog.open();
- shell.close();
- if (name == null) {
- if (hasLauncher) {
- if (usingMozilla18) {
- nsIHelperAppLauncher_1_8 launcher = new nsIHelperAppLauncher_1_8(arg0);
- rc = launcher.Cancel(XPCOM.NS_BINDING_ABORTED);
- } else {
- nsIHelperAppLauncher launcher = new nsIHelperAppLauncher(arg0);
- rc = launcher.Cancel();
- }
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- return XPCOM.NS_OK;
- }
- return XPCOM.NS_ERROR_FAILURE;
- }
- nsEmbedString path = new nsEmbedString(name);
- rc = XPCOM.NS_NewLocalFile(path.getAddress(), true, result);
- path.dispose();
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- if (result[0] == 0) Mozilla.error(XPCOM.NS_ERROR_NULL_POINTER);
- /* Our own nsIDownload has been registered during the Browser initialization. It will be invoked by Mozilla. */
- XPCOM.memmove(_retval, result, C.PTR_SIZEOF);
- return XPCOM.NS_OK;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/HelperAppLauncherDialogFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/HelperAppLauncherDialogFactory.java
deleted file mode 100644
index ce17ce2ecc..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/HelperAppLauncherDialogFactory.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.browser;
-
-import org.eclipse.swt.internal.C;
-import org.eclipse.swt.internal.mozilla.*;
-
-class HelperAppLauncherDialogFactory {
- XPCOMObject supports;
- XPCOMObject factory;
- int refCount = 0;
-
-public HelperAppLauncherDialogFactory() {
- createCOMInterfaces();
-}
-
-int AddRef() {
- refCount++;
- return refCount;
-}
-
-void createCOMInterfaces() {
- /* Create each of the interfaces that this object implements */
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- };
-
- factory = new XPCOMObject(new int[]{2, 0, 0, 3, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return CreateInstance(args[0], args[1], args[2]);}
- public int /*long*/ method4(int /*long*/[] args) {return LockFactory(args[0]);}
- };
-}
-
-void disposeCOMInterfaces() {
- if (supports != null) {
- supports.dispose();
- supports = null;
- }
- if (factory != null) {
- factory.dispose();
- factory = null;
- }
-}
-
-int /*long*/ getAddress() {
- return factory.getAddress();
-}
-
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
- if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
-
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIFactory.NS_IFACTORY_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {factory.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
-
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
- return XPCOM.NS_ERROR_NO_INTERFACE;
-}
-
-int Release() {
- refCount--;
- if (refCount == 0) disposeCOMInterfaces();
- return refCount;
-}
-
-/* nsIFactory */
-
-public int /*long*/ CreateInstance(int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
- HelperAppLauncherDialog helperAppLauncherDialog = new HelperAppLauncherDialog();
- helperAppLauncherDialog.AddRef();
- XPCOM.memmove(result, new int /*long*/[] {helperAppLauncherDialog.getAddress()}, C.PTR_SIZEOF);
- return XPCOM.NS_OK;
-}
-
-public int /*long*/ LockFactory(int /*long*/ lock) {
- return XPCOM.NS_OK;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/InputStream.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/InputStream.java
deleted file mode 100644
index 1109fbf25a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/InputStream.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.browser;
-
-import org.eclipse.swt.internal.C;
-import org.eclipse.swt.internal.mozilla.*;
-
-class InputStream {
- XPCOMObject inputStream;
- int refCount = 0;
-
- byte[] buffer;
- int index = 0;
-
-public InputStream(byte[] buffer) {
- this.buffer = buffer;
- index = 0;
- createCOMInterfaces();
-}
-
-int AddRef() {
- refCount++;
- return refCount;
-}
-
-void createCOMInterfaces() {
- /* Create each of the interfaces that this object implements */
- inputStream = new XPCOMObject(new int[]{2, 0, 0, 0, 1, 3, 4, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return Close();}
- public int /*long*/ method4(int /*long*/[] args) {return Available(args[0]);}
- public int /*long*/ method5(int /*long*/[] args) {return Read(args[0], args[1], args[2]);}
- public int /*long*/ method6(int /*long*/[] args) {return ReadSegments(args[0], args[1], args[2], args[3]);}
- public int /*long*/ method7(int /*long*/[] args) {return IsNonBlocking(args[0]);}
- };
-}
-
-void disposeCOMInterfaces() {
- if (inputStream != null) {
- inputStream.dispose();
- inputStream = null;
- }
-}
-
-int /*long*/ getAddress() {
- return inputStream.getAddress();
-}
-
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
- if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
-
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {inputStream.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIInputStream.NS_IINPUTSTREAM_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {inputStream.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
- return XPCOM.NS_ERROR_NO_INTERFACE;
-}
-
-int Release() {
- refCount--;
- if (refCount == 0) disposeCOMInterfaces();
- return refCount;
-}
-
-/* nsIInputStream implementation */
-
-int /*long*/ Close() {
- buffer = null;
- index = 0;
- return XPCOM.NS_OK;
-}
-
-int /*long*/ Available(int /*long*/ _retval) {
- int available = buffer == null ? 0 : buffer.length - index;
- XPCOM.memmove(_retval, new int[] {available}, 4);
- return XPCOM.NS_OK;
-}
-
-int /*long*/ Read(int /*long*/ aBuf, int /*long*/ aCount, int /*long*/ _retval) {
- int max = Math.min((int)/*64*/aCount, buffer == null ? 0 : buffer.length - index);
- if (max > 0) {
- byte[] src = new byte[max];
- System.arraycopy(buffer, index, src, 0, max);
- XPCOM.memmove(aBuf, src, max);
- index += max;
- }
- XPCOM.memmove(_retval, new int[] {max}, 4);
- return XPCOM.NS_OK;
-}
-
-int /*long*/ ReadSegments(int /*long*/ aWriter, int /*long*/ aClosure, int /*long*/ aCount, int /*long*/ _retval) {
- int max = Math.min((int)/*64*/aCount, buffer == null ? 0 : buffer.length - index);
- int cnt = max;
- while (cnt > 0) {
- int[] aWriteCount = new int[1];
- int /*long*/ rc = XPCOM.Call(aWriter, getAddress(), aClosure, buffer, index, cnt, aWriteCount);
- if (rc != XPCOM.NS_OK) break;
- index += aWriteCount[0];
- cnt -= aWriteCount[0];
- }
- XPCOM.memmove(_retval, new int[] {max - cnt}, 4);
- return XPCOM.NS_OK;
-}
-
-int /*long*/ IsNonBlocking(int /*long*/ _retval) {
- /* blocking */
- XPCOM.memmove(_retval, new int[] {0}, 4);
- return XPCOM.NS_OK;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/Mozilla.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/Mozilla.java
deleted file mode 100755
index 50b139411d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/Mozilla.java
+++ /dev/null
@@ -1,2151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.browser;
-
-import java.io.*;
-import java.util.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.GTK;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.internal.mozilla.*;
-import org.eclipse.swt.layout.*;
-
-class Mozilla extends WebBrowser {
- int gtkHandle;
- nsIWebBrowser webBrowser;
-
- /* Interfaces for this Mozilla embedding notification */
- XPCOMObject supports;
- XPCOMObject weakReference;
- XPCOMObject webProgressListener;
- XPCOMObject webBrowserChrome;
- XPCOMObject webBrowserChromeFocus;
- XPCOMObject embeddingSiteWindow;
- XPCOMObject interfaceRequestor;
- XPCOMObject supportsWeakReference;
- XPCOMObject contextMenuListener;
- XPCOMObject uriContentListener;
- XPCOMObject tooltipListener;
- XPCOMObject directoryServiceProviderListener;
- int chromeFlags = nsIWebBrowserChrome.CHROME_DEFAULT;
- int refCount = 0;
- int /*long*/ request;
- Point location;
- Point size;
- boolean addressBar, menuBar, statusBar, toolBar;
- boolean visible, isModal;
- Shell tip = null;
-
- static nsIAppShell AppShell;
- static WindowCreator WindowCreator;
- static int BrowserCount;
- static boolean initialized, ignoreDispose;
- static boolean IsLinux;
- static String profileRootDirectory;
-
- /* XULRunner detect constants */
- static final String GRERANGE_LOWER = "1.8"; //$NON-NLS-1$
- static final boolean LowerRangeInclusive = true;
- static final String GRERANGE_UPPER = "1.9"; //$NON-NLS-1$
- static final boolean UpperRangeInclusive = false;
- static final String SEPARATOR_OS = System.getProperty("file.separator"); //$NON-NLS-1$
- static final String XPCOM_LIB = "/libxpcom.so"; //$NON-NLS-1$
-
- /* Package Name */
- static final String URI_FROMMEMORY = "file:///"; //$NON-NLS-1$
- static final String ABOUT_BLANK = "about:blank"; //$NON-NLS-1$
- static final String PREFERENCE_LANGUAGES = "intl.accept_languages"; //$NON-NLS-1$
- static final String PREFERENCE_CHARSET = "intl.charset.default"; //$NON-NLS-1$
- static final String SEPARATOR_LOCALE = "-"; //$NON-NLS-1$
- static final String TOKENIZER_LOCALE = ","; //$NON-NLS-1$
- static final String PROFILE_DIR = "/eclipse/"; //$NON-NLS-1$
- static final String HISTORY_FILE = "history.dat"; //$NON-NLS-1$
- static final String MIMETYPES_FILE = "mimeTypes.rdf"; //$NON-NLS-1$
- static final String PREFERENCES_FILE = "prefs.js"; //$NON-NLS-1$
- static final String CHROME_DIR = "chrome"; //$NON-NLS-1$
- static final String LOCALSTORE_FILE = "localstore.rdf"; //$NON-NLS-1$
- static final String PROFILE_AFTER_CHANGE = "profile-after-change"; //$NON-NLS-1$
- static final String PROFILE_BEFORE_CHANGE = "profile-before-change"; //$NON-NLS-1$
- static final String PROFILE_DO_CHANGE = "profile-do-change"; //$NON-NLS-1$
- static final String SHUTDOWN_PERSIST = "shutdown-persist"; //$NON-NLS-1$
- static final String STARTUP = "startup"; //$NON-NLS-1$
-
- static {
- String osName = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$
- IsLinux = osName.startsWith("linux");
- }
-
- static {
- MozillaClearSessions = new Runnable() {
- public void run() {
- if (!initialized) return;
- int[] result = new int [1];
- int rc = XPCOM.NS_GetServiceManager (result);
- if (rc != XPCOM.NS_OK) error (rc);
- if (result [0] == 0) error (XPCOM.NS_NOINTERFACE);
- nsIServiceManager serviceManager = new nsIServiceManager (result [0]);
- result [0] = 0;
- byte[] aContractID = Converter.wcsToMbcs(null, XPCOM.NS_COOKIEMANAGER_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID (aContractID, nsICookieManager.NS_ICOOKIEMANAGER_IID, result);
- if (rc != XPCOM.NS_OK) error (rc);
- if (result [0] == 0) error (XPCOM.NS_NOINTERFACE);
- serviceManager.Release ();
-
- nsICookieManager manager = new nsICookieManager (result [0]);
- result [0] = 0;
- rc = manager.GetEnumerator (result);
- if (rc != XPCOM.NS_OK) error (rc);
- manager.Release ();
-
- nsISimpleEnumerator enumerator = new nsISimpleEnumerator (result [0]);
- boolean[] moreElements = new boolean [1];
- rc = enumerator.HasMoreElements (moreElements);
- if (rc != XPCOM.NS_OK) error (rc);
- while (moreElements [0]) {
- result [0] = 0;
- rc = enumerator.GetNext (result);
- if (rc != XPCOM.NS_OK) error (rc);
- nsICookie cookie = new nsICookie (result [0]);
- long[] expires = new long [1];
- rc = cookie.GetExpires (expires);
- if (expires [0] == 0) {
- /* indicates a session cookie */
- int domain = XPCOM.nsEmbedCString_new ();
- int name = XPCOM.nsEmbedCString_new ();
- int path = XPCOM.nsEmbedCString_new ();
- cookie.GetHost (domain);
- cookie.GetName (name);
- cookie.GetPath (path);
- rc = manager.Remove (domain, name, path, false);
- XPCOM.nsEmbedCString_delete (domain);
- XPCOM.nsEmbedCString_delete (name);
- XPCOM.nsEmbedCString_delete (path);
- if (rc != XPCOM.NS_OK) error (rc);
- }
- cookie.Release ();
- rc = enumerator.HasMoreElements (moreElements);
- if (rc != XPCOM.NS_OK) error (rc);
- }
- enumerator.Release ();
- }
- };
- }
-
-public void create (Composite parent, int style) {
-
- if (!IsLinux) {
- browser.dispose();
- SWT.error(SWT.ERROR_NO_HANDLES, null, " [Unsupported platform]"); //$NON-NLS-1$
- }
-
- int /*long*/[] result = new int /*long*/[1];
- if (!initialized) {
- try {
- Library.loadLibrary ("swt-gtk"); //$NON-NLS-1$
- } catch (UnsatisfiedLinkError e) {
- SWT.error (SWT.ERROR_NO_HANDLES, e);
- }
-
- String mozillaPath = null;
- boolean initLoaded = false;
- try {
- Library.loadLibrary ("swt-xpcominit"); //$NON-NLS-1$
- initLoaded = true;
- } catch (UnsatisfiedLinkError e) {
- try {
- /*
- * The initial loadLibrary attempt may have failed as a result of the user's
- * system not having libstdc++.so.6 installed, so try to load the alternate
- * swt xpcominit library that depends on libswtc++.so.5 instead.
- */
- Library.loadLibrary ("swt-xpcominit-gcc3"); //$NON-NLS-1$
- initLoaded = true;
- } catch (UnsatisfiedLinkError ex) {
- /*
- * If this library still failed to load then do not attempt to detect a
- * xulrunner to use. The Browser may still be usable if MOZILLA_FIVE_HOME
- * points at a GRE.
- */
- }
- }
-
- boolean isXULRunner = false;
- if (initLoaded) {
- /* attempt to discover a XULRunner to use as the GRE */
- GREVersionRange range = new GREVersionRange();
- byte[] bytes = Converter.wcsToMbcs(null, GRERANGE_LOWER, true);
- int /*long*/ lower = OS.XtMalloc (bytes.length);
- OS.memmove (lower, bytes, bytes.length);
- range.lower = lower;
- range.lowerInclusive = LowerRangeInclusive;
-
- bytes = Converter.wcsToMbcs(null, GRERANGE_UPPER, true);
- int /*long*/ upper = OS.XtMalloc (bytes.length);
- OS.memmove (upper, bytes, bytes.length);
- range.upper = upper;
- range.upperInclusive = UpperRangeInclusive;
-
- int length = XPCOMInit.PATH_MAX;
- int /*long*/ greBuffer = OS.XtMalloc(length);
- int /*long*/ propertiesPtr = OS.XtMalloc(2 * OS.PTR_SIZEOF);
- int rc = XPCOMInit.GRE_GetGREPathWithProperties(range, 1, propertiesPtr, 0, greBuffer, length);
- OS.XtFree(lower);
- OS.XtFree(upper);
- OS.XtFree(propertiesPtr);
- if (rc == XPCOM.NS_OK) {
- /* indicates that a XULRunner was found */
- length = OS.strlen(greBuffer);
- bytes = new byte[length];
- OS.memmove(bytes, greBuffer, length);
- mozillaPath = new String(Converter.mbcsToWcs(null, bytes));
- isXULRunner = mozillaPath.length() > 0;
- }
- OS.XtFree(greBuffer);
- }
-
- if (isXULRunner) {
- try {
- Library.loadLibrary ("swt-xulrunner"); //$NON-NLS-1$
- } catch (UnsatisfiedLinkError e) {
- try {
- /*
- * The initial loadLibrary attempt may have failed as a result of the user's
- * system not having libstdc++.so.6 installed, so try to load the alternate
- * swt xulrunner library that depends on libswtc++.so.5 instead.
- */
- Library.loadLibrary ("swt-xulrunner-gcc3"); //$NON-NLS-1$
- } catch (UnsatisfiedLinkError ex) {
- browser.dispose ();
- /*
- * Print the error from the first failed attempt since at this point it's
- * known that the failure was not due to the libstdc++.so.6 dependency.
- */
- SWT.error (SWT.ERROR_NO_HANDLES, e);
- }
- }
- byte[] path = Converter.wcsToMbcs(null, mozillaPath, true);
- int rc = XPCOMGlue.XPCOMGlueStartup(path);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
-
- /*
- * remove the trailing "libxpcom.so" from mozillaPath because the NS_InitXPCOM2
- * invocation requires a directory name only
- */
- mozillaPath = mozillaPath.substring(0, mozillaPath.lastIndexOf(SEPARATOR_OS));
- } else {
- /* attempt to use the GRE pointed at by MOZILLA_FIVE_HOME */
-
- int /*long*/ ptr = OS.getenv(Converter.wcsToMbcs(null, XPCOM.MOZILLA_FIVE_HOME, true));
- if (ptr != 0) {
- int length = OS.strlen(ptr);
- byte[] buffer = new byte[length];
- OS.memmove(buffer, ptr, length);
- mozillaPath = new String (Converter.mbcsToWcs (null, buffer));
- }
- if (mozillaPath == null) {
- browser.dispose();
- SWT.error(SWT.ERROR_NO_HANDLES, null, " [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)]"); //$NON-NLS-1$
- }
- /*
- * Note. Embedding a Mozilla GTK1.2 causes a crash. The workaround
- * is to check the version of GTK used by Mozilla by looking for
- * the libwidget_gtk.so library used by Mozilla GTK1.2. Mozilla GTK2
- * uses the libwidget_gtk2.so library.
- */
- File file = new File(mozillaPath, "components/libwidget_gtk.so"); //$NON-NLS-1$
- if (file.exists()) {
- browser.dispose();
- SWT.error(SWT.ERROR_NO_HANDLES, null, " [Mozilla GTK2 required (GTK1.2 detected)]"); //$NON-NLS-1$
- }
-
- try {
- Library.loadLibrary ("swt-mozilla"); //$NON-NLS-1$
- } catch (UnsatisfiedLinkError e) {
- try {
- /*
- * The initial loadLibrary attempt may have failed as a result of the user's
- * system not having libstdc++.so.6 installed, so try to load the alternate
- * swt mozilla library that depends on libswtc++.so.5 instead.
- */
- Library.loadLibrary ("swt-mozilla-gcc3"); //$NON-NLS-1$
- } catch (UnsatisfiedLinkError ex) {
- browser.dispose ();
- /*
- * Print the error from the first failed attempt since at this point it's
- * known that the failure was not due to the libstdc++.so.6 dependency.
- */
- SWT.error (SWT.ERROR_NO_HANDLES, e);
- }
- }
- }
-
- int /*long*/[] retVal = new int /*long*/[1];
- nsEmbedString pathString = new nsEmbedString(mozillaPath);
- int rc = XPCOM.NS_NewLocalFile(pathString.getAddress(), true, retVal);
- pathString.dispose();
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (retVal[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_ERROR_NULL_POINTER);
- }
-
- nsIFile localFile = new nsILocalFile(retVal[0]);
- rc = XPCOM.NS_InitXPCOM2(0, localFile.getAddress(), 0);
- localFile.Release();
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- SWT.error(SWT.ERROR_NO_HANDLES, null, " [MOZILLA_FIVE_HOME may not point at an embeddable GRE] [NS_InitEmbedding " + mozillaPath + " error " + rc + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- rc = XPCOM.NS_GetComponentManager(result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- nsIComponentManager componentManager = new nsIComponentManager(result[0]);
- result[0] = 0;
- rc = componentManager.CreateInstance(XPCOM.NS_APPSHELL_CID, 0, nsIAppShell.NS_IAPPSHELL_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- AppShell = new nsIAppShell(result[0]);
- rc = AppShell.Create(0, null);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- rc = AppShell.Spinup();
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
-
- WindowCreator = new WindowCreator();
- WindowCreator.AddRef();
-
- rc = XPCOM.NS_GetServiceManager(result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- nsIServiceManager serviceManager = new nsIServiceManager(result[0]);
- result[0] = 0;
- byte[] aContractID = Converter.wcsToMbcs(null, XPCOM.NS_WINDOWWATCHER_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID(aContractID, nsIWindowWatcher.NS_IWINDOWWATCHER_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- nsIWindowWatcher windowWatcher = new nsIWindowWatcher(result[0]);
- result[0] = 0;
- rc = windowWatcher.SetWindowCreator(WindowCreator.getAddress());
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- windowWatcher.Release();
-
- /* compute the root profile directory */
- byte[] buffer = Converter.wcsToMbcs(null, XPCOM.NS_DIRECTORYSERVICE_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID(buffer, nsIDirectoryService.NS_IDIRECTORYSERVICE_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- nsIDirectoryService directoryService = new nsIDirectoryService(result[0]);
- result[0] = 0;
- rc = directoryService.QueryInterface(nsIProperties.NS_IPROPERTIES_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
- directoryService.Release();
-
- nsIProperties properties = new nsIProperties(result[0]);
- result[0] = 0;
- buffer = Converter.wcsToMbcs(null, XPCOM.NS_APP_APPLICATION_REGISTRY_DIR, true);
- rc = properties.Get(buffer, nsIFile.NS_IFILE_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
- properties.Release();
-
- nsIFile profileDir = new nsIFile(result[0]);
- result[0] = 0;
- int /*long*/ path = XPCOM.nsEmbedCString_new();
- rc = profileDir.GetNativePath(path);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- int length = XPCOM.nsEmbedCString_Length(path);
- int /*long*/ ptr = XPCOM.nsEmbedCString_get(path);
- buffer = new byte [length];
- XPCOM.memmove(buffer, ptr, length);
- profileRootDirectory = new String(Converter.mbcsToWcs(null, buffer)) + PROFILE_DIR;
- XPCOM.nsEmbedCString_delete(path);
- profileDir.Release();
-
- browser.getDisplay().addListener(SWT.Dispose, new Listener() {
- public void handleEvent(Event event) {
- int /*long*/[] result = new int /*long*/[1];
- int rc = XPCOM.NS_GetServiceManager(result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_NOINTERFACE);
-
- nsIServiceManager serviceManager = new nsIServiceManager(result[0]);
- result[0] = 0;
- byte[] buffer = Converter.wcsToMbcs(null, XPCOM.NS_OBSERVER_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID(buffer, nsIObserverService.NS_IOBSERVERSERVICE_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_NOINTERFACE);
- serviceManager.Release();
-
- nsIObserverService observerService = new nsIObserverService(result[0]);
- result[0] = 0;
- buffer = Converter.wcsToMbcs(null, PROFILE_BEFORE_CHANGE, true);
- int length = SHUTDOWN_PERSIST.length();
- char[] chars = new char [length + 1];
- SHUTDOWN_PERSIST.getChars(0, length, chars, 0);
- rc = observerService.NotifyObservers(0, buffer, chars);
- if (rc != XPCOM.NS_OK) error(rc);
- observerService.Release();
- }
- });
-
- /*
- * As a result of using a common profile the user cannot change their locale
- * and charset. The fix for this is to set mozilla's locale and charset
- * preference values according to the user's current locale and charset.
- */
- aContractID = Converter.wcsToMbcs(null, XPCOM.NS_PREFSERVICE_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID(aContractID, nsIPrefService.NS_IPREFSERVICE_IID, result);
- serviceManager.Release();
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- nsIPrefService prefService = new nsIPrefService(result[0]);
- result[0] = 0;
- buffer = new byte[1];
- rc = prefService.GetBranch(buffer, result); /* empty buffer denotes root preference level */
- prefService.Release();
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- nsIPrefBranch prefBranch = new nsIPrefBranch(result[0]);
- result[0] = 0;
-
- /* get Mozilla's current locale preference value */
- String prefLocales = null;
- nsIPrefLocalizedString localizedString = null;
- buffer = Converter.wcsToMbcs(null, PREFERENCE_LANGUAGES, true);
- rc = prefBranch.GetComplexValue(buffer, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, result);
- /*
- * Feature of Debian. For some reason attempting to query for the current locale
- * preference fails on Debian. The workaround for this is to assume a value of
- * "en-us,en" since this is typically the default value when mozilla is used without
- * a profile.
- */
- if (rc != XPCOM.NS_OK) {
- prefLocales = "en-us,en" + TOKENIZER_LOCALE; //$NON-NLS-1$
- } else {
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
- localizedString = new nsIPrefLocalizedString(result[0]);
- result[0] = 0;
- rc = localizedString.ToString(result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
- length = XPCOM.strlen_PRUnichar(result[0]);
- char[] dest = new char[length];
- XPCOM.memmove(dest, result[0], length * 2);
- prefLocales = new String(dest) + TOKENIZER_LOCALE;
- }
- result[0] = 0;
-
- /*
- * construct the new locale preference value by prepending the
- * user's current locale and language to the original value
- */
- Locale locale = Locale.getDefault();
- String language = locale.getLanguage();
- String country = locale.getCountry();
- StringBuffer stringBuffer = new StringBuffer (language);
- stringBuffer.append(SEPARATOR_LOCALE);
- stringBuffer.append(country.toLowerCase());
- stringBuffer.append(TOKENIZER_LOCALE);
- stringBuffer.append(language);
- stringBuffer.append(TOKENIZER_LOCALE);
- String newLocales = stringBuffer.toString();
- StringTokenizer tokenzier = new StringTokenizer(prefLocales, TOKENIZER_LOCALE);
- while (tokenzier.hasMoreTokens()) {
- String token = (tokenzier.nextToken() + TOKENIZER_LOCALE).trim();
- /* ensure that duplicate locale values are not added */
- if (newLocales.indexOf(token) == -1) {
- stringBuffer.append(token);
- }
- }
- newLocales = stringBuffer.toString();
- if (!newLocales.equals(prefLocales)) {
- /* write the new locale value */
- newLocales = newLocales.substring(0, newLocales.length() - TOKENIZER_LOCALE.length ()); /* remove trailing tokenizer */
- length = newLocales.length();
- char[] charBuffer = new char[length + 1];
- newLocales.getChars(0, length, charBuffer, 0);
- if (localizedString == null) {
- byte[] contractID = Converter.wcsToMbcs(null, XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID, true);
- rc = componentManager.CreateInstanceByContractID(contractID, 0, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
- localizedString = new nsIPrefLocalizedString(result[0]);
- result[0] = 0;
- }
- localizedString.SetDataWithLength(length, charBuffer);
- rc = prefBranch.SetComplexValue(buffer, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, localizedString.getAddress());
- }
- if (localizedString != null) {
- localizedString.Release();
- localizedString = null;
- }
-
- /* get Mozilla's current charset preference value */
- String prefCharset = null;
- buffer = Converter.wcsToMbcs(null, PREFERENCE_CHARSET, true);
- rc = prefBranch.GetComplexValue(buffer, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, result);
- /*
- * Feature of Debian. For some reason attempting to query for the current charset
- * preference fails on Debian. The workaround for this is to assume a value of
- * "ISO-8859-1" since this is typically the default value when mozilla is used
- * without a profile.
- */
- if (rc != XPCOM.NS_OK) {
- prefCharset = "ISO-8859-1"; //$NON_NLS-1$
- } else {
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
- localizedString = new nsIPrefLocalizedString(result[0]);
- result[0] = 0;
- rc = localizedString.ToString(result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
- length = XPCOM.strlen_PRUnichar(result[0]);
- char[] dest = new char[length];
- XPCOM.memmove(dest, result[0], length * 2);
- prefCharset = new String(dest);
- }
- result[0] = 0;
-
- String newCharset = System.getProperty("file.encoding"); // $NON-NLS-1$
- if (!newCharset.equals(prefCharset)) {
- /* write the new charset value */
- length = newCharset.length();
- char[] charBuffer = new char[length + 1];
- newCharset.getChars(0, length, charBuffer, 0);
- if (localizedString == null) {
- byte[] contractID = Converter.wcsToMbcs(null, XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID, true);
- rc = componentManager.CreateInstanceByContractID(contractID, 0, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
- localizedString = new nsIPrefLocalizedString(result[0]);
- result[0] = 0;
- }
- localizedString.SetDataWithLength(length, charBuffer);
- rc = prefBranch.SetComplexValue(buffer, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, localizedString.getAddress());
- }
- if (localizedString != null) localizedString.Release();
- prefBranch.Release();
-
- PromptServiceFactory factory = new PromptServiceFactory();
- factory.AddRef();
-
- rc = componentManager.QueryInterface(nsIComponentRegistrar.NS_ICOMPONENTREGISTRAR_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- nsIComponentRegistrar componentRegistrar = new nsIComponentRegistrar(result[0]);
- result[0] = 0;
- aContractID = Converter.wcsToMbcs(null, XPCOM.NS_PROMPTSERVICE_CONTRACTID, true);
- byte[] aClassName = Converter.wcsToMbcs(null, "Prompt Service", true); //$NON-NLS-1$
- rc = componentRegistrar.RegisterFactory(XPCOM.NS_PROMPTSERVICE_CID, aClassName, aContractID, factory.getAddress());
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- factory.Release();
-
- HelperAppLauncherDialogFactory dialogFactory = new HelperAppLauncherDialogFactory();
- dialogFactory.AddRef();
- aContractID = Converter.wcsToMbcs(null, XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID, true);
- aClassName = Converter.wcsToMbcs(null, "Helper App Launcher Dialog", true); //$NON-NLS-1$
- rc = componentRegistrar.RegisterFactory(XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CID, aClassName, aContractID, dialogFactory.getAddress());
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- dialogFactory.Release();
-
- DownloadFactory downloadFactory = new DownloadFactory();
- downloadFactory.AddRef();
- aContractID = Converter.wcsToMbcs(null, XPCOM.NS_DOWNLOAD_CONTRACTID, true);
- aClassName = Converter.wcsToMbcs(null, "Download", true); //$NON-NLS-1$
- rc = componentRegistrar.RegisterFactory(XPCOM.NS_DOWNLOAD_CID, aClassName, aContractID, downloadFactory.getAddress());
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- downloadFactory.Release();
-
- DownloadFactory_1_8 downloadFactory_1_8 = new DownloadFactory_1_8();
- downloadFactory_1_8.AddRef();
- aContractID = Converter.wcsToMbcs(null, XPCOM.NS_TRANSFER_CONTRACTID, true);
- aClassName = Converter.wcsToMbcs(null, "Transfer", true); //$NON-NLS-1$
- rc = componentRegistrar.RegisterFactory(XPCOM.NS_DOWNLOAD_CID, aClassName, aContractID, downloadFactory_1_8.getAddress());
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- downloadFactory_1_8.Release();
-
- FilePickerFactory pickerFactory = new FilePickerFactory();
- pickerFactory.AddRef();
- aContractID = Converter.wcsToMbcs(null, XPCOM.NS_FILEPICKER_CONTRACTID, true);
- aClassName = Converter.wcsToMbcs(null, "FilePicker", true); //$NON-NLS-1$
- rc = componentRegistrar.RegisterFactory(XPCOM.NS_FILEPICKER_CID, aClassName, aContractID, pickerFactory.getAddress());
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- pickerFactory.Release();
-
- componentRegistrar.Release();
- componentManager.Release();
- initialized = true;
- }
- BrowserCount++;
- if (BrowserCount == 1) {
- GTK.gtk_init_check(new int[1], null);
- final Display display = browser.getDisplay();
- display.asyncExec(new Runnable() {
- public void run() {
- if (BrowserCount == 0) return;
- while (GTK.gtk_events_pending() != 0) {
- GTK.gtk_main_iteration();
- }
- display.timerExec(25, this);
- }
- });
- }
- parent.getShell().setFocus();
- gtkHandle = GTK.gtk_plug_new(browser.embeddedHandle);
-
- int rc = XPCOM.NS_GetComponentManager(result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- nsIComponentManager componentManager = new nsIComponentManager(result[0]);
- result[0] = 0;
- nsID NS_IWEBBROWSER_CID = new nsID("F1EAC761-87E9-11d3-AF80-00A024FFC08C"); //$NON-NLS-1$
- rc = componentManager.CreateInstance(NS_IWEBBROWSER_CID, 0, nsIWebBrowser.NS_IWEBBROWSER_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
- componentManager.Release();
-
- webBrowser = new nsIWebBrowser(result[0]);
-
- createCOMInterfaces();
- AddRef();
-
- rc = webBrowser.SetContainerWindow(webBrowserChrome.getAddress());
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
-
- rc = webBrowser.QueryInterface(nsIBaseWindow.NS_IBASEWINDOW_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_ERROR_NO_INTERFACE);
- }
-
- nsIBaseWindow baseWindow = new nsIBaseWindow(result[0]);
- rc = baseWindow.InitWindow(gtkHandle, 0, 0, 0, 2, 2);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(XPCOM.NS_ERROR_FAILURE);
- }
- rc = baseWindow.Create();
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(XPCOM.NS_ERROR_FAILURE);
- }
- rc = baseWindow.SetVisibility(true);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(XPCOM.NS_ERROR_FAILURE);
- }
- baseWindow.Release();
-
- rc = webBrowser.AddWebBrowserListener(weakReference.getAddress(), nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
-
- rc = webBrowser.SetParentURIContentListener(uriContentListener.getAddress());
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
-
- rc = XPCOM.NS_GetServiceManager(result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- nsIServiceManager serviceManager = new nsIServiceManager(result[0]);
- result[0] = 0;
- byte[] buffer = Converter.wcsToMbcs(null, XPCOM.NS_DIRECTORYSERVICE_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID(buffer, nsIDirectoryService.NS_IDIRECTORYSERVICE_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- nsIDirectoryService directoryService = new nsIDirectoryService(result[0]);
- result[0] = 0;
- rc = directoryService.RegisterProvider(directoryServiceProviderListener.getAddress());
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- directoryService.Release();
-
- buffer = Converter.wcsToMbcs(null, XPCOM.NS_OBSERVER_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID(buffer, nsIObserverService.NS_IOBSERVERSERVICE_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
- serviceManager.Release();
-
- nsIObserverService observerService = new nsIObserverService(result[0]);
- result[0] = 0;
- buffer = Converter.wcsToMbcs(null, PROFILE_DO_CHANGE, true);
- int length = STARTUP.length();
- char[] chars = new char [length + 1];
- STARTUP.getChars(0, length, chars, 0);
- rc = observerService.NotifyObservers(0, buffer, chars);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- buffer = Converter.wcsToMbcs(null, PROFILE_AFTER_CHANGE, true);
- rc = observerService.NotifyObservers(0, buffer, chars);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- observerService.Release();
-
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Dispose: {
- /* make this handler run after other dispose listeners */
- if (ignoreDispose) {
- ignoreDispose = false;
- break;
- }
- ignoreDispose = true;
- browser.notifyListeners (event.type, event);
- event.type = SWT.NONE;
- onDispose();
- break;
- }
- case SWT.Resize: onResize(); break;
- case SWT.FocusIn: Activate(); break;
- case SWT.Deactivate: {
- Display display = event.display;
- if (browser == display.getFocusControl()) Deactivate();
- break;
- }
- }
- }
- };
- int[] folderEvents = new int[]{
- SWT.Dispose,
- SWT.Resize,
- SWT.FocusIn,
- SWT.KeyDown,
- SWT.Deactivate
- };
- for (int i = 0; i < folderEvents.length; i++) {
- browser.addListener(folderEvents[i], listener);
- }
-
- GTK.gtk_widget_show(gtkHandle);
-}
-
-public boolean back() {
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]);
- rc = webNavigation.GoBack();
- webNavigation.Release();
-
- return rc == XPCOM.NS_OK;
-}
-
-void createCOMInterfaces() {
- // Create each of the interfaces that this object implements
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- };
-
- weakReference = new XPCOMObject(new int[]{2, 0, 0, 2}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return QueryReferent(args[0], args[1]);}
- };
-
- webProgressListener = new XPCOMObject(new int[]{2, 0, 0, 4, 6, 3, 4, 3}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return OnStateChange(args[0], args[1], args[2],args[3]);}
- public int /*long*/ method4(int /*long*/[] args) {return OnProgressChange(args[0], args[1], args[2],args[3],args[4],args[5]);}
- public int /*long*/ method5(int /*long*/[] args) {return OnLocationChange(args[0], args[1], args[2]);}
- public int /*long*/ method6(int /*long*/[] args) {return OnStatusChange(args[0], args[1], args[2],args[3]);}
- public int /*long*/ method7(int /*long*/[] args) {return OnSecurityChange(args[0], args[1], args[2]);}
- };
-
- webBrowserChrome = new XPCOMObject(new int[]{2, 0, 0, 2, 1, 1, 1, 1, 0, 2, 0, 1, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return SetStatus(args[0], args[1]);}
- public int /*long*/ method4(int /*long*/[] args) {return GetWebBrowser(args[0]);}
- public int /*long*/ method5(int /*long*/[] args) {return SetWebBrowser(args[0]);}
- public int /*long*/ method6(int /*long*/[] args) {return GetChromeFlags(args[0]);}
- public int /*long*/ method7(int /*long*/[] args) {return SetChromeFlags(args[0]);}
- public int /*long*/ method8(int /*long*/[] args) {return DestroyBrowserWindow();}
- public int /*long*/ method9(int /*long*/[] args) {return SizeBrowserTo(args[0], args[1]);}
- public int /*long*/ method10(int /*long*/[] args) {return ShowAsModal();}
- public int /*long*/ method11(int /*long*/[] args) {return IsWindowModal(args[0]);}
- public int /*long*/ method12(int /*long*/[] args) {return ExitModalEventLoop(args[0]);}
- };
-
- webBrowserChromeFocus = new XPCOMObject(new int[]{2, 0, 0, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return FocusNextElement();}
- public int /*long*/ method4(int /*long*/[] args) {return FocusPrevElement();}
- };
-
- embeddingSiteWindow = new XPCOMObject(new int[]{2, 0, 0, 5, 5, 0, 1, 1, 1, 1, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return SetDimensions(args[0], args[1], args[2], args[3], args[4]);}
- public int /*long*/ method4(int /*long*/[] args) {return GetDimensions(args[0], args[1], args[2], args[3], args[4]);}
- public int /*long*/ method5(int /*long*/[] args) {return SetFocus();}
- public int /*long*/ method6(int /*long*/[] args) {return GetVisibility(args[0]);}
- public int /*long*/ method7(int /*long*/[] args) {return SetVisibility(args[0]);}
- public int /*long*/ method8(int /*long*/[] args) {return GetTitle(args[0]);}
- public int /*long*/ method9(int /*long*/[] args) {return SetTitle(args[0]);}
- public int /*long*/ method10(int /*long*/[] args) {return GetSiteWindow(args[0]);}
- };
-
- interfaceRequestor = new XPCOMObject(new int[]{2, 0, 0, 2}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return GetInterface(args[0], args[1]);}
- };
-
- supportsWeakReference = new XPCOMObject(new int[]{2, 0, 0, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return GetWeakReference(args[0]);}
- };
-
- contextMenuListener = new XPCOMObject(new int[]{2, 0, 0, 3}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return OnShowContextMenu(args[0],args[1],args[2]);}
- };
-
- uriContentListener = new XPCOMObject(new int[]{2, 0, 0, 2, 5, 3, 4, 1, 1, 1, 1}) {
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return OnStartURIOpen(args[0], args[1]);}
- public int /*long*/ method4(int /*long*/[] args) {return DoContent(args[0], args[1], args[2], args[3], args[4]);}
- public int /*long*/ method5(int /*long*/[] args) {return IsPreferred(args[0], args[1], args[2]);}
- public int /*long*/ method6(int /*long*/[] args) {return CanHandleContent(args[0], args[1], args[2], args[3]);}
- public int /*long*/ method7(int /*long*/[] args) {return GetLoadCookie(args[0]);}
- public int /*long*/ method8(int /*long*/[] args) {return SetLoadCookie(args[0]);}
- public int /*long*/ method9(int /*long*/[] args) {return GetParentContentListener(args[0]);}
- public int /*long*/ method10(int /*long*/[] args) {return SetParentContentListener(args[0]);}
- };
-
- tooltipListener = new XPCOMObject(new int[]{2, 0, 0, 3, 0}) {
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return OnShowTooltip(args[0], args[1], args[2]);}
- public int /*long*/ method4(int /*long*/[] args) {return OnHideTooltip();}
- };
-
- directoryServiceProviderListener = new XPCOMObject(new int[]{2, 0, 0, 3}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return GetFile(args[0], args[1], args[2]);}
- };
-}
-
-void disposeCOMInterfaces() {
- if (supports != null) {
- supports.dispose();
- supports = null;
- }
- if (weakReference != null) {
- weakReference.dispose();
- weakReference = null;
- }
- if (webProgressListener != null) {
- webProgressListener.dispose();
- webProgressListener = null;
- }
- if (webBrowserChrome != null) {
- webBrowserChrome.dispose();
- webBrowserChrome = null;
- }
- if (webBrowserChromeFocus != null) {
- webBrowserChromeFocus.dispose();
- webBrowserChromeFocus = null;
- }
- if (embeddingSiteWindow != null) {
- embeddingSiteWindow.dispose();
- embeddingSiteWindow = null;
- }
- if (interfaceRequestor != null) {
- interfaceRequestor.dispose();
- interfaceRequestor = null;
- }
- if (supportsWeakReference != null) {
- supportsWeakReference.dispose();
- supportsWeakReference = null;
- }
- if (contextMenuListener != null) {
- contextMenuListener.dispose();
- contextMenuListener = null;
- }
- if (uriContentListener != null) {
- uriContentListener.dispose();
- uriContentListener = null;
- }
- if (tooltipListener != null) {
- tooltipListener.dispose();
- tooltipListener = null;
- }
-}
-
-public boolean execute(String script) {
- String url = "javascript:" + script + ";void(0);"; //$NON-NLS-1$ //$NON-NLS-2$
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]);
- char[] arg = url.toCharArray();
- char[] c = new char[arg.length+1];
- System.arraycopy(arg,0,c,0,arg.length);
- rc = webNavigation.LoadURI(c, nsIWebNavigation.LOAD_FLAGS_NONE, 0, 0, 0);
- webNavigation.Release();
- return rc == XPCOM.NS_OK;
-}
-
-static Browser findBrowser(int /*long*/ handle) {
- Display display = Display.getCurrent();
- Shell[] shells = display.getShells();
- Browser browser = null;
- for (int i = 0; i < shells.length; i++) {
- browser = Mozilla.findBrowser(shells[i], handle);
- if (browser != null) break;
- }
- return browser;
-}
-
-static Browser findBrowser(Control control, int gtkHandle) {
- if (control instanceof Browser) {
- Browser browser = (Browser)control;
- if (((Mozilla)browser.webBrowser).gtkHandle == gtkHandle) return browser;
- }
- if (control instanceof Composite) {
- Composite composite = (Composite)control;
- Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++) {
- Browser browser = findBrowser(children[i], gtkHandle);
- if (browser != null) return browser;
- }
- }
- return null;
-}
-
-public boolean forward() {
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]);
- rc = webNavigation.GoForward();
- webNavigation.Release();
-
- return rc == XPCOM.NS_OK;
-}
-
-public String getUrl() {
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]);
- int /*long*/[] aCurrentURI = new int /*long*/[1];
- rc = webNavigation.GetCurrentURI(aCurrentURI);
- if (rc != XPCOM.NS_OK) error(rc);
- /*
- * This code is intentionally commented. aCurrentURI is 0
- * when no location has previously been set.
- */
- //if (aCurrentURI[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
- webNavigation.Release();
-
- byte[] dest = null;
- if (aCurrentURI[0] != 0) {
- nsIURI uri = new nsIURI(aCurrentURI[0]);
- int /*long*/ aSpec = XPCOM.nsEmbedCString_new();
- rc = uri.GetSpec(aSpec);
- if (rc != XPCOM.NS_OK) error(rc);
- int length = XPCOM.nsEmbedCString_Length(aSpec);
- int /*long*/ buffer = XPCOM.nsEmbedCString_get(aSpec);
- dest = new byte[length];
- XPCOM.memmove(dest, buffer, length);
- XPCOM.nsEmbedCString_delete(aSpec);
- uri.Release();
- }
- if (dest == null) return ""; //$NON-NLS-1$
- /*
- * If the URI indicates that the current page is being rendered from
- * memory (ie.- via setText()) then answer about:blank as the URL
- * to be consistent with win32.
- */
- String location = new String (dest);
- if (location.equals (URI_FROMMEMORY)) location = ABOUT_BLANK;
- return location;
-}
-
-public boolean isBackEnabled() {
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]);
- boolean[] aCanGoBack = new boolean[1];
- rc = webNavigation.GetCanGoBack(aCanGoBack);
- webNavigation.Release();
-
- return aCanGoBack[0];
-}
-
-public boolean isForwardEnabled() {
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]);
- boolean[] aCanGoForward = new boolean[1];
- rc = webNavigation.GetCanGoForward(aCanGoForward);
- webNavigation.Release();
-
- return aCanGoForward[0];
-}
-
-static String error(int code) {
- throw new SWTError("XPCOM error " + code); //$NON-NLS-1$
-}
-
-void onDispose() {
- int rc = webBrowser.RemoveWebBrowserListener(weakReference.getAddress(), nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID);
- if (rc != XPCOM.NS_OK) error(rc);
-
- rc = webBrowser.SetParentURIContentListener(0);
- if (rc != XPCOM.NS_OK) error(rc);
-
- int /*long*/[] result = new int /*long*/[1];
- rc = webBrowser.QueryInterface(nsIBaseWindow.NS_IBASEWINDOW_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIBaseWindow baseWindow = new nsIBaseWindow(result[0]);
- rc = baseWindow.Destroy();
- if (rc != XPCOM.NS_OK) error(rc);
- baseWindow.Release();
-
- Release();
- webBrowser.Release();
-
- if (tip != null && !tip.isDisposed()) tip.dispose();
- tip = null;
-
- GTK.gtk_widget_destroy(gtkHandle);
- while (GTK.gtk_events_pending() != 0) {
- GTK.gtk_main_iteration();
- }
- gtkHandle = 0;
-
- BrowserCount--;
-}
-
-void Activate() {
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIWebBrowserFocus.NS_IWEBBROWSERFOCUS_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebBrowserFocus webBrowserFocus = new nsIWebBrowserFocus(result[0]);
- rc = webBrowserFocus.Activate();
- if (rc != XPCOM.NS_OK) error(rc);
- webBrowserFocus.Release();
-}
-
-void Deactivate() {
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIWebBrowserFocus.NS_IWEBBROWSERFOCUS_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebBrowserFocus webBrowserFocus = new nsIWebBrowserFocus(result[0]);
- rc = webBrowserFocus.Deactivate();
- if (rc != XPCOM.NS_OK) error(rc);
- webBrowserFocus.Release();
-}
-
-void onResize() {
- Rectangle rect = browser.getClientArea();
- int width = Math.max(2, rect.width);
- int height = Math.max(2, rect.height);
-
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIBaseWindow.NS_IBASEWINDOW_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIBaseWindow baseWindow = new nsIBaseWindow(result[0]);
- rc = baseWindow.SetPositionAndSize(0, 0, width, height, true);
- if (rc != XPCOM.NS_OK) error(rc);
- baseWindow.Release();
-}
-
-public void refresh() {
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]);
- rc = webNavigation.Reload(nsIWebNavigation.LOAD_FLAGS_NONE);
- webNavigation.Release();
- if (rc == XPCOM.NS_OK) return;
- /*
- * Feature in Mozilla. Reload returns an error code NS_ERROR_INVALID_POINTER
- * when it is called immediately after a request to load a new document using
- * LoadURI. The workaround is to ignore this error code.
- *
- * Feature in Mozilla. Attempting to reload a file that no longer exists
- * returns an error code of NS_ERROR_FILE_NOT_FOUND. This is equivalent to
- * attempting to load a non-existent local url, which is not a Browser error,
- * so this error code should be ignored.
- */
- if (rc != XPCOM.NS_ERROR_INVALID_POINTER && rc != XPCOM.NS_ERROR_FILE_NOT_FOUND) error(rc);
-}
-
-public boolean setText(String html) {
- /*
- * Feature in Mozilla. The focus memory of Mozilla must be
- * properly managed through the nsIWebBrowserFocus interface.
- * In particular, nsIWebBrowserFocus.deactivate must be called
- * when the focus moves from the browser (or one of its children
- * managed by Mozilla to another widget. We currently do not
- * get notified when a widget takes focus away from the Browser.
- * As a result, deactivate is not properly called. This causes
- * Mozilla to retake focus the next time a document is loaded.
- * This breaks the case where the HTML loaded in the Browser
- * varies while the user enters characters in a text widget. The text
- * widget loses focus every time new content is loaded.
- * The current workaround is to call deactivate everytime if
- * the browser currently does not have focus. A better workaround
- * would be to have a way to call deactivate when the Browser
- * or one of its children loses focus.
- */
- if (browser != browser.getDisplay().getFocusControl()) Deactivate();
-
- /*
- * Convert the String containing HTML to an array of
- * bytes with UTF-8 data.
- */
- byte[] data = null;
- try {
- data = html.getBytes("UTF-8"); //$NON-NLS-1$
- } catch (UnsupportedEncodingException e) {
- return false;
- }
-
- int /*long*/[] result = new int /*long*/[1];
- int rc = XPCOM.NS_GetServiceManager(result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_NOINTERFACE);
-
- nsIServiceManager serviceManager = new nsIServiceManager(result[0]);
- result[0] = 0;
- rc = serviceManager.GetService(XPCOM.NS_IOSERVICE_CID, nsIIOService.NS_IIOSERVICE_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_NOINTERFACE);
- serviceManager.Release();
-
- nsIIOService ioService = new nsIIOService(result[0]);
- result[0] = 0;
- /*
- * Note. Mozilla ignores LINK tags used to load CSS stylesheets
- * when the URI protocol for the nsInputStreamChannel
- * is about:blank. The fix is to specify the file protocol.
- */
- byte[] aString = Converter.wcsToMbcs(null, URI_FROMMEMORY, false);
- int /*long*/ aSpec = XPCOM.nsEmbedCString_new(aString, aString.length);
- rc = ioService.NewURI(aSpec, null, 0, result);
- XPCOM.nsEmbedCString_delete(aSpec);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_NOINTERFACE);
- ioService.Release();
-
- nsIURI uri = new nsIURI(result[0]);
- result[0] = 0;
-
- /* aContentType */
- byte[] contentTypeBuffer = Converter.wcsToMbcs(null, "text/html", true); //$NON-NLS-1$
- int /*long*/ aContentType = XPCOM.nsEmbedCString_new(contentTypeBuffer, contentTypeBuffer.length);
-
- /*
- * First try to use nsIWebBrowserStream to set the text into the Browser, since this
- * interface is frozen. However, this may fail because this interface was only introduced
- * as of mozilla 1.8; if this interface is not found then use the pre-1.8 approach of
- * utilizing nsIDocShell instead.
- */
- result[0] = 0;
- rc = webBrowser.QueryInterface(nsIWebBrowserStream.NS_IWEBBROWSERSTREAM_IID, result);
- if (rc == XPCOM.NS_OK) {
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
- nsIWebBrowserStream stream = new nsIWebBrowserStream(result[0]);
- rc = stream.OpenStream(uri.getAddress(), aContentType);
- if (rc != XPCOM.NS_OK) error(rc);
- int ptr = OS.XtMalloc(data.length);
- XPCOM.memmove(ptr, data, data.length);
- int pageSize = 8192;
- int pageCount = data.length / pageSize + 1;
- int current = ptr;
- for (int i = 0; i < pageCount; i++) {
- int length = i == pageCount - 1 ? data.length % pageSize : pageSize;
- if (length > 0) {
- rc = stream.AppendToStream(current, length);
- if (rc != XPCOM.NS_OK) error(rc);
- }
- current += pageSize;
- }
- rc = stream.CloseStream();
- if (rc != XPCOM.NS_OK) error(rc);
- OS.XtFree(ptr);
- stream.Release();
- } else {
- rc = webBrowser.QueryInterface(nsIInterfaceRequestor.NS_IINTERFACEREQUESTOR_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIInterfaceRequestor interfaceRequestor = new nsIInterfaceRequestor(result[0]);
- result[0] = 0;
- rc = interfaceRequestor.GetInterface(nsIDocShell.NS_IDOCSHELL_IID, result);
- interfaceRequestor.Release();
-
- nsIDocShell docShell = new nsIDocShell(result[0]);
- result[0] = 0;
- byte[] contentCharsetBuffer = Converter.wcsToMbcs(null, "UTF-8", true); //$NON-NLS-1$
- int /*long*/ aContentCharset = XPCOM.nsEmbedCString_new(contentCharsetBuffer, contentCharsetBuffer.length);
-
- /*
- * Feature in Mozilla. LoadStream invokes the nsIInputStream argument
- * through a different thread. The callback mechanism must attach
- * a non java thread to the JVM otherwise the nsIInputStream Read and
- * Close methods never get called.
- */
- InputStream inputStream = new InputStream(data);
- inputStream.AddRef();
- rc = docShell.LoadStream(inputStream.getAddress(), uri.getAddress(), aContentType, aContentCharset, 0);
- if (rc != XPCOM.NS_OK) error(rc);
- XPCOM.nsEmbedCString_delete(aContentCharset);
- inputStream.Release();
- docShell.Release();
- }
-
- XPCOM.nsEmbedCString_delete(aContentType);
- uri.Release();
- return true;
-}
-
-public boolean setUrl(String url) {
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]);
- char[] arg = url.toCharArray();
- char[] c = new char[arg.length+1];
- System.arraycopy(arg,0,c,0,arg.length);
- rc = webNavigation.LoadURI(c, nsIWebNavigation.LOAD_FLAGS_NONE, 0, 0, 0);
- webNavigation.Release();
- return rc == XPCOM.NS_OK;
-}
-
-public void stop() {
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]);
- rc = webNavigation.Stop(nsIWebNavigation.STOP_ALL);
- if (rc != XPCOM.NS_OK) error(rc);
- webNavigation.Release();
-}
-
-/* nsISupports */
-
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
- if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
-
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
-
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, 4);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIWeakReference.NS_IWEAKREFERENCE_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {weakReference.getAddress()}, 4);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {webProgressListener.getAddress()}, 4);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIWebBrowserChrome.NS_IWEBBROWSERCHROME_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {webBrowserChrome.getAddress()}, 4);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIWebBrowserChromeFocus.NS_IWEBBROWSERCHROMEFOCUS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {webBrowserChromeFocus.getAddress()}, 4);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIEmbeddingSiteWindow.NS_IEMBEDDINGSITEWINDOW_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {embeddingSiteWindow.getAddress()}, 4);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIInterfaceRequestor.NS_IINTERFACEREQUESTOR_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {interfaceRequestor.getAddress()}, 4);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsISupportsWeakReference.NS_ISUPPORTSWEAKREFERENCE_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supportsWeakReference.getAddress()}, 4);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIContextMenuListener.NS_ICONTEXTMENULISTENER_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {contextMenuListener.getAddress()}, 4);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIURIContentListener.NS_IURICONTENTLISTENER_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {uriContentListener.getAddress()}, 4);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsITooltipListener.NS_ITOOLTIPLISTENER_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {tooltipListener.getAddress()}, 4);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIDirectoryServiceProvider.NS_IDIRECTORYSERVICEPROVIDER_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {directoryServiceProviderListener.getAddress()}, 4);
- AddRef();
- return XPCOM.NS_OK;
- }
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, 4);
- return XPCOM.NS_ERROR_NO_INTERFACE;
-}
-
-int /*long*/ AddRef() {
- refCount++;
- return refCount;
-}
-
-int /*long*/ Release() {
- refCount--;
- if (refCount == 0) disposeCOMInterfaces();
- return refCount;
-}
-
-/* nsIWeakReference */
-
-int /*long*/ QueryReferent(int /*long*/ riid, int /*long*/ ppvObject) {
- return QueryInterface(riid,ppvObject);
-}
-
-/* nsIInterfaceRequestor */
-
-int /*long*/ GetInterface(int /*long*/ riid, int /*long*/ ppvObject) {
- if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
- if (guid.Equals(nsIDOMWindow.NS_IDOMWINDOW_IID)) {
- int /*long*/[] aContentDOMWindow = new int /*long*/[1];
- int rc = webBrowser.GetContentDOMWindow(aContentDOMWindow);
- if (rc != XPCOM.NS_OK) error(rc);
- if (aContentDOMWindow[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
- XPCOM.memmove(ppvObject, aContentDOMWindow, 4);
- return rc;
- }
- return QueryInterface(riid,ppvObject);
-}
-
-int /*long*/ GetWeakReference(int /*long*/ ppvObject) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {weakReference.getAddress()}, 4);
- AddRef();
- return XPCOM.NS_OK;
-}
-
-/* nsIWebProgressListener */
-
-int /*long*/ OnStateChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aStateFlags, int /*long*/ aStatus) {
- if ((aStateFlags & nsIWebProgressListener.STATE_IS_DOCUMENT) == 0) return XPCOM.NS_OK;
- if ((aStateFlags & nsIWebProgressListener.STATE_START) != 0) {
- if (request == 0) request = aRequest;
- } else if ((aStateFlags & nsIWebProgressListener.STATE_REDIRECTING) != 0) {
- if (request == aRequest) request = 0;
- } else if ((aStateFlags & nsIWebProgressListener.STATE_STOP) != 0) {
- /*
- * Feature on Mozilla. When a request is redirected (STATE_REDIRECTING),
- * it never reaches the state STATE_STOP and it is replaced with a new request.
- * The new request is received when it is in the state STATE_STOP.
- * To handle this case, the variable request is set to 0 when the corresponding
- * request is redirected. The following request received with the state STATE_STOP
- * - the new request resulting from the redirection - is used to send
- * the ProgressListener.completed event.
- */
- if (request == aRequest || request == 0) {
- request = 0;
- StatusTextEvent event = new StatusTextEvent(browser);
- event.display = browser.getDisplay();
- event.widget = browser;
- event.text = ""; //$NON-NLS-1$
- for (int i = 0; i < statusTextListeners.length; i++)
- statusTextListeners[i].changed(event);
-
- ProgressEvent event2 = new ProgressEvent(browser);
- event2.display = browser.getDisplay();
- event2.widget = browser;
- for (int i = 0; i < progressListeners.length; i++)
- progressListeners[i].completed(event2);
- }
- }
- return XPCOM.NS_OK;
-}
-
-int /*long*/ OnProgressChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aCurSelfProgress, int /*long*/ aMaxSelfProgress, int /*long*/ aCurTotalProgress, int /*long*/ aMaxTotalProgress) {
- if (progressListeners.length == 0) return XPCOM.NS_OK;
- ProgressEvent event = new ProgressEvent(browser);
- event.display = browser.getDisplay();
- event.widget = browser;
- event.current = (int)/*64*/aCurTotalProgress;
- event.total = (int)/*64*/aMaxTotalProgress;
- for (int i = 0; i < progressListeners.length; i++) {
- progressListeners[i].changed(event);
- }
- return XPCOM.NS_OK;
-}
-
-int /*long*/ OnLocationChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aLocation) {
- /*
- * Feature on Mozilla. When a page is loaded via setText before a previous
- * setText page load has completed, the expected OnStateChange STATE_STOP for the
- * original setText never arrives because it gets replaced by the OnStateChange
- * STATE_STOP for the new request. This results in the request field never being
- * cleared because the original request's OnStateChange STATE_STOP is still expected
- * (but never arrives). To handle this case, the request field is updated to the new
- * overriding request since its OnStateChange STATE_STOP will be received next.
- */
- if (request != 0 && request != aRequest) request = aRequest;
-
- if (locationListeners.length == 0) return XPCOM.NS_OK;
-
- nsIWebProgress webProgress = new nsIWebProgress(aWebProgress);
- int /*long*/[] aDOMWindow = new int /*long*/[1];
- int rc = webProgress.GetDOMWindow(aDOMWindow);
- if (rc != XPCOM.NS_OK) error(rc);
- if (aDOMWindow[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIDOMWindow domWindow = new nsIDOMWindow(aDOMWindow[0]);
- int /*long*/[] aTop = new int /*long*/[1];
- rc = domWindow.GetTop(aTop);
- if (rc != XPCOM.NS_OK) error(rc);
- if (aTop[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
- domWindow.Release();
-
- nsIDOMWindow topWindow = new nsIDOMWindow(aTop[0]);
- topWindow.Release();
-
- nsIURI location = new nsIURI(aLocation);
- int /*long*/ aSpec = XPCOM.nsEmbedCString_new();
- location.GetSpec(aSpec);
- int length = XPCOM.nsEmbedCString_Length(aSpec);
- int /*long*/ buffer = XPCOM.nsEmbedCString_get(aSpec);
- byte[] dest = new byte[length];
- XPCOM.memmove(dest, buffer, length);
- XPCOM.nsEmbedCString_delete(aSpec);
-
- LocationEvent event = new LocationEvent(browser);
- event.display = browser.getDisplay();
- event.widget = browser;
- event.location = new String(dest);
- if (event.location.equals (URI_FROMMEMORY)) {
- /*
- * If the URI indicates that the page is being rendered from memory
- * (ie.- via setText()) then set the event location to about:blank
- * to be consistent with win32.
- */
- event.location = ABOUT_BLANK;
- }
- event.top = aTop[0] == aDOMWindow[0];
- for (int i = 0; i < locationListeners.length; i++) {
- locationListeners[i].changed(event);
- }
- return XPCOM.NS_OK;
-}
-
-int /*long*/ OnStatusChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aStatus, int /*long*/ aMessage) {
- if (statusTextListeners.length == 0) return XPCOM.NS_OK;
- StatusTextEvent event = new StatusTextEvent(browser);
- event.display = browser.getDisplay();
- event.widget = browser;
- int length = XPCOM.strlen_PRUnichar(aMessage);
- char[] dest = new char[length];
- XPCOM.memmove(dest, aMessage, length * 2);
- event.text = new String(dest);
- for (int i = 0; i < statusTextListeners.length; i++) {
- statusTextListeners[i].changed(event);
- }
- return XPCOM.NS_OK;
-}
-
-int /*long*/ OnSecurityChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ state) {
- return XPCOM.NS_OK;
-}
-
-/* nsIWebBrowserChrome */
-
-int /*long*/ SetStatus(int /*long*/ statusType, int /*long*/ status) {
- StatusTextEvent event = new StatusTextEvent(browser);
- event.display = browser.getDisplay();
- event.widget = browser;
- int length = XPCOM.strlen_PRUnichar(status);
- char[] dest = new char[length];
- XPCOM.memmove(dest, status, length * 2);
- String string = new String(dest);
- event.text = string;
- for (int i = 0; i < statusTextListeners.length; i++) {
- statusTextListeners[i].changed(event);
- }
- return XPCOM.NS_OK;
-}
-
-int /*long*/ GetWebBrowser(int /*long*/ aWebBrowser) {
- int /*long*/[] ret = new int /*long*/[1];
- if (webBrowser != null) {
- webBrowser.AddRef();
- ret[0] = webBrowser.getAddress();
- }
- XPCOM.memmove(aWebBrowser, ret, 4);
- return XPCOM.NS_OK;
-}
-
-int /*long*/ SetWebBrowser(int /*long*/ aWebBrowser) {
- if (webBrowser != null) webBrowser.Release();
- webBrowser = aWebBrowser != 0 ? new nsIWebBrowser(aWebBrowser) : null;
- return XPCOM.NS_OK;
-}
-
-int /*long*/ GetChromeFlags(int /*long*/ aChromeFlags) {
- int[] ret = new int[1];
- ret[0] = chromeFlags;
- /* aChromeFlags is a pointer to a type of size 4 */
- XPCOM.memmove(aChromeFlags, ret, 4);
- return XPCOM.NS_OK;
-}
-
-int /*long*/ SetChromeFlags(int /*long*/ aChromeFlags) {
- chromeFlags = (int)/*64*/aChromeFlags;
- return XPCOM.NS_OK;
-}
-
-int /*long*/ DestroyBrowserWindow() {
- WindowEvent newEvent = new WindowEvent(browser);
- newEvent.display = browser.getDisplay();
- newEvent.widget = browser;
- for (int i = 0; i < closeWindowListeners.length; i++) {
- closeWindowListeners[i].close(newEvent);
- }
- /*
- * Note on Mozilla. The DestroyBrowserWindow notification cannot be cancelled.
- * The browser widget cannot be used after this notification has been received.
- * The application is advised to close the window hosting the browser widget.
- * The browser widget must be disposed in all cases.
- */
- browser.dispose();
- return XPCOM.NS_OK;
-}
-
-int /*long*/ SizeBrowserTo(int /*long*/ aCX, int /*long*/ aCY) {
- size = new Point((int)/*64*/aCX, (int)/*64*/aCY);
- return XPCOM.NS_OK;
-}
-
-int /*long*/ ShowAsModal() {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-int /*long*/ IsWindowModal(int /*long*/ retval) {
- // no modal loop
- /* Note. boolean remains of size 4 on 64 bit machine */
- XPCOM.memmove(retval, new int[] {0}, 4);
- return XPCOM.NS_OK;
-}
-
-int /*long*/ ExitModalEventLoop(int /*long*/ aStatus) {
- return XPCOM.NS_OK;
-}
-
-/* nsIEmbeddingSiteWindow */
-
-int /*long*/ SetDimensions(int /*long*/ flags, int /*long*/ x, int /*long*/ y, int /*long*/ cx, int /*long*/ cy) {
- if (flags == nsIEmbeddingSiteWindow.DIM_FLAGS_POSITION) location = new Point((int)/*64*/x, (int)/*64*/y);
- return XPCOM.NS_OK;
-}
-
-int /*long*/ GetDimensions(int /*long*/ flags, int /*long*/ x, int /*long*/ y, int /*long*/ cx, int /*long*/ cy) {
- return XPCOM.NS_OK;
-}
-
-int /*long*/ SetFocus() {
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIBaseWindow.NS_IBASEWINDOW_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIBaseWindow baseWindow = new nsIBaseWindow(result[0]);
- rc = baseWindow.SetFocus();
- if (rc != XPCOM.NS_OK) error(rc);
- baseWindow.Release();
-
- /*
- * Note. Mozilla notifies here that one of the children took
- * focus. This could or should be used to fire an SWT.FOCUS_IN
- * event on Browser focus listeners.
- */
- return XPCOM.NS_OK;
-}
-
-int /*long*/ GetVisibility(int /*long*/ aVisibility) {
- XPCOM.memmove(aVisibility, new int[] {browser.isVisible() ? 1 : 0}, 4);
- return XPCOM.NS_OK;
-}
-
-int /*long*/ SetVisibility(int /*long*/ aVisibility) {
- WindowEvent event = new WindowEvent(browser);
- event.display = browser.getDisplay();
- event.widget = browser;
- if (aVisibility == 1) {
- /*
- * Bug in Mozilla. When the JavaScript window.open is executed, Mozilla
- * fires multiple SetVisibility 1 notifications. The workaround is
- * to ignore subsequent notifications.
- */
- if (!visible) {
- visible = true;
- event.location = location;
- event.size = size;
- event.addressBar = addressBar;
- event.menuBar = menuBar;
- event.statusBar = statusBar;
- event.toolBar = toolBar;
- for (int i = 0; i < visibilityWindowListeners.length; i++)
- visibilityWindowListeners[i].show(event);
- location = null;
- size = null;
- }
- } else {
- visible = false;
- for (int i = 0; i < visibilityWindowListeners.length; i++) {
- visibilityWindowListeners[i].hide(event);
- }
- }
- return XPCOM.NS_OK;
-}
-
-int /*long*/ GetTitle(int /*long*/ aTitle) {
- return XPCOM.NS_OK;
-}
-
-int /*long*/ SetTitle(int /*long*/ aTitle) {
- if (titleListeners.length == 0) return XPCOM.NS_OK;
- TitleEvent event = new TitleEvent(browser);
- event.display = browser.getDisplay();
- event.widget = browser;
- /*
- * To be consistent with other platforms the title event should
- * contain the page's url if the page does not contain a <title>
- * tag.
- */
- int length = XPCOM.strlen_PRUnichar(aTitle);
- if (length > 0) {
- char[] dest = new char[length];
- XPCOM.memmove(dest, aTitle, length * 2);
- event.title = new String(dest);
- } else {
- event.title = getUrl();
- }
- for (int i = 0; i < titleListeners.length; i++) {
- titleListeners[i].changed(event);
- }
- return XPCOM.NS_OK;
-}
-
-int /*long*/ GetSiteWindow(int /*long*/ aSiteWindow) {
- /*
- * Note. The handle is expected to be an HWND on Windows and
- * a GtkWidget* on GTK. This callback is invoked on Windows
- * when the javascript window.print is invoked and the print
- * dialog comes up. If no handle is returned, the print dialog
- * does not come up on this platform.
- */
- XPCOM.memmove(aSiteWindow, new int /*long*/[] {gtkHandle}, 4);
- return XPCOM.NS_OK;
-}
-
-/* nsIWebBrowserChromeFocus */
-
-int /*long*/ FocusNextElement() {
- /*
- * Bug in Mozilla embedding API. Mozilla takes back the focus after sending
- * this event. This prevents tabbing out of Mozilla. This behaviour can be reproduced
- * with the Mozilla application TestGtkEmbed. The workaround is to
- * send the traversal notification after this callback returns.
- */
- browser.getDisplay().asyncExec(new Runnable() {
- public void run() {
- browser.traverse(SWT.TRAVERSE_TAB_NEXT);
- }
- });
- return XPCOM.NS_OK;
-}
-
-int /*long*/ FocusPrevElement() {
- /*
- * Bug in Mozilla embedding API. Mozilla takes back the focus after sending
- * this event. This prevents tabbing out of Mozilla. This behaviour can be reproduced
- * with the Mozilla application TestGtkEmbed. The workaround is to
- * send the traversal notification after this callback returns.
- */
- browser.getDisplay().asyncExec(new Runnable() {
- public void run() {
- browser.traverse(SWT.TRAVERSE_TAB_PREVIOUS);
- }
- });
- return XPCOM.NS_OK;
-}
-
-/* nsIContextMenuListener */
-
-int /*long*/ OnShowContextMenu(int /*long*/ aContextFlags, int /*long*/ aEvent, int /*long*/ aNode) {
- nsIDOMEvent domEvent = new nsIDOMEvent(aEvent);
- int /*long*/[] result = new int /*long*/[1];
- int rc = domEvent.QueryInterface(nsIDOMMouseEvent.NS_IDOMMOUSEEVENT_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_NOINTERFACE);
-
- nsIDOMMouseEvent domMouseEvent = new nsIDOMMouseEvent(result[0]);
- int[] aScreenX = new int[1], aScreenY = new int[1];
- rc = domMouseEvent.GetScreenX(aScreenX);
- if (rc != XPCOM.NS_OK) error(rc);
- rc = domMouseEvent.GetScreenY(aScreenY);
- if (rc != XPCOM.NS_OK) error(rc);
- domMouseEvent.Release();
-
- Event event = new Event();
- event.x = aScreenX[0];
- event.y = aScreenY[0];
- browser.notifyListeners(SWT.MenuDetect, event);
- if (!event.doit) return XPCOM.NS_OK;
- Menu menu = browser.getMenu();
- if (menu != null && !menu.isDisposed ()) {
- if (aScreenX[0] != event.x || aScreenY[0] != event.y) {
- menu.setLocation (event.x, event.y);
- }
- menu.setVisible (true);
- }
- return XPCOM.NS_OK;
-}
-
-/* nsIURIContentListener */
-
-int /*long*/ OnStartURIOpen(int /*long*/ aURI, int /*long*/ retval) {
- nsIURI location = new nsIURI(aURI);
- int /*long*/ aSpec = XPCOM.nsEmbedCString_new();
- location.GetSpec(aSpec);
- int length = XPCOM.nsEmbedCString_Length(aSpec);
- int /*long*/ buffer = XPCOM.nsEmbedCString_get(aSpec);
- buffer = XPCOM.nsEmbedCString_get(aSpec);
- byte[] dest = new byte[length];
- XPCOM.memmove(dest, buffer, length);
- XPCOM.nsEmbedCString_delete(aSpec);
- String value = new String(dest);
- if (locationListeners.length == 0) {
- XPCOM.memmove(retval, new int[] {0}, 4);
- return XPCOM.NS_OK;
- }
- boolean doit = true;
- if (request == 0) {
- LocationEvent event = new LocationEvent(browser);
- event.display = browser.getDisplay();
- event.widget = browser;
- event.location = value;
- if (event.location.equals (URI_FROMMEMORY)) {
- /*
- * If the URI indicates that the page is being rendered from memory
- * (ie.- via setText()) then set the event location to about:blank
- * to be consistent with win32.
- */
- event.location = ABOUT_BLANK;
- }
- event.doit = doit;
- for (int i = 0; i < locationListeners.length; i++) {
- locationListeners[i].changing(event);
- }
- doit = event.doit;
- }
- /* Note. boolean remains of size 4 on 64 bit machine */
- XPCOM.memmove(retval, new int[] {doit ? 0 : 1}, 4);
- return XPCOM.NS_OK;
-}
-
-int /*long*/ DoContent(int /*long*/ aContentType, int /*long*/ aIsContentPreferred, int /*long*/ aRequest, int /*long*/ aContentHandler, int /*long*/ retval) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-int /*long*/ IsPreferred(int /*long*/ aContentType, int /*long*/ aDesiredContentType, int /*long*/ retval) {
- boolean preferred = false;
- int size = XPCOM.strlen(aContentType);
- if (size > 0) {
- byte[] typeBytes = new byte[size + 1];
- XPCOM.memmove(typeBytes, aContentType, size);
- String contentType = new String(typeBytes);
-
- /* do not attempt to handle known problematic content types */
- if (!contentType.equals(XPCOM.CONTENT_MAYBETEXT) && !contentType.equals(XPCOM.CONTENT_MULTIPART)) {
- /* determine whether browser can handle the content type */
- int[] result = new int[1];
- int rc = XPCOM.NS_GetServiceManager(result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_NOINTERFACE);
- nsIServiceManager serviceManager = new nsIServiceManager(result[0]);
- result[0] = 0;
- rc = serviceManager.GetService(XPCOM.NS_CATEGORYMANAGER_CID, nsICategoryManager.NS_ICATEGORYMANAGER_IID, result);
- serviceManager.Release();
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_NOINTERFACE);
-
- nsICategoryManager categoryManager = new nsICategoryManager(result[0]);
- result[0] = 0;
- byte[] categoryBytes = Converter.wcsToMbcs(null, "Gecko-Content-Viewers", true); //$NON-NLS-1$
- rc = categoryManager.GetCategoryEntry(categoryBytes, typeBytes, result);
- categoryManager.Release();
- /* if no viewer for the content type is registered then rc == XPCOM.NS_ERROR_NOT_AVAILABLE */
- preferred = rc == XPCOM.NS_OK;
- }
- }
-
- /* note that boolean remains of size 4 on 64 bit machines */
- XPCOM.memmove(retval, new int[] {preferred ? 1 : 0}, 4);
- return XPCOM.NS_OK;
-}
-
-int /*long*/ CanHandleContent(int /*long*/ aContentType, int /*long*/ aIsContentPreferred, int /*long*/ aDesiredContentType, int /*long*/ retval) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-int /*long*/ GetLoadCookie(int /*long*/ aLoadCookie) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-int /*long*/ SetLoadCookie(int /*long*/ aLoadCookie) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-int /*long*/ GetParentContentListener(int /*long*/ aParentContentListener) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-int /*long*/ SetParentContentListener(int /*long*/ aParentContentListener) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* nsITooltipListener */
-
-int /*long*/ OnShowTooltip(int /*long*/ aXCoords, int /*long*/ aYCoords, int /*long*/ aTipText) {
- int length = XPCOM.strlen_PRUnichar(aTipText);
- char[] dest = new char[length];
- XPCOM.memmove(dest, aTipText, length * 2);
- String text = new String(dest);
- if (tip != null && !tip.isDisposed()) tip.dispose();
- Display display = browser.getDisplay();
- Shell parent = browser.getShell();
- tip = new Shell(parent, SWT.ON_TOP);
- tip.setLayout(new FillLayout());
- Label label = new Label(tip, SWT.CENTER);
- label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
- label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- label.setText(text);
- /*
- * Bug in Mozilla embedded API. Tooltip coordinates are wrong for
- * elements inside an inline frame (IFrame tag). The workaround is
- * to position the tooltip based on the mouse cursor location.
- */
- Point point = display.getCursorLocation();
- /* Assuming cursor is 21x21 because this is the size of
- * the arrow cursor on Windows
- */
- point.y += 21;
- tip.setLocation(point);
- tip.pack();
- tip.setVisible(true);
- return XPCOM.NS_OK;
-}
-
-int /*long*/ OnHideTooltip() {
- if (tip != null && !tip.isDisposed()) tip.dispose();
- tip = null;
- return XPCOM.NS_OK;
-}
-
-/* nsIDirectoryServiceProvider */
-
-int /*long*/ GetFile(int /*long*/ prop, int /*long*/ persistent, int /*long*/ retVal) {
- int size = XPCOM.strlen(prop);
- byte[] bytes = new byte[size];
- XPCOM.memmove(bytes, prop, size);
- String propertyName = new String(Converter.mbcsToWcs(null, bytes));
- String propertyValue = null;
-
- if (propertyName.equals(XPCOM.NS_APP_HISTORY_50_FILE)) {
- propertyValue = profileRootDirectory + HISTORY_FILE;
- } else if (propertyName.equals(XPCOM.NS_APP_USER_MIMETYPES_50_FILE)) {
- propertyValue = profileRootDirectory + MIMETYPES_FILE;
- } else if (propertyName.equals(XPCOM.NS_APP_PREFS_50_FILE)) {
- propertyValue = profileRootDirectory + PREFERENCES_FILE;
- } else if (propertyName.equals(XPCOM.NS_APP_PREFS_50_DIR)) {
- propertyValue = profileRootDirectory;
- } else if (propertyName.equals(XPCOM.NS_APP_USER_CHROME_DIR)) {
- propertyValue = profileRootDirectory + CHROME_DIR;
- } else if (propertyName.equals(XPCOM.NS_APP_USER_PROFILE_50_DIR)) {
- propertyValue = profileRootDirectory;
- } else if (propertyName.equals(XPCOM.NS_APP_LOCALSTORE_50_FILE)) {
- propertyValue = profileRootDirectory + LOCALSTORE_FILE;
- } else if (propertyName.equals(XPCOM.NS_APP_CACHE_PARENT_DIR)) {
- propertyValue = profileRootDirectory;
- } else if (propertyName.equals(XPCOM.NS_OS_HOME_DIR)) {
- propertyValue = System.getProperty("user.home"); //$NON-NLS-1$
- } else if (propertyName.equals(XPCOM.NS_OS_TEMP_DIR)) {
- propertyValue = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$
- }
-
- if (propertyValue != null && propertyValue.length() > 0) {
- int /*long*/[] result = new int /*long*/[1];
- nsEmbedString pathString = new nsEmbedString(propertyValue);
- int rc = XPCOM.NS_NewLocalFile(pathString.getAddress(), true, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NULL_POINTER);
- pathString.dispose();
- XPCOM.memmove(retVal, new int /*long*/[] {result[0]}, 4);
- /* note that boolean remains of size 4 on 64 bit machines */
- XPCOM.memmove(persistent, new int[] {1}, 4);
- }
-
- return XPCOM.NS_OK;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/MozillaDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/MozillaDelegate.java
new file mode 100644
index 0000000000..aea74b0d81
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/MozillaDelegate.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.browser;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.GTK;
+import org.eclipse.swt.widgets.*;
+
+class MozillaDelegate {
+ Browser browser;
+ static boolean gtkLoaded;
+
+ static boolean IsLinux;
+ static {
+ String osName = System.getProperty ("os.name").toLowerCase (); //$NON-NLS-1$
+ IsLinux = osName.startsWith ("linux"); //$NON-NLS-1$
+ }
+
+MozillaDelegate (Browser browser) {
+ super ();
+ if (!IsLinux) {
+ browser.dispose ();
+ SWT.error (SWT.ERROR_NO_HANDLES, null, " [Unsupported platform]"); //$NON-NLS-1$
+ }
+ this.browser = browser;
+
+ if (!gtkLoaded) {
+ gtkLoaded = true;
+ try {
+ Library.loadLibrary ("swt-gtk"); //$NON-NLS-1$
+ } catch (UnsatisfiedLinkError e) {
+ browser.dispose ();
+ SWT.error (SWT.ERROR_NO_HANDLES, e);
+ }
+ }
+
+}
+
+static Browser findBrowser (int handle) {
+ Display display = Display.getCurrent ();
+ Shell[] shells = display.getShells ();
+ Browser browser = null;
+ for (int i = 0; i < shells.length; i++) {
+ browser = findBrowser (shells[i], handle);
+ if (browser != null) break;
+ }
+ return browser;
+}
+
+static Browser findBrowser (Control control, int gtkHandle) {
+ if (control instanceof Browser) {
+ Browser browser = (Browser)control;
+ WebBrowser webBrowser = browser.webBrowser;
+ if (webBrowser instanceof Mozilla) {
+ if (((Mozilla)webBrowser).embedHandle == gtkHandle) return browser;
+ }
+ }
+ if (control instanceof Composite) {
+ Composite composite = (Composite)control;
+ Control[] children = composite.getChildren ();
+ for (int i = 0; i < children.length; i++) {
+ Browser browser = findBrowser (children[i], gtkHandle);
+ if (browser != null) return browser;
+ }
+ }
+ return null;
+}
+
+public static char[] mbcsToWcs (String codePage, byte [] buffer) {
+ return Converter.mbcsToWcs (codePage, buffer);
+}
+
+public static byte[] wcsToMbcs (String codePage, String string, boolean terminate) {
+ return Converter.wcsToMbcs (codePage, string, terminate);
+}
+
+int getHandle() {
+ if (Mozilla.BrowserCount == 1) {
+ GTK.gtk_init_check (new int[1], null);
+ final Display display = browser.getDisplay ();
+ display.asyncExec (new Runnable () {
+ public void run () {
+ if (Mozilla.BrowserCount == 0) return;
+ while (GTK.gtk_events_pending () != 0) {
+ GTK.gtk_main_iteration ();
+ }
+ display.timerExec (25, this);
+ }
+ });
+ }
+ browser.getShell ().setFocus ();
+ int result = GTK.gtk_plug_new (browser.embeddedHandle);
+ GTK.gtk_widget_show (result);
+ return result;
+}
+
+void onDispose (int embedHandle) {
+ GTK.gtk_widget_destroy (embedHandle);
+ while (GTK.gtk_events_pending () != 0) {
+ GTK.gtk_main_iteration ();
+ }
+}
+
+void setSize(int embedHandle, int width, int height) {
+ // TODO?
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/PromptDialog.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/PromptDialog.java
deleted file mode 100644
index 2275833456..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/PromptDialog.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.browser;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-class PromptDialog extends Dialog {
-
- public PromptDialog(Shell parent, int style) {
- super(parent, style);
- }
-
- public PromptDialog(Shell parent) {
- this(parent, 0);
- }
-
- public void confirmEx(String title, String text, String check, String button1, String button2, String button3, final int[] checkValue, final int[] result) {
- Shell parent = getParent();
- final Shell shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
- shell.setText(title);
- GridLayout gridLayout = new GridLayout();
- shell.setLayout(gridLayout);
- Label label = new Label(shell, SWT.WRAP);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- label.setLayoutData (data);
-
- final Button[] buttons = new Button[4];
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- if (buttons[0] != null) checkValue[0] = buttons[0].getSelection() ? 1 : 0;
- Widget widget = event.widget;
- for (int i = 1; i < buttons.length; i++) {
- if (widget == buttons[i]) {
- result[0] = i - 1;
- break;
- }
- }
- shell.close();
- }
- };
- if (check != null) {
- buttons[0] = new Button(shell, SWT.CHECK);
- buttons[0].setText(check);
- buttons[0].setSelection(checkValue[0] != 0);
- data = new GridData ();
- data.horizontalAlignment = GridData.END;
- buttons[0].setLayoutData (data);
- }
- Composite composite = new Composite(shell, SWT.NONE);
- data = new GridData();
- data.horizontalAlignment = GridData.END;
- composite.setLayoutData (data);
- composite.setLayout(new RowLayout());
- if (button1 != null) {
- buttons[1] = new Button(composite, SWT.PUSH);
- buttons[1].setText(button1);
- buttons[1].addListener(SWT.Selection, listener);
- }
- if (button2 != null) {
- buttons[2] = new Button(composite, SWT.PUSH);
- buttons[2].setText(button2);
- buttons[2].addListener(SWT.Selection, listener);
- }
- if (button3 != null) {
- buttons[3] = new Button(composite, SWT.PUSH);
- buttons[3].setText(button3);
- buttons[3].addListener(SWT.Selection, listener);
- }
- shell.pack();
- shell.open();
- Display display = parent.getDisplay();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- }
-
- public void prompt(String title, String text, String check, final String[] value, final int[] checkValue, final int[] result) {
- Shell parent = getParent();
- final Shell shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
- if (title != null) shell.setText(title);
- GridLayout gridLayout = new GridLayout();
- shell.setLayout(gridLayout);
- Label label = new Label(shell, SWT.WRAP);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- label.setLayoutData (data);
-
- final Text valueText = new Text(shell, SWT.BORDER);
- if (value[0] != null) valueText.setText(value[0]);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- valueText.setLayoutData(data);
-
- final Button[] buttons = new Button[3];
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- if (buttons[0] != null) checkValue[0] = buttons[0].getSelection() ? 1 : 0;
- value[0] = valueText.getText();
- result[0] = event.widget == buttons[1] ? 1 : 0;
- shell.close();
- }
- };
- if (check != null) {
- buttons[0] = new Button(shell, SWT.CHECK);
- buttons[0].setText(check);
- buttons[0].setSelection(checkValue[0] != 0);
- data = new GridData ();
- data.horizontalAlignment = GridData.END;
- buttons[0].setLayoutData (data);
- }
- Composite composite = new Composite(shell, SWT.NONE);
- data = new GridData();
- data.horizontalAlignment = GridData.END;
- composite.setLayoutData (data);
- composite.setLayout(new GridLayout(2, true));
- buttons[1] = new Button(composite, SWT.PUSH);
- buttons[1].setText(SWT.getMessage("SWT_OK")); //$NON-NLS-1$
- buttons[1].setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- buttons[1].addListener(SWT.Selection, listener);
- buttons[2] = new Button(composite, SWT.PUSH);
- buttons[2].setText(SWT.getMessage("SWT_Cancel")); //$NON-NLS-1$
- buttons[2].setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- buttons[2].addListener(SWT.Selection, listener);
-
- shell.pack();
- shell.open();
- Display display = parent.getDisplay();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- }
- public void promptUsernameAndPassword(String title, String text, String check, final String[] user, final String[] pass, final int[] checkValue, final int[] result) {
- Shell parent = getParent();
- final Shell shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
- shell.setText(title);
- GridLayout gridLayout = new GridLayout();
- shell.setLayout(gridLayout);
- Label label = new Label(shell, SWT.WRAP);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- label.setLayoutData (data);
-
- Label userLabel = new Label(shell, SWT.NONE);
- userLabel.setText(SWT.getMessage("SWT_Username")); //$NON-NLS-1$
-
- final Text userText = new Text(shell, SWT.BORDER);
- if (user[0] != null) userText.setText(user[0]);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- userText.setLayoutData(data);
-
- Label passwordLabel = new Label(shell, SWT.NONE);
- passwordLabel.setText(SWT.getMessage("SWT_Password")); //$NON-NLS-1$
-
- final Text passwordText = new Text(shell, SWT.PASSWORD | SWT.BORDER);
- if (pass[0] != null) passwordText.setText(pass[0]);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- passwordText.setLayoutData(data);
-
- final Button[] buttons = new Button[3];
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- if (buttons[0] != null) checkValue[0] = buttons[0].getSelection() ? 1 : 0;
- user[0] = userText.getText();
- pass[0] = passwordText.getText();
- result[0] = event.widget == buttons[1] ? 1 : 0;
- shell.close();
- }
- };
- if (check != null) {
- buttons[0] = new Button(shell, SWT.CHECK);
- buttons[0].setText(check);
- buttons[0].setSelection(checkValue[0] != 0);
- data = new GridData ();
- buttons[0].setLayoutData (data);
- }
- Composite composite = new Composite(shell, SWT.NONE);
- data = new GridData();
- data.horizontalAlignment = GridData.END;
- composite.setLayoutData (data);
- composite.setLayout(new GridLayout(2, true));
- buttons[1] = new Button(composite, SWT.PUSH);
- buttons[1].setText(SWT.getMessage("SWT_OK")); //$NON-NLS-1$
- buttons[1].setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- buttons[1].addListener(SWT.Selection, listener);
- buttons[2] = new Button(composite, SWT.PUSH);
- buttons[2].setText(SWT.getMessage("SWT_Cancel")); //$NON-NLS-1$
- buttons[2].setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- buttons[2].addListener(SWT.Selection, listener);
-
- shell.setDefaultButton(buttons[1]);
- shell.pack();
- shell.open();
- Display display = parent.getDisplay();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) display.sleep();
- }
- }
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/PromptService.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/PromptService.java
deleted file mode 100644
index ffd45f5334..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/PromptService.java
+++ /dev/null
@@ -1,450 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.browser;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.mozilla.*;
-import org.eclipse.swt.widgets.*;
-
-class PromptService {
- XPCOMObject supports;
- XPCOMObject promptService;
- int refCount = 0;
-
-public PromptService() {
- createCOMInterfaces();
-}
-
-int AddRef() {
- refCount++;
- return refCount;
-}
-
-void createCOMInterfaces() {
- /* Create each of the interfaces that this object implements */
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- };
-
- promptService = new XPCOMObject(new int[]{2, 0, 0, 3, 5, 4, 6, 10, 7, 8, 7, 7}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return Alert(args[0], args[1], args[2]);}
- public int /*long*/ method4(int /*long*/[] args) {return AlertCheck(args[0], args[1], args[2], args[3], args[4]);}
- public int /*long*/ method5(int /*long*/[] args) {return Confirm(args[0], args[1], args[2], args[3]);}
- public int /*long*/ method6(int /*long*/[] args) {return ConfirmCheck(args[0], args[1], args[2], args[3], args[4], args[5]);}
- public int /*long*/ method7(int /*long*/[] args) {return ConfirmEx(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]);}
- public int /*long*/ method8(int /*long*/[] args) {return Prompt(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);}
- public int /*long*/ method9(int /*long*/[] args) {return PromptUsernameAndPassword(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);}
- public int /*long*/ method10(int /*long*/[] args) {return PromptPassword(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);}
- public int /*long*/ method11(int /*long*/[] args) {return Select(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);}
- };
-}
-
-void disposeCOMInterfaces() {
- if (supports != null) {
- supports.dispose();
- supports = null;
- }
- if (promptService != null) {
- promptService.dispose();
- promptService = null;
- }
-}
-
-int /*long*/ getAddress() {
- return promptService.getAddress();
-}
-
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
- if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
-
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIPromptService.NS_IPROMPTSERVICE_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {promptService.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
-
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
- return XPCOM.NS_ERROR_NO_INTERFACE;
-}
-
-int Release() {
- refCount--;
- if (refCount == 0) disposeCOMInterfaces();
- return refCount;
-}
-
-Browser getBrowser(int /*long*/ aDOMWindow) {
- int /*long*/[] result = new int /*long*/[1];
- int rc = XPCOM.NS_GetServiceManager(result);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- if (result[0] == 0) Mozilla.error(XPCOM.NS_NOINTERFACE);
-
- nsIServiceManager serviceManager = new nsIServiceManager(result[0]);
- result[0] = 0;
- byte[] aContractID = Converter.wcsToMbcs(null, XPCOM.NS_WINDOWWATCHER_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID(aContractID, nsIWindowWatcher.NS_IWINDOWWATCHER_IID, result);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- if (result[0] == 0) Mozilla.error(XPCOM.NS_NOINTERFACE);
- serviceManager.Release();
-
- nsIWindowWatcher windowWatcher = new nsIWindowWatcher(result[0]);
- result[0] = 0;
- rc = windowWatcher.GetChromeForWindow(aDOMWindow, result);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- if (result[0] == 0) Mozilla.error(XPCOM.NS_NOINTERFACE);
- windowWatcher.Release();
-
- nsIWebBrowserChrome webBrowserChrome = new nsIWebBrowserChrome(result[0]);
- result[0] = 0;
- rc = webBrowserChrome.QueryInterface(nsIEmbeddingSiteWindow.NS_IEMBEDDINGSITEWINDOW_IID, result);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- if (result[0] == 0) Mozilla.error(XPCOM.NS_NOINTERFACE);
- webBrowserChrome.Release();
-
- nsIEmbeddingSiteWindow embeddingSiteWindow = new nsIEmbeddingSiteWindow(result[0]);
- result[0] = 0;
- rc = embeddingSiteWindow.GetSiteWindow(result);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- if (result[0] == 0) Mozilla.error(XPCOM.NS_NOINTERFACE);
- embeddingSiteWindow.Release();
-
- return Mozilla.findBrowser(result[0]);
-}
-
-String getLabel(int buttonFlag, int index, int /*long*/ buttonTitle) {
- String label = null;
- int flag = (buttonFlag & (0xff * index)) / index;
- switch (flag) {
- case nsIPromptService.BUTTON_TITLE_CANCEL : label = SWT.getMessage("SWT_Cancel"); break; //$NON-NLS-1$
- case nsIPromptService.BUTTON_TITLE_NO : label = SWT.getMessage("SWT_No"); break; //$NON-NLS-1$
- case nsIPromptService.BUTTON_TITLE_OK : label = SWT.getMessage("SWT_OK"); break; //$NON-NLS-1$
- case nsIPromptService.BUTTON_TITLE_SAVE : label = SWT.getMessage("SWT_Save"); break; //$NON-NLS-1$
- case nsIPromptService.BUTTON_TITLE_YES : label = SWT.getMessage("SWT_Yes"); break; //$NON-NLS-1$
- case nsIPromptService.BUTTON_TITLE_IS_STRING : {
- int length = XPCOM.strlen_PRUnichar(buttonTitle);
- char[] dest = new char[length];
- XPCOM.memmove(dest, buttonTitle, length * 2);
- label = new String(dest);
- }
- }
- return label;
-}
-
-/* nsIPromptService */
-
-public int /*long*/ Alert(int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text) {
- Browser browser = getBrowser(parent);
-
- int length = XPCOM.strlen_PRUnichar(dialogTitle);
- char[] dest = new char[length];
- XPCOM.memmove(dest, dialogTitle, length * 2);
- String titleLabel = new String(dest);
-
- length = XPCOM.strlen_PRUnichar(text);
- dest = new char[length];
- XPCOM.memmove(dest, text, length * 2);
- String textLabel = new String(dest);
-
- MessageBox messageBox = new MessageBox(browser.getShell(), SWT.OK | SWT.ICON_WARNING);
- messageBox.setText(titleLabel);
- messageBox.setMessage(textLabel);
- messageBox.open();
- return XPCOM.NS_OK;
-}
-
-public int /*long*/ AlertCheck(int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ checkMsg, int /*long*/ checkValue) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ Confirm(int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ _retval) {
- Browser browser = getBrowser(parent);
-
- int length = XPCOM.strlen_PRUnichar(dialogTitle);
- char[] dest = new char[length];
- XPCOM.memmove(dest, dialogTitle, length * 2);
- String titleLabel = new String(dest);
-
- length = XPCOM.strlen_PRUnichar(text);
- dest = new char[length];
- XPCOM.memmove(dest, text, length * 2);
- String textLabel = new String(dest);
-
- MessageBox messageBox = new MessageBox(browser.getShell(), SWT.OK | SWT.CANCEL | SWT.ICON_QUESTION);
- messageBox.setText(titleLabel);
- messageBox.setMessage(textLabel);
- int id = messageBox.open();
- int[] result = { id == SWT.OK ? 1 : 0};
- XPCOM.memmove(_retval, result, 4);
- return XPCOM.NS_OK;
-}
-
-public int /*long*/ ConfirmCheck(int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ checkMsg, int /*long*/ checkValue, int /*long*/ _retval) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ ConfirmEx(int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ buttonFlags, int /*long*/ button0Title, int /*long*/ button1Title, int /*long*/ button2Title, int /*long*/ checkMsg, int /*long*/ checkValue, int /*long*/ _retval) {
- Browser browser = getBrowser(parent);
-
- int length = XPCOM.strlen_PRUnichar(dialogTitle);
- char[] dest = new char[length];
- XPCOM.memmove(dest, dialogTitle, length * 2);
- String titleLabel = new String(dest);
-
- length = XPCOM.strlen_PRUnichar(text);
- dest = new char[length];
- XPCOM.memmove(dest, text, length * 2);
- String textLabel = new String(dest);
-
- String checkLabel = null;
- if (checkMsg != 0) {
- length = XPCOM.strlen_PRUnichar(checkMsg);
- dest = new char[length];
- XPCOM.memmove(dest, checkMsg, length * 2);
- checkLabel = new String(dest);
- }
-
- String button1Label = getLabel((int)/*64*/buttonFlags, nsIPromptService.BUTTON_POS_0, button0Title);
- String button2Label = getLabel((int)/*64*/buttonFlags, nsIPromptService.BUTTON_POS_1, button1Title);
- String button3Label = getLabel((int)/*64*/buttonFlags, nsIPromptService.BUTTON_POS_2, button2Title);
-
- PromptDialog dialog = new PromptDialog(browser.getShell());
- int[] check = new int[1], result = new int[1];
- if (checkValue != 0) XPCOM.memmove(check, checkValue, 4);
- dialog.confirmEx(titleLabel, textLabel, checkLabel, button1Label, button2Label, button3Label, check, result);
- if (checkValue != 0) XPCOM.memmove(checkValue, check, 4);
- XPCOM.memmove(_retval, result, 4);
- return XPCOM.NS_OK;
-}
-
-public int /*long*/ Prompt(int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ value, int /*long*/ checkMsg, int /*long*/ checkValue, int /*long*/ _retval) {
- Browser browser = getBrowser(parent);
- String titleLabel = null, textLabel, checkLabel = null;
- String[] valueLabel = new String[1];
- char[] dest;
- int length;
- if (dialogTitle != 0) {
- length = XPCOM.strlen_PRUnichar(dialogTitle);
- dest = new char[length];
- XPCOM.memmove(dest, dialogTitle, length * 2);
- titleLabel = new String(dest);
- }
-
- length = XPCOM.strlen_PRUnichar(text);
- dest = new char[length];
- XPCOM.memmove(dest, text, length * 2);
- textLabel = new String(dest);
-
- int /*long*/[] valueAddr = new int /*long*/[1];
- XPCOM.memmove(valueAddr, value, C.PTR_SIZEOF);
- if (valueAddr[0] != 0) {
- length = XPCOM.strlen_PRUnichar(valueAddr[0]);
- dest = new char[length];
- XPCOM.memmove(dest, valueAddr[0], length * 2);
- valueLabel[0] = new String(dest);
- }
-
- if (checkMsg != 0) {
- length = XPCOM.strlen_PRUnichar(checkMsg);
- dest = new char[length];
- XPCOM.memmove(dest, checkMsg, length * 2);
- checkLabel = new String(dest);
- }
-
- PromptDialog dialog = new PromptDialog(browser.getShell());
- int[] check = new int[1], result = new int[1];
- if (checkValue != 0) XPCOM.memmove(check, checkValue, 4);
- dialog.prompt(titleLabel, textLabel, checkLabel, valueLabel, check, result);
-
- XPCOM.memmove(_retval, result, 4);
- if (result[0] == 1) {
- /*
- * User selected OK. User name and password are returned as PRUnichar values. Any default
- * value that we override must be freed using the nsIMemory service.
- */
- int cnt, size;
- int /*long*/ ptr;
- char[] buffer;
- int /*long*/[] result2 = new int /*long*/[1];
- if (valueLabel[0] != null) {
- cnt = valueLabel[0].length();
- buffer = new char[cnt + 1];
- valueLabel[0].getChars(0, cnt, buffer, 0);
- size = buffer.length * 2;
- ptr = C.malloc(size);
- XPCOM.memmove(ptr, buffer, size);
- XPCOM.memmove(value, new int /*long*/[] {ptr}, C.PTR_SIZEOF);
-
- if (valueAddr[0] != 0) {
- int rc = XPCOM.NS_GetServiceManager(result2);
- if (rc != XPCOM.NS_OK) SWT.error(rc);
- if (result2[0] == 0) SWT.error(XPCOM.NS_NOINTERFACE);
-
- nsIServiceManager serviceManager = new nsIServiceManager(result2[0]);
- result2[0] = 0;
- byte[] aContractID = Converter.wcsToMbcs(null, XPCOM.NS_MEMORY_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID(aContractID, nsIMemory.NS_IMEMORY_IID, result2);
- if (rc != XPCOM.NS_OK) SWT.error(rc);
- if (result2[0] == 0) SWT.error(XPCOM.NS_NOINTERFACE);
- serviceManager.Release();
-
- nsIMemory memory = new nsIMemory(result2[0]);
- result2[0] = 0;
- memory.Free(valueAddr[0]);
- memory.Release();
- }
- }
- }
- if (checkValue != 0) XPCOM.memmove(checkValue, check, 4);
- return XPCOM.NS_OK;
-}
-
-public int /*long*/ PromptUsernameAndPassword(int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ username, int /*long*/ password, int /*long*/ checkMsg, int /*long*/ checkValue, int /*long*/ _retval) {
- Browser browser = getBrowser(parent);
- String titleLabel, textLabel, checkLabel = null;
- String[] userLabel = new String[1], passLabel = new String[1];
- char[] dest;
- int length;
- if (dialogTitle != 0) {
- length = XPCOM.strlen_PRUnichar(dialogTitle);
- dest = new char[length];
- XPCOM.memmove(dest, dialogTitle, length * 2);
- titleLabel = new String(dest);
- } else {
- titleLabel = ""; //$NON-NLS-1$
- }
-
- length = XPCOM.strlen_PRUnichar(text);
- dest = new char[length];
- XPCOM.memmove(dest, text, length * 2);
- textLabel = new String(dest);
-
- int /*long*/[] userAddr = new int /*long*/[1];
- XPCOM.memmove(userAddr, username, C.PTR_SIZEOF);
- if (userAddr[0] != 0) {
- length = XPCOM.strlen_PRUnichar(userAddr[0]);
- dest = new char[length];
- XPCOM.memmove(dest, userAddr[0], length * 2);
- userLabel[0] = new String(dest);
- }
-
- int /*long*/[] passAddr = new int /*long*/[1];
- XPCOM.memmove(passAddr, password, C.PTR_SIZEOF);
- if (passAddr[0] != 0) {
- length = XPCOM.strlen_PRUnichar(passAddr[0]);
- dest = new char[length];
- XPCOM.memmove(dest, passAddr[0], length * 2);
- passLabel[0] = new String(dest);
- }
-
- if (checkMsg != 0) {
- length = XPCOM.strlen_PRUnichar(checkMsg);
- dest = new char[length];
- XPCOM.memmove(dest, checkMsg, length * 2);
- checkLabel = new String(dest);
- }
-
- PromptDialog dialog = new PromptDialog(browser.getShell());
- int[] check = new int[1], result = new int[1];
- if (checkValue != 0) XPCOM.memmove(check, checkValue, 4);
- dialog.promptUsernameAndPassword(titleLabel, textLabel, checkLabel, userLabel, passLabel, check, result);
-
- XPCOM.memmove(_retval, result, 4);
- if (result[0] == 1) {
- /*
- * User selected OK. User name and password are returned as PRUnichar values. Any default
- * value that we override must be freed using the nsIMemory service.
- */
- int cnt, size;
- int /*long*/ ptr;
- char[] buffer;
- int /*long*/[] result2 = new int /*long*/[1];
- if (userLabel[0] != null) {
- cnt = userLabel[0].length();
- buffer = new char[cnt + 1];
- userLabel[0].getChars(0, cnt, buffer, 0);
- size = buffer.length * 2;
- ptr = C.malloc(size);
- XPCOM.memmove(ptr, buffer, size);
- XPCOM.memmove(username, new int /*long*/[] {ptr}, C.PTR_SIZEOF);
-
- if (userAddr[0] != 0) {
- int rc = XPCOM.NS_GetServiceManager(result2);
- if (rc != XPCOM.NS_OK) SWT.error(rc);
- if (result2[0] == 0) SWT.error(XPCOM.NS_NOINTERFACE);
-
- nsIServiceManager serviceManager = new nsIServiceManager(result2[0]);
- result2[0] = 0;
- byte[] aContractID = Converter.wcsToMbcs(null, XPCOM.NS_MEMORY_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID(aContractID, nsIMemory.NS_IMEMORY_IID, result2);
- if (rc != XPCOM.NS_OK) SWT.error(rc);
- if (result[0] == 0) SWT.error(XPCOM.NS_NOINTERFACE);
- serviceManager.Release();
-
- nsIMemory memory = new nsIMemory(result2[0]);
- result2[0] = 0;
- memory.Free(userAddr[0]);
- memory.Release();
- }
- }
- if (passLabel[0] != null) {
- cnt = passLabel[0].length();
- buffer = new char[cnt + 1];
- passLabel[0].getChars(0, cnt, buffer, 0);
- size = buffer.length * 2;
- ptr = C.malloc(size);
- XPCOM.memmove(ptr, buffer, size);
- XPCOM.memmove(password, new int /*long*/[] {ptr}, C.PTR_SIZEOF);
-
- if (passAddr[0] != 0) {
- int rc = XPCOM.NS_GetServiceManager(result2);
- if (rc != XPCOM.NS_OK) SWT.error(rc);
- if (result2[0] == 0) SWT.error(XPCOM.NS_NOINTERFACE);
-
- nsIServiceManager serviceManager = new nsIServiceManager(result2[0]);
- result2[0] = 0;
- byte[] aContractID = Converter.wcsToMbcs(null, XPCOM.NS_MEMORY_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID(aContractID, nsIMemory.NS_IMEMORY_IID, result2);
- if (rc != XPCOM.NS_OK) SWT.error(rc);
- if (result2[0] == 0) SWT.error(XPCOM.NS_NOINTERFACE);
- serviceManager.Release();
-
- nsIMemory memory = new nsIMemory(result2[0]);
- result2[0] = 0;
- memory.Free(passAddr[0]);
- memory.Release();
- }
- }
- }
- if (checkValue != 0) XPCOM.memmove(checkValue, check, 4);
- return XPCOM.NS_OK;
-}
-
-public int /*long*/ PromptPassword(int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ password, int /*long*/ checkMsg, int /*long*/ checkValue, int /*long*/ _retval) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-
-public int /*long*/ Select(int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ count, int /*long*/ selectList, int /*long*/ outSelection, int /*long*/ _retval) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/PromptServiceFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/PromptServiceFactory.java
deleted file mode 100644
index 80e1051ea9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/PromptServiceFactory.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.browser;
-
-import org.eclipse.swt.internal.C;
-import org.eclipse.swt.internal.mozilla.*;
-
-class PromptServiceFactory {
- XPCOMObject supports;
- XPCOMObject factory;
- int refCount = 0;
-
-public PromptServiceFactory() {
- createCOMInterfaces();
-}
-
-int AddRef() {
- refCount++;
- return refCount;
-}
-
-void createCOMInterfaces() {
- /* Create each of the interfaces that this object implements */
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- };
-
- factory = new XPCOMObject(new int[]{2, 0, 0, 3, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return CreateInstance(args[0], args[1], args[2]);}
- public int /*long*/ method4(int /*long*/[] args) {return LockFactory(args[0]);}
- };
-}
-
-void disposeCOMInterfaces() {
- if (supports != null) {
- supports.dispose();
- supports = null;
- }
- if (factory != null) {
- factory.dispose();
- factory = null;
- }
-}
-
-int /*long*/ getAddress() {
- return factory.getAddress();
-}
-
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
- if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
-
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIFactory.NS_IFACTORY_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {factory.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
-
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
- return XPCOM.NS_ERROR_NO_INTERFACE;
-}
-
-int Release() {
- refCount--;
- if (refCount == 0) disposeCOMInterfaces();
- return refCount;
-}
-
-/* nsIFactory */
-
-public int /*long*/ CreateInstance(int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
- PromptService promptService = new PromptService();
- promptService.AddRef();
- XPCOM.memmove(result, new int /*long*/[] {promptService.getAddress()}, C.PTR_SIZEOF);
- return XPCOM.NS_OK;
-}
-
-public int /*long*/ LockFactory(int /*long*/ lock) {
- return XPCOM.NS_OK;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/WindowCreator.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/WindowCreator.java
deleted file mode 100644
index 9df7456182..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/browser/WindowCreator.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.browser;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.C;
-import org.eclipse.swt.internal.mozilla.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-class WindowCreator {
- XPCOMObject supports;
- XPCOMObject windowCreator;
- int refCount = 0;
-
-public WindowCreator() {
- createCOMInterfaces();
-}
-
-int AddRef() {
- refCount++;
- return refCount;
-}
-
-void createCOMInterfaces() {
- /* Create each of the interfaces that this object implements */
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- };
-
- windowCreator = new XPCOMObject(new int[]{2, 0, 0, 3}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return CreateChromeWindow(args[0], args[1], args[2]);}
- };
-}
-
-void disposeCOMInterfaces() {
- if (supports != null) {
- supports.dispose();
- supports = null;
- }
- if (windowCreator != null) {
- windowCreator.dispose();
- windowCreator = null;
- }
-}
-
-int /*long*/ getAddress() {
- return windowCreator.getAddress();
-}
-
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
- if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
-
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
- if (guid.Equals(nsIWindowCreator.NS_IWINDOWCREATOR_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {windowCreator.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return XPCOM.NS_OK;
- }
-
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
- return XPCOM.NS_ERROR_NO_INTERFACE;
-}
-
-int Release() {
- refCount--;
- if (refCount == 0) disposeCOMInterfaces();
- return refCount;
-}
-
-/* nsIWindowCreator */
-
-int /*long*/ CreateChromeWindow(int /*long*/ parent, int /*long*/ chromeFlags, int /*long*/ _retval) {
- if (parent == 0 && (chromeFlags & nsIWebBrowserChrome.CHROME_MODAL) == 0) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
- }
- Browser src = null;
- if (parent != 0) {
- nsIWebBrowserChrome browserChromeParent = new nsIWebBrowserChrome(parent);
- int /*long*/[] aWebBrowser = new int /*long*/[1];
- int rc = browserChromeParent.GetWebBrowser(aWebBrowser);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- if (aWebBrowser[0] == 0) Mozilla.error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebBrowser webBrowser = new nsIWebBrowser(aWebBrowser[0]);
- int /*long*/[] result = new int /*long*/[1];
- rc = webBrowser.QueryInterface(nsIBaseWindow.NS_IBASEWINDOW_IID, result);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- if (result[0] == 0) Mozilla.error(XPCOM.NS_ERROR_NO_INTERFACE);
- webBrowser.Release();
-
- nsIBaseWindow baseWindow = new nsIBaseWindow(result[0]);
- result[0] = 0;
- int /*long*/[] aParentNativeWindow = new int /*long*/[1];
- rc = baseWindow.GetParentNativeWindow(aParentNativeWindow);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- if (aParentNativeWindow[0] == 0) Mozilla.error(XPCOM.NS_ERROR_NO_INTERFACE);
- baseWindow.Release();
-
- src = Mozilla.findBrowser(aParentNativeWindow[0]);
- }
- final Browser browser;
- boolean doit = false;
- if ((chromeFlags & nsIWebBrowserChrome.CHROME_MODAL) != 0) {
- /*
- * Feature on Mozilla. On platforms that lack a native dialog, Mozilla sends a
- * requests for a new Browser instance in a modal window. e.g. on Windows, Mozilla
- * brings up automatically a native Print Dialog in response to the javascript
- * command window.print() whereas on Linux Mozilla requests a new modal window
- * and a Browser to display an emulated HTML based print dialog. For this reason,
- * modal requests are handled here and not exposed to the user.
- */
- final Shell shell = src == null ?
- new Shell(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL) :
- new Shell(src.getShell(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
- shell.setLayout(new FillLayout());
- browser = new Browser(shell, src.getStyle() & SWT.NONE /*MOZILLA*/); // TODO
- browser.addVisibilityWindowListener(new VisibilityWindowListener() {
- public void hide(WindowEvent event) {
- }
- public void show(WindowEvent event) {
- if (event.location != null) shell.setLocation(event.location);
- if (event.size != null) {
- Point size = event.size;
- shell.setSize(shell.computeSize(size.x, size.y));
- }
- shell.open();
- ((Mozilla)browser.webBrowser).isModal = true;
- }
- });
- browser.addCloseWindowListener(new CloseWindowListener() {
- public void close(WindowEvent event) {
- shell.close();
- }
- });
- doit = true;
- } else {
- WindowEvent event = new WindowEvent(src);
- event.display = src.getDisplay();
- event.widget = src;
- event.required = true;
- for (int i = 0; i < src.webBrowser.openWindowListeners.length; i++) {
- src.webBrowser.openWindowListeners[i].open(event);
- }
- browser = event.browser;
- doit = browser != null && !browser.isDisposed();
- if (doit) {
- ((Mozilla)browser.webBrowser).addressBar = (chromeFlags & nsIWebBrowserChrome.CHROME_LOCATIONBAR) != 0;
- ((Mozilla)browser.webBrowser).menuBar = (chromeFlags & nsIWebBrowserChrome.CHROME_MENUBAR) != 0;
- ((Mozilla)browser.webBrowser).statusBar = (chromeFlags & nsIWebBrowserChrome.CHROME_STATUSBAR) != 0;
- ((Mozilla)browser.webBrowser).toolBar = (chromeFlags & nsIWebBrowserChrome.CHROME_TOOLBAR) != 0;
- }
- }
- if (doit) {
- int /*long*/ address = ((Mozilla)browser.webBrowser).webBrowserChrome.getAddress();
- nsIWebBrowserChrome webBrowserChrome = new nsIWebBrowserChrome(address);
- webBrowserChrome.AddRef();
- XPCOM.memmove(_retval, new int /*long*/[] {address}, C.PTR_SIZEOF);
- }
- return doit ? XPCOM.NS_OK : XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/internal/mozilla/XPCOMObject.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/internal/mozilla/XPCOMObject.java
deleted file mode 100644
index 0a564a0d45..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/motif/org/eclipse/swt/internal/mozilla/XPCOMObject.java
+++ /dev/null
@@ -1,1023 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.internal.mozilla;
-
-import java.util.Hashtable;
-import org.eclipse.swt.internal.Callback;
-import org.eclipse.swt.internal.motif.OS;
-import org.eclipse.swt.SWT;
-
-public class XPCOMObject {
-
- private int ppVtable;
-
- static private final int MAX_ARG_COUNT = 12;
- static private final int MAX_VTABLE_LENGTH = 80;
- static private Callback[][] Callbacks = new Callback[MAX_VTABLE_LENGTH][MAX_ARG_COUNT];
- static private Hashtable ObjectMap = new Hashtable();
-
-public XPCOMObject(int[] argCounts) {
- int[] callbackAddresses = new int[argCounts.length];
- for (int i = 0, length = argCounts.length; i < length; i++){
- if ((Callbacks[i][argCounts[i]]) == null) {
- Callbacks[i][argCounts[i]] = new Callback(this.getClass(), "callback"+i, argCounts[i] + 1, true); //$NON-NLS-1$
- }
- callbackAddresses[i] = Callbacks[i][argCounts[i]].getAddress();
- if (callbackAddresses[i] == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
- }
-
- int pVtable = OS.XtMalloc(4 * argCounts.length);
- XPCOM.memmove(pVtable, callbackAddresses, 4 * argCounts.length);
- ppVtable = OS.XtMalloc(4);
- XPCOM.memmove(ppVtable, new int[] {pVtable}, 4);
- ObjectMap.put(new Integer(ppVtable), this);
-}
-
-static int callback0(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method0(args);
-}
-static int callback1(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method1(args);
-}
-static int callback10(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method10(args);
-}
-static int callback11(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method11(args);
-}
-static int callback12(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method12(args);
-}
-static int callback13(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method13(args);
-}
-static int callback14(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method14(args);
-}
-static int callback15(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method15(args);
-}
-static int callback16(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method16(args);
-}
-static int callback17(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method17(args);
-}
-static int callback18(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method18(args);
-}
-static int callback19(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method19(args);
-}
-static int callback2(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method2(args);
-}
-static int callback20(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method20(args);
-}
-static int callback21(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method21(args);
-}
-static int callback22(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method22(args);
-}
-static int callback23(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method23(args);
-}
-static int callback24(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method24(args);
-}
-static int callback25(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method25(args);
-}
-static int callback26(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method26(args);
-}
-static int callback27(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method27(args);
-}
-static int callback28(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method28(args);
-}
-static int callback29(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method29(args);
-}
-static int callback3(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method3(args);
-}
-static int callback30(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method30(args);
-}
-static int callback31(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method31(args);
-}
-static int callback32(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method32(args);
-}
-static int callback33(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method33(args);
-}
-static int callback34(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method34(args);
-}
-static int callback35(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method35(args);
-}
-static int callback36(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method36(args);
-}
-static int callback37(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method37(args);
-}
-static int callback38(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method38(args);
-}
-static int callback39(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method39(args);
-}
-static int callback4(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method4(args);
-}
-static int callback40(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method40(args);
-}
-static int callback41(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method41(args);
-}
-static int callback42(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method42(args);
-}
-static int callback43(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method43(args);
-}
-static int callback44(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method44(args);
-}
-static int callback45(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method45(args);
-}
-static int callback46(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method46(args);
-}
-static int callback47(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method47(args);
-}
-static int callback48(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method48(args);
-}
-static int callback49(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method49(args);
-}
-static int callback5(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method5(args);
-}
-static int callback50(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method50(args);
-}
-static int callback51(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method51(args);
-}
-static int callback52(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method52(args);
-}
-static int callback53(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method53(args);
-}
-static int callback54(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method54(args);
-}
-static int callback55(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method55(args);
-}
-static int callback56(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method56(args);
-}
-static int callback57(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method57(args);
-}
-static int callback58(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method58(args);
-}
-static int callback59(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method59(args);
-}
-static int callback6(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method6(args);
-}
-static int callback60(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method60(args);
-}
-static int callback61(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method61(args);
-}
-static int callback62(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method62(args);
-}
-static int callback63(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method63(args);
-}
-static int callback64(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method64(args);
-}
-static int callback65(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method65(args);
-}
-static int callback66(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method66(args);
-}
-static int callback67(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method67(args);
-}
-static int callback68(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method68(args);
-}
-static int callback69(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method69(args);
-}
-static int callback7(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method7(args);
-}
-static int callback70(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method70(args);
-}
-static int callback71(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method71(args);
-}
-static int callback72(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method72(args);
-}
-static int callback73(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method73(args);
-}
-static int callback74(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method74(args);
-}
-static int callback75(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method75(args);
-}
-static int callback76(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method76(args);
-}
-static int callback77(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method77(args);
-}
-static int callback78(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method78(args);
-}
-static int callback79(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method79(args);
-}
-static int callback8(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method8(args);
-}
-static int callback9(int[] callbackArgs) {
- // find the object on which this call was invoked
- int address = callbackArgs[0];
- Object object = ObjectMap.get(new Integer(address));
- if (object == null) return XPCOM.NS_ERROR_FAILURE;
- int[] args = new int[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method9(args);
-}
-
-public void dispose() {
- // free the memory for this reference
- int[] pVtable = new int[1];
- XPCOM.memmove(pVtable, ppVtable, 4);
- OS.XtFree(pVtable[0]);
- OS.XtFree(ppVtable);
-
- // remove this ppVtable from the list
- ObjectMap.remove(new Integer(ppVtable));
-
- ppVtable = 0;
-}
-
-public int getAddress () {
- return ppVtable;
-}
-
-public int method0(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method1(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method10(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method11(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method12(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method13(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method14(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method15(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method16(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method17(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method18(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method19(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method2(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method20(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method21(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method22(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method23(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method24(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method25(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method26(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method27(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method28(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method29(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method3(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method30(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method31(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method32(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method33(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method34(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method35(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method36(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method37(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method38(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method39(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method4(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method40(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method41(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method42(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method43(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method44(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method45(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method46(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method47(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method48(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method49(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method5(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method50(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method51(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method52(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method53(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method54(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method55(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method56(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method57(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method58(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method59(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method6(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method60(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method61(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method62(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method63(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method64(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method65(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method66(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method67(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method68(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method69(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method7(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method70(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method71(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method72(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method73(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method74(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method75(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method76(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method77(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method78(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method79(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method8(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-public int method9(int[] args) {
- return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
-}
-}
-
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/Download.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/Download.java
index 0f7cf146c1..7b828a8b35 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/Download.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/Download.java
@@ -13,7 +13,6 @@ package org.eclipse.swt.browser;
import org.eclipse.swt.SWT;
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.mozilla.*;
-import org.eclipse.swt.internal.gtk.OS;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
@@ -29,342 +28,342 @@ class Download {
Label status;
Button cancel;
-public Download() {
- createCOMInterfaces();
+public Download () {
+ createCOMInterfaces ();
}
-int AddRef() {
+int AddRef () {
refCount++;
return refCount;
}
-void createCOMInterfaces() {
+void createCOMInterfaces () {
/* Create each of the interfaces that this object implements */
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
+ supports = new XPCOMObject (new int[] {2, 0, 0}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
};
- download = new XPCOMObject(new int[]{2, 0, 0, 7, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return Init(args[0], args[1], args[2],args[3], args[4], args[5], args[6]);}
- public int /*long*/ method4(int /*long*/[] args) {return GetSource(args[0]);}
- public int /*long*/ method5(int /*long*/[] args) {return GetTarget(args[0]);}
- public int /*long*/ method6(int /*long*/[] args) {return GetPersist(args[0]);}
- public int /*long*/ method7(int /*long*/[] args) {return GetPercentComplete(args[0]);}
- public int /*long*/ method8(int /*long*/[] args) {return GetDisplayName(args[0]);}
- public int /*long*/ method9(int /*long*/[] args) {return SetDisplayName(args[0]);}
- public int /*long*/ method10(int /*long*/[] args) {return GetStartTime(args[0]);}
- public int /*long*/ method11(int /*long*/[] args) {return GetMIMEInfo(args[0]);}
- public int /*long*/ method12(int /*long*/[] args) {return GetListener(args[0]);}
- public int /*long*/ method13(int /*long*/[] args) {return SetListener(args[0]);}
- public int /*long*/ method14(int /*long*/[] args) {return GetObserver(args[0]);}
- public int /*long*/ method15(int /*long*/[] args) {return SetObserver(args[0]);}
+ download = new XPCOMObject (new int[] {2, 0, 0, 7, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return Init (args[0], args[1], args[2], args[3], args[4], args[5], args[6]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return GetSource (args[0]);}
+ public int /*long*/ method5 (int /*long*/[] args) {return GetTarget (args[0]);}
+ public int /*long*/ method6 (int /*long*/[] args) {return GetPersist (args[0]);}
+ public int /*long*/ method7 (int /*long*/[] args) {return GetPercentComplete (args[0]);}
+ public int /*long*/ method8 (int /*long*/[] args) {return GetDisplayName (args[0]);}
+ public int /*long*/ method9 (int /*long*/[] args) {return SetDisplayName (args[0]);}
+ public int /*long*/ method10 (int /*long*/[] args) {return GetStartTime (args[0]);}
+ public int /*long*/ method11 (int /*long*/[] args) {return GetMIMEInfo (args[0]);}
+ public int /*long*/ method12 (int /*long*/[] args) {return GetListener (args[0]);}
+ public int /*long*/ method13 (int /*long*/[] args) {return SetListener (args[0]);}
+ public int /*long*/ method14 (int /*long*/[] args) {return GetObserver (args[0]);}
+ public int /*long*/ method15 (int /*long*/[] args) {return SetObserver (args[0]);}
};
- progressDialog = new XPCOMObject(new int[]{2, 0, 0, 7, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return Init(args[0], args[1], args[2],args[3], args[4], args[5], args[6]);}
- public int /*long*/ method4(int /*long*/[] args) {return GetSource(args[0]);}
- public int /*long*/ method5(int /*long*/[] args) {return GetTarget(args[0]);}
- public int /*long*/ method6(int /*long*/[] args) {return GetPersist(args[0]);}
- public int /*long*/ method7(int /*long*/[] args) {return GetPercentComplete(args[0]);}
- public int /*long*/ method8(int /*long*/[] args) {return GetDisplayName(args[0]);}
- public int /*long*/ method9(int /*long*/[] args) {return SetDisplayName(args[0]);}
- public int /*long*/ method10(int /*long*/[] args) {return GetStartTime(args[0]);}
- public int /*long*/ method11(int /*long*/[] args) {return GetMIMEInfo(args[0]);}
- public int /*long*/ method12(int /*long*/[] args) {return GetListener(args[0]);}
- public int /*long*/ method13(int /*long*/[] args) {return SetListener(args[0]);}
- public int /*long*/ method14(int /*long*/[] args) {return GetObserver(args[0]);}
- public int /*long*/ method15(int /*long*/[] args) {return SetObserver(args[0]);}
- public int /*long*/ method16(int /*long*/[] args) {return Open(args[0]);}
- public int /*long*/ method17(int /*long*/[] args) {return GetCancelDownloadOnClose(args[0]);}
- public int /*long*/ method18(int /*long*/[] args) {return SetCancelDownloadOnClose(args[0]);}
- public int /*long*/ method19(int /*long*/[] args) {return GetDialog(args[0]);}
- public int /*long*/ method20(int /*long*/[] args) {return SetDialog(args[0]);}
+ progressDialog = new XPCOMObject (new int[] {2, 0, 0, 7, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return Init (args[0], args[1], args[2], args[3], args[4], args[5], args[6]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return GetSource (args[0]);}
+ public int /*long*/ method5 (int /*long*/[] args) {return GetTarget (args[0]);}
+ public int /*long*/ method6 (int /*long*/[] args) {return GetPersist (args[0]);}
+ public int /*long*/ method7 (int /*long*/[] args) {return GetPercentComplete (args[0]);}
+ public int /*long*/ method8 (int /*long*/[] args) {return GetDisplayName (args[0]);}
+ public int /*long*/ method9 (int /*long*/[] args) {return SetDisplayName (args[0]);}
+ public int /*long*/ method10 (int /*long*/[] args) {return GetStartTime (args[0]);}
+ public int /*long*/ method11 (int /*long*/[] args) {return GetMIMEInfo (args[0]);}
+ public int /*long*/ method12 (int /*long*/[] args) {return GetListener (args[0]);}
+ public int /*long*/ method13 (int /*long*/[] args) {return SetListener (args[0]);}
+ public int /*long*/ method14 (int /*long*/[] args) {return GetObserver (args[0]);}
+ public int /*long*/ method15 (int /*long*/[] args) {return SetObserver (args[0]);}
+ public int /*long*/ method16 (int /*long*/[] args) {return Open (args[0]);}
+ public int /*long*/ method17 (int /*long*/[] args) {return GetCancelDownloadOnClose (args[0]);}
+ public int /*long*/ method18 (int /*long*/[] args) {return SetCancelDownloadOnClose (args[0]);}
+ public int /*long*/ method19 (int /*long*/[] args) {return GetDialog (args[0]);}
+ public int /*long*/ method20 (int /*long*/[] args) {return SetDialog (args[0]);}
};
- webProgressListener = new XPCOMObject(new int[]{2, 0, 0, 4, 6, 3, 4, 3}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return OnStateChange(args[0], args[1], args[2],args[3]);}
- public int /*long*/ method4(int /*long*/[] args) {return OnProgressChange(args[0], args[1], args[2],args[3],args[4],args[5]);}
- public int /*long*/ method5(int /*long*/[] args) {return OnLocationChange(args[0], args[1], args[2]);}
- public int /*long*/ method6(int /*long*/[] args) {return OnStatusChange(args[0], args[1], args[2],args[3]);}
- public int /*long*/ method7(int /*long*/[] args) {return OnSecurityChange(args[0], args[1], args[2]);}
+ webProgressListener = new XPCOMObject (new int[] {2, 0, 0, 4, 6, 3, 4, 3}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return OnStateChange (args[0], args[1], args[2], args[3]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], args[2], args[3], args[4], args[5]);}
+ public int /*long*/ method5 (int /*long*/[] args) {return OnLocationChange (args[0], args[1], args[2]);}
+ public int /*long*/ method6 (int /*long*/[] args) {return OnStatusChange (args[0], args[1], args[2], args[3]);}
+ public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], args[2]);}
};
}
-void disposeCOMInterfaces() {
+void disposeCOMInterfaces () {
if (supports != null) {
- supports.dispose();
+ supports.dispose ();
supports = null;
}
if (download != null) {
- download.dispose();
+ download.dispose ();
download = null;
}
if (progressDialog != null) {
- progressDialog.dispose();
- progressDialog = null;
+ progressDialog.dispose ();
+ progressDialog = null;
}
if (webProgressListener != null) {
- webProgressListener.dispose();
- webProgressListener = null;
+ webProgressListener.dispose ();
+ webProgressListener = null;
}
}
-int /*long*/ getAddress() {
- return progressDialog.getAddress();
+int /*long*/ getAddress () {
+ return progressDialog.getAddress ();
}
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
+int /*long*/ QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
-
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, OS.PTR_SIZEOF);
+ nsID guid = new nsID ();
+ XPCOM.memmove (guid, riid, nsID.sizeof);
+
+ if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF);
AddRef();
return XPCOM.NS_OK;
}
- if (guid.Equals(nsIDownload.NS_IDOWNLOAD_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {download.getAddress()}, OS.PTR_SIZEOF);
+ if (guid.Equals (nsIDownload.NS_IDOWNLOAD_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {download.getAddress ()}, C.PTR_SIZEOF);
AddRef();
return XPCOM.NS_OK;
}
- if (guid.Equals(nsIProgressDialog.NS_IPROGRESSDIALOG_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {progressDialog.getAddress()}, OS.PTR_SIZEOF);
+ if (guid.Equals (nsIProgressDialog.NS_IPROGRESSDIALOG_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {progressDialog.getAddress ()}, C.PTR_SIZEOF);
AddRef();
return XPCOM.NS_OK;
}
- if (guid.Equals(nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {webProgressListener.getAddress()}, OS.PTR_SIZEOF);
+ if (guid.Equals (nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {webProgressListener.getAddress ()}, C.PTR_SIZEOF);
AddRef();
return XPCOM.NS_OK;
}
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, OS.PTR_SIZEOF);
+ XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
return XPCOM.NS_ERROR_NO_INTERFACE;
}
-int Release() {
+int Release () {
refCount--;
- if (refCount == 0) disposeCOMInterfaces();
+ if (refCount == 0) disposeCOMInterfaces ();
return refCount;
}
/* nsIDownload */
/* Note. The argument startTime is defined as a PRInt64. This translates into two java ints. */
-public int /*long*/ Init(int /*long*/ aSource, int /*long*/ aTarget, int /*long*/ aDisplayName, int /*long*/ aMIMEInfo, int /*long*/ startTime1, int /*long*/ startTime2, int /*long*/ aPersist) {
- nsIURI source = new nsIURI(aSource);
- int /*long*/ aSpec = XPCOM.nsEmbedCString_new();
- int rc = source.GetHost(aSpec);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- int length = XPCOM.nsEmbedCString_Length(aSpec);
- int /*long*/ buffer = XPCOM.nsEmbedCString_get(aSpec);
+public int /*long*/ Init (int /*long*/ aSource, int /*long*/ aTarget, int /*long*/ aDisplayName, int /*long*/ aMIMEInfo, int /*long*/ startTime1, int /*long*/ startTime2, int /*long*/ aPersist) {
+ nsIURI source = new nsIURI (aSource);
+ int /*long*/ aSpec = XPCOM.nsEmbedCString_new ();
+ int rc = source.GetHost (aSpec);
+ if (rc != XPCOM.NS_OK) Mozilla.error (rc);
+ int length = XPCOM.nsEmbedCString_Length (aSpec);
+ int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec);
byte[] dest = new byte[length];
- XPCOM.memmove(dest, buffer, length);
- XPCOM.nsEmbedCString_delete(aSpec);
- String url = new String(dest);
-
+ XPCOM.memmove (dest, buffer, length);
+ XPCOM.nsEmbedCString_delete (aSpec);
+ String url = new String (dest);
+
/*
* As of mozilla 1.7 the second argument of the nsIDownload interface's
* Init function changed from nsILocalFile to nsIURI. Detect which of
* these interfaces the second argument implements and act accordingly.
*/
String filename = null;
- nsISupports supports = new nsISupports(aTarget);
+ nsISupports supports = new nsISupports (aTarget);
int /*long*/[] result = new int /*long*/[1];
- rc = supports.QueryInterface(nsIURI.NS_IURI_IID, result);
+ rc = supports.QueryInterface (nsIURI.NS_IURI_IID, result);
if (rc == 0) { /* >= 1.7 */
- nsIURI target = new nsIURI(result[0]);
+ nsIURI target = new nsIURI (result[0]);
result[0] = 0;
- int /*long*/ aPath = XPCOM.nsEmbedCString_new();
- rc = target.GetPath(aPath);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- length = XPCOM.nsEmbedCString_Length(aPath);
- buffer = XPCOM.nsEmbedCString_get(aPath);
+ int /*long*/ aPath = XPCOM.nsEmbedCString_new ();
+ rc = target.GetPath (aPath);
+ if (rc != XPCOM.NS_OK) Mozilla.error (rc);
+ length = XPCOM.nsEmbedCString_Length (aPath);
+ buffer = XPCOM.nsEmbedCString_get (aPath);
dest = new byte[length];
- XPCOM.memmove(dest, buffer, length);
- XPCOM.nsEmbedCString_delete(aPath);
- filename = new String(dest);
- int separator = filename.lastIndexOf(System.getProperty("file.separator")); //$NON-NLS-1$
- filename = filename.substring(separator + 1);
- target.Release();
+ XPCOM.memmove (dest, buffer, length);
+ XPCOM.nsEmbedCString_delete (aPath);
+ filename = new String (dest);
+ int separator = filename.lastIndexOf (System.getProperty ("file.separator")); //$NON-NLS-1$
+ filename = filename.substring (separator + 1);
+ target.Release ();
} else { /* < 1.7 */
- nsILocalFile target = new nsILocalFile(aTarget);
- int /*long*/ aNativeTarget = XPCOM.nsEmbedCString_new();
- rc = target.GetNativeLeafName(aNativeTarget);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- length = XPCOM.nsEmbedCString_Length(aNativeTarget);
- buffer = XPCOM.nsEmbedCString_get(aNativeTarget);
+ nsILocalFile target = new nsILocalFile (aTarget);
+ int /*long*/ aNativeTarget = XPCOM.nsEmbedCString_new ();
+ rc = target.GetNativeLeafName (aNativeTarget);
+ if (rc != XPCOM.NS_OK) Mozilla.error (rc);
+ length = XPCOM.nsEmbedCString_Length (aNativeTarget);
+ buffer = XPCOM.nsEmbedCString_get (aNativeTarget);
dest = new byte[length];
- XPCOM.memmove(dest, buffer, length);
- XPCOM.nsEmbedCString_delete(aNativeTarget);
- filename = new String(dest);
+ XPCOM.memmove (dest, buffer, length);
+ XPCOM.nsEmbedCString_delete (aNativeTarget);
+ filename = new String (dest);
}
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
+ Listener listener = new Listener () {
+ public void handleEvent (Event event) {
if (event.widget == cancel) {
- shell.close();
+ shell.close ();
}
if (helperAppLauncher != null) {
- helperAppLauncher.Cancel();
- helperAppLauncher.Release();
+ helperAppLauncher.Cancel ();
+ helperAppLauncher.Release ();
}
shell = null;
helperAppLauncher = null;
}
};
- shell = new Shell(SWT.DIALOG_TRIM);
- String msg = Compatibility.getMessage("SWT_Download_File", new Object[] {filename}); //$NON-NLS-1$
- shell.setText(msg);
- GridLayout gridLayout = new GridLayout();
+ shell = new Shell (SWT.DIALOG_TRIM);
+ String msg = Compatibility.getMessage ("SWT_Download_File", new Object[] {filename}); //$NON-NLS-1$
+ shell.setText (msg);
+ GridLayout gridLayout = new GridLayout ();
gridLayout.marginHeight = 15;
gridLayout.marginWidth = 15;
gridLayout.verticalSpacing = 20;
shell.setLayout(gridLayout);
- msg = Compatibility.getMessage("SWT_Download_Location", new Object[] {filename, url}); //$NON-NLS-1$
- new Label(shell, SWT.SIMPLE).setText(msg);
- status = new Label(shell, SWT.SIMPLE);
- msg = Compatibility.getMessage("SWT_Download_Started"); //$NON-NLS-1$
- status.setText(msg);
+ msg = Compatibility.getMessage ("SWT_Download_Location", new Object[] {filename, url}); //$NON-NLS-1$
+ new Label (shell, SWT.SIMPLE).setText (msg);
+ status = new Label (shell, SWT.SIMPLE);
+ msg = Compatibility.getMessage ("SWT_Download_Started"); //$NON-NLS-1$
+ status.setText (msg);
GridData data = new GridData ();
data.grabExcessHorizontalSpace = true;
data.grabExcessVerticalSpace = true;
status.setLayoutData (data);
-
- cancel = new Button(shell, SWT.PUSH);
- cancel.setText(SWT.getMessage("SWT_Cancel")); //$NON-NLS-1$
+
+ cancel = new Button (shell, SWT.PUSH);
+ cancel.setText (SWT.getMessage ("SWT_Cancel")); //$NON-NLS-1$
data = new GridData ();
data.horizontalAlignment = GridData.CENTER;
cancel.setLayoutData (data);
- cancel.addListener(SWT.Selection, listener);
- shell.addListener(SWT.Close, listener);
- shell.pack();
- shell.open();
+ cancel.addListener (SWT.Selection, listener);
+ shell.addListener (SWT.Close, listener);
+ shell.pack ();
+ shell.open ();
return XPCOM.NS_OK;
}
-public int /*long*/ GetSource(int /*long*/ aSource) {
+public int /*long*/ GetSource (int /*long*/ aSource) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ GetTarget(int /*long*/ aTarget) {
+public int /*long*/ GetTarget (int /*long*/ aTarget) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ GetPersist(int /*long*/ aPersist) {
+public int /*long*/ GetPersist (int /*long*/ aPersist) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ GetPercentComplete(int /*long*/ aPercentComplete) {
+public int /*long*/ GetPercentComplete (int /*long*/ aPercentComplete) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ GetDisplayName(int /*long*/ aDisplayName) {
+public int /*long*/ GetDisplayName (int /*long*/ aDisplayName) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ SetDisplayName(int /*long*/ aDisplayName) {
+public int /*long*/ SetDisplayName (int /*long*/ aDisplayName) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ GetStartTime(int /*long*/ aStartTime) {
+public int /*long*/ GetStartTime (int /*long*/ aStartTime) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ GetMIMEInfo(int /*long*/ aMIMEInfo) {
+public int /*long*/ GetMIMEInfo (int /*long*/ aMIMEInfo) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ GetListener(int /*long*/ aListener) {
+public int /*long*/ GetListener (int /*long*/ aListener) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ SetListener(int /*long*/ aListener) {
+public int /*long*/ SetListener (int /*long*/ aListener) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ GetObserver(int /*long*/ aObserver) {
+public int /*long*/ GetObserver (int /*long*/ aObserver) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ SetObserver(int /*long*/ aObserver) {
+public int /*long*/ SetObserver (int /*long*/ aObserver) {
if (aObserver != 0) {
- nsISupports supports = new nsISupports(aObserver);
+ nsISupports supports = new nsISupports (aObserver);
int /*long*/[] result = new int /*long*/[1];
- int rc = supports.QueryInterface(nsIHelperAppLauncher.NS_IHELPERAPPLAUNCHER_IID, result);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- if (result[0] == 0) Mozilla.error(XPCOM.NS_ERROR_NO_INTERFACE);
- helperAppLauncher = new nsIHelperAppLauncher(result[0]);
+ int rc = supports.QueryInterface (nsIHelperAppLauncher.NS_IHELPERAPPLAUNCHER_IID, result);
+ if (rc != XPCOM.NS_OK) Mozilla.error (rc);
+ if (result[0] == 0) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE);
+ helperAppLauncher = new nsIHelperAppLauncher (result[0]);
}
return XPCOM.NS_OK;
}
/* nsIProgressDialog */
-public int /*long*/ Open(int /*long*/ aParent) {
+public int /*long*/ Open (int /*long*/ aParent) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ GetCancelDownloadOnClose(int /*long*/ aCancelDownloadOnClose) {
+public int /*long*/ GetCancelDownloadOnClose (int /*long*/ aCancelDownloadOnClose) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ SetCancelDownloadOnClose(int /*long*/ aCancelDownloadOnClose) {
+public int /*long*/ SetCancelDownloadOnClose (int /*long*/ aCancelDownloadOnClose) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ GetDialog(int /*long*/ aDialog) {
+public int /*long*/ GetDialog (int /*long*/ aDialog) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ SetDialog(int /*long*/ aDialog) {
+public int /*long*/ SetDialog (int /*long*/ aDialog) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIWebProgressListener */
-int /*long*/ OnStateChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aStateFlags, int /*long*/ aStatus) {
+int /*long*/ OnStateChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aStateFlags, int /*long*/ aStatus) {
if ((aStateFlags & nsIWebProgressListener.STATE_STOP) != 0) {
- if (helperAppLauncher != null) helperAppLauncher.Release();
+ if (helperAppLauncher != null) helperAppLauncher.Release ();
helperAppLauncher = null;
- if (shell != null && !shell.isDisposed()) shell.dispose();
+ if (shell != null && !shell.isDisposed ()) shell.dispose ();
shell = null;
}
return XPCOM.NS_OK;
}
-int /*long*/ OnProgressChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aCurSelfProgress, int /*long*/ aMaxSelfProgress, int /*long*/ aCurTotalProgress, int /*long*/ aMaxTotalProgress) {
+int /*long*/ OnProgressChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aCurSelfProgress, int /*long*/ aMaxSelfProgress, int /*long*/ aCurTotalProgress, int /*long*/ aMaxTotalProgress) {
int currentKBytes = (int)/*64*/aCurTotalProgress / 1024;
int totalKBytes = (int)/*64*/aMaxTotalProgress / 1024;
- if (shell != null & !shell.isDisposed()) {
- Object[] arguments = {new Integer(currentKBytes), new Integer(totalKBytes)};
- String statusMsg = Compatibility.getMessage("SWT_Download_Status", arguments); //$NON-NLS-1$
- status.setText(statusMsg);
- shell.layout(true);
- shell.getDisplay().update();
+ if (shell != null & !shell.isDisposed ()) {
+ Object[] arguments = {new Integer (currentKBytes), new Integer (totalKBytes)};
+ String statusMsg = Compatibility.getMessage ("SWT_Download_Status", arguments); //$NON-NLS-1$
+ status.setText (statusMsg);
+ shell.layout (true);
+ shell.getDisplay ().update ();
}
return XPCOM.NS_OK;
}
-int /*long*/ OnLocationChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aLocation) {
+int /*long*/ OnLocationChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aLocation) {
return XPCOM.NS_OK;
}
-
-int /*long*/ OnStatusChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aStatus, int /*long*/ aMessage) {
+
+int /*long*/ OnStatusChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aStatus, int /*long*/ aMessage) {
return XPCOM.NS_OK;
-}
+}
-int /*long*/ OnSecurityChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ state) {
+int /*long*/ OnSecurityChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ state) {
return XPCOM.NS_OK;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/DownloadFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/DownloadFactory.java
index f0cae7a0da..8a2937d856 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/DownloadFactory.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/DownloadFactory.java
@@ -10,91 +10,91 @@
*******************************************************************************/
package org.eclipse.swt.browser;
+import org.eclipse.swt.internal.C;
import org.eclipse.swt.internal.mozilla.*;
-import org.eclipse.swt.internal.gtk.OS;
class DownloadFactory {
XPCOMObject supports;
XPCOMObject factory;
int refCount = 0;
-public DownloadFactory() {
- createCOMInterfaces();
+public DownloadFactory () {
+ createCOMInterfaces ();
}
-int AddRef() {
+int AddRef () {
refCount++;
return refCount;
}
-void createCOMInterfaces() {
+void createCOMInterfaces () {
/* Create each of the interfaces that this object implements */
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
+ supports = new XPCOMObject (new int[] {2, 0, 0}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
};
- factory = new XPCOMObject(new int[]{2, 0, 0, 3, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return CreateInstance(args[0], args[1], args[2]);}
- public int /*long*/ method4(int /*long*/[] args) {return LockFactory(args[0]);}
+ factory = new XPCOMObject (new int[] {2, 0, 0, 3, 1}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return CreateInstance (args[0], args[1], args[2]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return LockFactory (args[0]);}
};
}
-void disposeCOMInterfaces() {
+void disposeCOMInterfaces () {
if (supports != null) {
- supports.dispose();
+ supports.dispose ();
supports = null;
}
if (factory != null) {
- factory.dispose();
+ factory.dispose ();
factory = null;
}
}
-int /*long*/ getAddress() {
- return factory.getAddress();
+int /*long*/ getAddress () {
+ return factory.getAddress ();
}
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
+int /*long*/ QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
+ nsID guid = new nsID ();
+ XPCOM.memmove (guid, riid, nsID.sizeof);
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, OS.PTR_SIZEOF);
- AddRef();
+ if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
return XPCOM.NS_OK;
}
- if (guid.Equals(nsIFactory.NS_IFACTORY_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {factory.getAddress()}, OS.PTR_SIZEOF);
- AddRef();
+ if (guid.Equals (nsIFactory.NS_IFACTORY_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {factory.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
return XPCOM.NS_OK;
}
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, OS.PTR_SIZEOF);
+ XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
return XPCOM.NS_ERROR_NO_INTERFACE;
}
-int Release() {
+int Release () {
refCount--;
- if (refCount == 0) disposeCOMInterfaces();
+ if (refCount == 0) disposeCOMInterfaces ();
return refCount;
}
/* nsIFactory */
-public int /*long*/ CreateInstance(int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
- Download download = new Download();
- download.AddRef();
- XPCOM.memmove(result, new int /*long*/[] {download.getAddress()}, OS.PTR_SIZEOF);
+public int /*long*/ CreateInstance (int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
+ Download download = new Download ();
+ download.AddRef ();
+ XPCOM.memmove (result, new int /*long*/[] {download.getAddress ()}, C.PTR_SIZEOF);
return XPCOM.NS_OK;
}
-public int /*long*/ LockFactory(int /*long*/ lock) {
+public int /*long*/ LockFactory (int /*long*/ lock) {
return XPCOM.NS_OK;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/DownloadFactory_1_8.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/DownloadFactory_1_8.java
index 711145c28c..ea7b67c154 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/DownloadFactory_1_8.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/DownloadFactory_1_8.java
@@ -10,91 +10,91 @@
*******************************************************************************/
package org.eclipse.swt.browser;
+import org.eclipse.swt.internal.C;
import org.eclipse.swt.internal.mozilla.*;
-import org.eclipse.swt.internal.gtk.OS;
class DownloadFactory_1_8 {
XPCOMObject supports;
XPCOMObject factory;
int refCount = 0;
-public DownloadFactory_1_8() {
- createCOMInterfaces();
+public DownloadFactory_1_8 () {
+ createCOMInterfaces ();
}
-int AddRef() {
+int AddRef () {
refCount++;
return refCount;
}
-void createCOMInterfaces() {
+void createCOMInterfaces () {
/* Create each of the interfaces that this object implements */
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
+ supports = new XPCOMObject (new int[] {2, 0, 0}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
};
- factory = new XPCOMObject(new int[]{2, 0, 0, 3, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return CreateInstance(args[0], args[1], args[2]);}
- public int /*long*/ method4(int /*long*/[] args) {return LockFactory(args[0]);}
+ factory = new XPCOMObject (new int[] {2, 0, 0, 3, 1}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return CreateInstance (args[0], args[1], args[2]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return LockFactory (args[0]);}
};
}
-void disposeCOMInterfaces() {
+void disposeCOMInterfaces () {
if (supports != null) {
- supports.dispose();
+ supports.dispose ();
supports = null;
}
if (factory != null) {
- factory.dispose();
+ factory.dispose ();
factory = null;
}
}
-int /*long*/ getAddress() {
- return factory.getAddress();
+int /*long*/ getAddress () {
+ return factory.getAddress ();
}
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
+int /*long*/ QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
+ nsID guid = new nsID ();
+ XPCOM.memmove (guid, riid, nsID.sizeof);
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, OS.PTR_SIZEOF);
- AddRef();
+ if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
return XPCOM.NS_OK;
}
- if (guid.Equals(nsIFactory.NS_IFACTORY_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {factory.getAddress()}, OS.PTR_SIZEOF);
- AddRef();
+ if (guid.Equals (nsIFactory.NS_IFACTORY_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {factory.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
return XPCOM.NS_OK;
}
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, OS.PTR_SIZEOF);
+ XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
return XPCOM.NS_ERROR_NO_INTERFACE;
}
-int Release() {
+int Release () {
refCount--;
- if (refCount == 0) disposeCOMInterfaces();
+ if (refCount == 0) disposeCOMInterfaces ();
return refCount;
}
-
+
/* nsIFactory */
-public int /*long*/ CreateInstance(int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
- Download_1_8 download = new Download_1_8();
- download.AddRef();
- XPCOM.memmove(result, new int /*long*/[] {download.getAddress()}, OS.PTR_SIZEOF);
+public int /*long*/ CreateInstance (int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
+ Download_1_8 download = new Download_1_8 ();
+ download.AddRef ();
+ XPCOM.memmove (result, new int /*long*/[] {download.getAddress ()}, C.PTR_SIZEOF);
return XPCOM.NS_OK;
}
-public int /*long*/ LockFactory(int /*long*/ lock) {
+public int /*long*/ LockFactory (int /*long*/ lock) {
return XPCOM.NS_OK;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/Download_1_8.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/Download_1_8.java
index 3486b92f6f..7830221820 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/Download_1_8.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/Download_1_8.java
@@ -13,7 +13,6 @@ package org.eclipse.swt.browser;
import org.eclipse.swt.SWT;
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.mozilla.*;
-import org.eclipse.swt.internal.gtk.OS;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
@@ -29,364 +28,364 @@ class Download_1_8 {
Label status;
Button cancel;
- static final boolean is32 = OS.PTR_SIZEOF == 4;
+ static final boolean is32 = C.PTR_SIZEOF == 4;
-public Download_1_8() {
- createCOMInterfaces();
+public Download_1_8 () {
+ createCOMInterfaces ();
}
-int AddRef() {
+int AddRef () {
refCount++;
return refCount;
}
-void createCOMInterfaces() {
+void createCOMInterfaces () {
/* Create each of the interfaces that this object implements */
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
+ supports = new XPCOMObject (new int[] {2, 0, 0}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
};
- download = new XPCOMObject(new int[]{2, 0, 0, 4, 6, 3, 4, 3, is32 ? 10 : 6, is32 ? 8 : 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return OnStateChange(args[0], args[1], args[2], args[3]);}
- public int /*long*/ method4(int /*long*/[] args) {return OnProgressChange(args[0], args[1], args[2], args[3], args[4], args[5]);}
- public int /*long*/ method5(int /*long*/[] args) {return OnLocationChange(args[0], args[1], args[2]);}
- public int /*long*/ method6(int /*long*/[] args) {return OnStatusChange(args[0], args[1], args[2], args[3]);}
- public int /*long*/ method7(int /*long*/[] args) {return OnSecurityChange(args[0], args[1], args[2]);}
- public int /*long*/ method8(int /*long*/[] args) {
+ download = new XPCOMObject (new int[] {2, 0, 0, 4, 6, 3, 4, 3, is32 ? 10 : 6, is32 ? 8 : 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return OnStateChange (args[0], args[1], args[2], args[3]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], args[2], args[3], args[4], args[5]);}
+ public int /*long*/ method5 (int /*long*/[] args) {return OnLocationChange (args[0], args[1], args[2]);}
+ public int /*long*/ method6 (int /*long*/[] args) {return OnStatusChange (args[0], args[1], args[2], args[3]);}
+ public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], args[2]);}
+ public int /*long*/ method8 (int /*long*/[] args) {
if (args.length == 10) {
- return OnProgressChange64_32(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]);
+ return OnProgressChange64_32 (args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]);
} else {
- return OnProgressChange64(args[0], args[1], args[2], args[3], args[4], args[5]);
+ return OnProgressChange64 (args[0], args[1], args[2], args[3], args[4], args[5]);
}
}
- public int /*long*/ method9(int /*long*/[] args) {
+ public int /*long*/ method9 (int /*long*/[] args) {
if (args.length == 8) {
- return Init_32(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
+ return Init_32 (args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
} else {
- return Init(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
+ return Init (args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
}
}
- public int /*long*/ method10(int /*long*/[] args) {return GetTargetFile(args[0]);}
- public int /*long*/ method11(int /*long*/[] args) {return GetPercentComplete(args[0]);}
- public int /*long*/ method12(int /*long*/[] args) {return GetAmountTransferred(args[0]);}
- public int /*long*/ method13(int /*long*/[] args) {return GetSize(args[0]);}
- public int /*long*/ method14(int /*long*/[] args) {return GetSource(args[0]);}
- public int /*long*/ method15(int /*long*/[] args) {return GetTarget(args[0]);}
- public int /*long*/ method16(int /*long*/[] args) {return GetCancelable(args[0]);}
- public int /*long*/ method17(int /*long*/[] args) {return GetDisplayName(args[0]);}
- public int /*long*/ method18(int /*long*/[] args) {return GetStartTime(args[0]);}
- public int /*long*/ method19(int /*long*/[] args) {return GetMIMEInfo(args[0]);}
+ public int /*long*/ method10 (int /*long*/[] args) {return GetTargetFile (args[0]);}
+ public int /*long*/ method11 (int /*long*/[] args) {return GetPercentComplete (args[0]);}
+ public int /*long*/ method12 (int /*long*/[] args) {return GetAmountTransferred (args[0]);}
+ public int /*long*/ method13 (int /*long*/[] args) {return GetSize (args[0]);}
+ public int /*long*/ method14 (int /*long*/[] args) {return GetSource (args[0]);}
+ public int /*long*/ method15 (int /*long*/[] args) {return GetTarget (args[0]);}
+ public int /*long*/ method16 (int /*long*/[] args) {return GetCancelable (args[0]);}
+ public int /*long*/ method17 (int /*long*/[] args) {return GetDisplayName (args[0]);}
+ public int /*long*/ method18 (int /*long*/[] args) {return GetStartTime (args[0]);}
+ public int /*long*/ method19 (int /*long*/[] args) {return GetMIMEInfo (args[0]);}
};
- progressDialog = new XPCOMObject(new int[]{2, 0, 0, 4, 6, 3, 4, 3, is32 ? 10 : 6, is32 ? 8 : 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return OnStateChange(args[0], args[1], args[2], args[3]);}
- public int /*long*/ method4(int /*long*/[] args) {return OnProgressChange(args[0], args[1], args[2], args[3], args[4], args[5]);}
- public int /*long*/ method5(int /*long*/[] args) {return OnLocationChange(args[0], args[1], args[2]);}
- public int /*long*/ method6(int /*long*/[] args) {return OnStatusChange(args[0], args[1], args[2], args[3]);}
- public int /*long*/ method7(int /*long*/[] args) {return OnSecurityChange(args[0], args[1], args[2]);}
- public int /*long*/ method8(int /*long*/[] args) {
+ progressDialog = new XPCOMObject (new int[] {2, 0, 0, 4, 6, 3, 4, 3, is32 ? 10 : 6, is32 ? 8 : 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return OnStateChange (args[0], args[1], args[2], args[3]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], args[2], args[3], args[4], args[5]);}
+ public int /*long*/ method5 (int /*long*/[] args) {return OnLocationChange (args[0], args[1], args[2]);}
+ public int /*long*/ method6 (int /*long*/[] args) {return OnStatusChange (args[0], args[1], args[2], args[3]);}
+ public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], args[2]);}
+ public int /*long*/ method8 (int /*long*/[] args) {
if (args.length == 10) {
- return OnProgressChange64_32(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]);
+ return OnProgressChange64_32 (args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]);
} else {
- return OnProgressChange64(args[0], args[1], args[2], args[3], args[4], args[5]);
+ return OnProgressChange64 (args[0], args[1], args[2], args[3], args[4], args[5]);
}
}
- public int /*long*/ method9(int /*long*/[] args) {
+ public int /*long*/ method9 (int /*long*/[] args) {
if (args.length == 8) {
- return Init_32(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
+ return Init_32 (args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
} else {
- return Init(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
+ return Init (args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
}
}
- public int /*long*/ method10(int /*long*/[] args) {return GetTargetFile(args[0]);}
- public int /*long*/ method11(int /*long*/[] args) {return GetPercentComplete(args[0]);}
- public int /*long*/ method12(int /*long*/[] args) {return GetAmountTransferred(args[0]);}
- public int /*long*/ method13(int /*long*/[] args) {return GetSize(args[0]);}
- public int /*long*/ method14(int /*long*/[] args) {return GetSource(args[0]);}
- public int /*long*/ method15(int /*long*/[] args) {return GetTarget(args[0]);}
- public int /*long*/ method16(int /*long*/[] args) {return GetCancelable(args[0]);}
- public int /*long*/ method17(int /*long*/[] args) {return GetDisplayName(args[0]);}
- public int /*long*/ method18(int /*long*/[] args) {return GetStartTime(args[0]);}
- public int /*long*/ method19(int /*long*/[] args) {return GetMIMEInfo(args[0]);}
- public int /*long*/ method20(int /*long*/[] args) {return Open(args[0]);}
- public int /*long*/ method21(int /*long*/[] args) {return GetCancelDownloadOnClose(args[0]);}
- public int /*long*/ method22(int /*long*/[] args) {return SetCancelDownloadOnClose(args[0]);}
- public int /*long*/ method23(int /*long*/[] args) {return GetObserver(args[0]);}
- public int /*long*/ method24(int /*long*/[] args) {return SetObserver(args[0]);}
- public int /*long*/ method25(int /*long*/[] args) {return GetDialog(args[0]);}
- public int /*long*/ method26(int /*long*/[] args) {return SetDialog(args[0]);}
+ public int /*long*/ method10 (int /*long*/[] args) {return GetTargetFile (args[0]);}
+ public int /*long*/ method11 (int /*long*/[] args) {return GetPercentComplete (args[0]);}
+ public int /*long*/ method12 (int /*long*/[] args) {return GetAmountTransferred (args[0]);}
+ public int /*long*/ method13 (int /*long*/[] args) {return GetSize (args[0]);}
+ public int /*long*/ method14 (int /*long*/[] args) {return GetSource (args[0]);}
+ public int /*long*/ method15 (int /*long*/[] args) {return GetTarget (args[0]);}
+ public int /*long*/ method16 (int /*long*/[] args) {return GetCancelable (args[0]);}
+ public int /*long*/ method17 (int /*long*/[] args) {return GetDisplayName (args[0]);}
+ public int /*long*/ method18 (int /*long*/[] args) {return GetStartTime (args[0]);}
+ public int /*long*/ method19 (int /*long*/[] args) {return GetMIMEInfo (args[0]);}
+ public int /*long*/ method20 (int /*long*/[] args) {return Open (args[0]);}
+ public int /*long*/ method21 (int /*long*/[] args) {return GetCancelDownloadOnClose (args[0]);}
+ public int /*long*/ method22 (int /*long*/[] args) {return SetCancelDownloadOnClose (args[0]);}
+ public int /*long*/ method23 (int /*long*/[] args) {return GetObserver (args[0]);}
+ public int /*long*/ method24 (int /*long*/[] args) {return SetObserver (args[0]);}
+ public int /*long*/ method25 (int /*long*/[] args) {return GetDialog (args[0]);}
+ public int /*long*/ method26 (int /*long*/[] args) {return SetDialog (args[0]);}
};
- webProgressListener = new XPCOMObject(new int[]{2, 0, 0, 4, 6, 3, 4, 3}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return OnStateChange(args[0], args[1], args[2],args[3]);}
- public int /*long*/ method4(int /*long*/[] args) {return OnProgressChange(args[0], args[1], args[2],args[3],args[4],args[5]);}
- public int /*long*/ method5(int /*long*/[] args) {return OnLocationChange(args[0], args[1], args[2]);}
- public int /*long*/ method6(int /*long*/[] args) {return OnStatusChange(args[0], args[1], args[2],args[3]);}
- public int /*long*/ method7(int /*long*/[] args) {return OnSecurityChange(args[0], args[1], args[2]);}
+ webProgressListener = new XPCOMObject (new int[] {2, 0, 0, 4, 6, 3, 4, 3}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return OnStateChange (args[0], args[1], args[2],args[3]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], args[2], args[3], args[4], args[5]);}
+ public int /*long*/ method5 (int /*long*/[] args) {return OnLocationChange (args[0], args[1], args[2]);}
+ public int /*long*/ method6 (int /*long*/[] args) {return OnStatusChange (args[0], args[1], args[2], args[3]);}
+ public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], args[2]);}
};
}
void disposeCOMInterfaces() {
if (supports != null) {
- supports.dispose();
+ supports.dispose ();
supports = null;
}
if (download != null) {
- download.dispose();
+ download.dispose ();
download = null;
}
if (progressDialog != null) {
- progressDialog.dispose();
+ progressDialog.dispose ();
progressDialog = null;
}
if (webProgressListener != null) {
- webProgressListener.dispose();
+ webProgressListener.dispose ();
webProgressListener = null;
}
}
-int /*long*/ getAddress() {
- return progressDialog.getAddress();
+int /*long*/ getAddress () {
+ return progressDialog.getAddress ();
}
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
+int /*long*/ QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
+ nsID guid = new nsID ();
+ XPCOM.memmove (guid, riid, nsID.sizeof);
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, OS.PTR_SIZEOF);
+ if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF);
AddRef();
return XPCOM.NS_OK;
}
- if (guid.Equals(nsIDownload_1_8.NS_IDOWNLOAD_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {download.getAddress()}, OS.PTR_SIZEOF);
+ if (guid.Equals (nsIDownload_1_8.NS_IDOWNLOAD_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {download.getAddress ()}, C.PTR_SIZEOF);
AddRef();
return XPCOM.NS_OK;
}
- if (guid.Equals(nsIProgressDialog_1_8.NS_IPROGRESSDIALOG_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {progressDialog.getAddress()}, OS.PTR_SIZEOF);
+ if (guid.Equals (nsIProgressDialog_1_8.NS_IPROGRESSDIALOG_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {progressDialog.getAddress ()}, C.PTR_SIZEOF);
AddRef();
return XPCOM.NS_OK;
}
- if (guid.Equals(nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {webProgressListener.getAddress()}, OS.PTR_SIZEOF);
+ if (guid.Equals (nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {webProgressListener.getAddress ()}, C.PTR_SIZEOF);
AddRef();
return XPCOM.NS_OK;
}
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, OS.PTR_SIZEOF);
+ XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
return XPCOM.NS_ERROR_NO_INTERFACE;
}
-int Release() {
+int Release () {
refCount--;
- if (refCount == 0) disposeCOMInterfaces();
+ if (refCount == 0) disposeCOMInterfaces ();
return refCount;
}
/* nsIDownload */
/* Note. The argument startTime is defined as a PRInt64. This translates into two java ints. */
-public int Init_32(int /*long*/ aSource, int /*long*/ aTarget, int /*long*/ aDisplayName, int /*long*/ aMIMEInfo, int /*long*/ startTime1, int /*long*/ startTime2, int /*long*/ aTempFile, int /*long*/ aCancelable) {
+public int Init_32 (int /*long*/ aSource, int /*long*/ aTarget, int /*long*/ aDisplayName, int /*long*/ aMIMEInfo, int /*long*/ startTime1, int /*long*/ startTime2, int /*long*/ aTempFile, int /*long*/ aCancelable) {
long startTime = (startTime2 << 32) + startTime1;
return Init (aSource, aTarget, aDisplayName, aMIMEInfo, startTime, aTempFile, aCancelable);
}
-public int Init(int /*long*/ aSource, int /*long*/ aTarget, int /*long*/ aDisplayName, int /*long*/ aMIMEInfo, long startTime, int /*long*/ aTempFile, int /*long*/ aCancelable) {
- cancelable = new nsICancelable(aCancelable);
- nsIURI source = new nsIURI(aSource);
- int /*long*/ aSpec = XPCOM.nsEmbedCString_new();
- int rc = source.GetHost(aSpec);
+public int Init (int /*long*/ aSource, int /*long*/ aTarget, int /*long*/ aDisplayName, int /*long*/ aMIMEInfo, long startTime, int /*long*/ aTempFile, int /*long*/ aCancelable) {
+ cancelable = new nsICancelable (aCancelable);
+ nsIURI source = new nsIURI (aSource);
+ int /*long*/ aSpec = XPCOM.nsEmbedCString_new ();
+ int rc = source.GetHost (aSpec);
if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- int length = XPCOM.nsEmbedCString_Length(aSpec);
- int /*long*/ buffer = XPCOM.nsEmbedCString_get(aSpec);
+ int length = XPCOM.nsEmbedCString_Length (aSpec);
+ int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec);
byte[] dest = new byte[length];
- XPCOM.memmove(dest, buffer, length);
- XPCOM.nsEmbedCString_delete(aSpec);
- String url = new String(dest);
-
- nsIURI target = new nsIURI(aTarget);
- int /*long*/ aPath = XPCOM.nsEmbedCString_new();
- rc = target.GetPath(aPath);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- length = XPCOM.nsEmbedCString_Length(aPath);
- buffer = XPCOM.nsEmbedCString_get(aPath);
+ XPCOM.memmove (dest, buffer, length);
+ XPCOM.nsEmbedCString_delete (aSpec);
+ String url = new String (dest);
+
+ nsIURI target = new nsIURI (aTarget);
+ int /*long*/ aPath = XPCOM.nsEmbedCString_new ();
+ rc = target.GetPath (aPath);
+ if (rc != XPCOM.NS_OK) Mozilla.error (rc);
+ length = XPCOM.nsEmbedCString_Length (aPath);
+ buffer = XPCOM.nsEmbedCString_get (aPath);
dest = new byte[length];
- XPCOM.memmove(dest, buffer, length);
- XPCOM.nsEmbedCString_delete(aPath);
- String filename = new String(dest);
- int separator = filename.lastIndexOf(System.getProperty("file.separator")); //$NON-NLS-1$
- filename = filename.substring(separator + 1);
+ XPCOM.memmove (dest, buffer, length);
+ XPCOM.nsEmbedCString_delete (aPath);
+ String filename = new String (dest);
+ int separator = filename.lastIndexOf (System.getProperty ("file.separator")); //$NON-NLS-1$
+ filename = filename.substring (separator + 1);
Listener listener = new Listener() {
- public void handleEvent(Event event) {
+ public void handleEvent (Event event) {
if (event.widget == cancel) {
- shell.close();
+ shell.close ();
}
if (cancelable != null) {
- int rc = cancelable.Cancel(XPCOM.NS_BINDING_ABORTED);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
+ int rc = cancelable.Cancel (XPCOM.NS_BINDING_ABORTED);
+ if (rc != XPCOM.NS_OK) Mozilla.error (rc);
}
shell = null;
cancelable = null;
}
};
- shell = new Shell(SWT.DIALOG_TRIM);
- String msg = Compatibility.getMessage("SWT_Download_File", new Object[] {filename}); //$NON-NLS-1$
- shell.setText(msg);
- GridLayout gridLayout = new GridLayout();
+ shell = new Shell (SWT.DIALOG_TRIM);
+ String msg = Compatibility.getMessage ("SWT_Download_File", new Object[] {filename}); //$NON-NLS-1$
+ shell.setText (msg);
+ GridLayout gridLayout = new GridLayout ();
gridLayout.marginHeight = 15;
gridLayout.marginWidth = 15;
gridLayout.verticalSpacing = 20;
- shell.setLayout(gridLayout);
- msg = Compatibility.getMessage("SWT_Download_Location", new Object[] {filename, url}); //$NON-NLS-1$
- new Label(shell, SWT.SIMPLE).setText(msg);
- status = new Label(shell, SWT.SIMPLE);
- msg = Compatibility.getMessage("SWT_Download_Started"); //$NON-NLS-1$
- status.setText(msg);
+ shell.setLayout (gridLayout);
+ msg = Compatibility.getMessage ("SWT_Download_Location", new Object[] {filename, url}); //$NON-NLS-1$
+ new Label (shell, SWT.SIMPLE).setText (msg);
+ status = new Label (shell, SWT.SIMPLE);
+ msg = Compatibility.getMessage ("SWT_Download_Started"); //$NON-NLS-1$
+ status.setText (msg);
GridData data = new GridData ();
data.grabExcessHorizontalSpace = true;
data.grabExcessVerticalSpace = true;
status.setLayoutData (data);
- cancel = new Button(shell, SWT.PUSH);
- cancel.setText(SWT.getMessage("SWT_Cancel")); //$NON-NLS-1$
+ cancel = new Button (shell, SWT.PUSH);
+ cancel.setText (SWT.getMessage ("SWT_Cancel")); //$NON-NLS-1$
data = new GridData ();
data.horizontalAlignment = GridData.CENTER;
cancel.setLayoutData (data);
- cancel.addListener(SWT.Selection, listener);
- shell.addListener(SWT.Close, listener);
- shell.pack();
- shell.open();
+ cancel.addListener (SWT.Selection, listener);
+ shell.addListener (SWT.Close, listener);
+ shell.pack ();
+ shell.open ();
return XPCOM.NS_OK;
}
-int /*long*/ GetAmountTransferred(int /*long*/ arg0) {
+int /*long*/ GetAmountTransferred (int /*long*/ arg0) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-int /*long*/ GetCancelable(int /*long*/ arg0) {
+int /*long*/ GetCancelable (int /*long*/ arg0) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ GetDisplayName(int /*long*/ aDisplayName) {
+public int /*long*/ GetDisplayName (int /*long*/ aDisplayName) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ GetMIMEInfo(int /*long*/ aMIMEInfo) {
+public int /*long*/ GetMIMEInfo (int /*long*/ aMIMEInfo) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ GetPercentComplete(int /*long*/ aPercentComplete) {
+public int /*long*/ GetPercentComplete (int /*long*/ aPercentComplete) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-int /*long*/ GetSize(int /*long*/ arg0) {
+int /*long*/ GetSize (int /*long*/ arg0) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ GetSource(int /*long*/ aSource) {
+public int /*long*/ GetSource (int /*long*/ aSource) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ GetStartTime(int /*long*/ aStartTime) {
+public int /*long*/ GetStartTime (int /*long*/ aStartTime) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ GetTarget(int /*long*/ aTarget) {
+public int /*long*/ GetTarget (int /*long*/ aTarget) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-int /*long*/ GetTargetFile(int /*long*/ arg0) {
+int /*long*/ GetTargetFile (int /*long*/ arg0) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIProgressDialog */
-public int /*long*/ GetCancelDownloadOnClose(int /*long*/ aCancelDownloadOnClose) {
+public int /*long*/ GetCancelDownloadOnClose (int /*long*/ aCancelDownloadOnClose) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ GetDialog(int /*long*/ aDialog) {
+public int /*long*/ GetDialog (int /*long*/ aDialog) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ GetObserver(int /*long*/ aObserver) {
+public int /*long*/ GetObserver (int /*long*/ aObserver) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ Open(int /*long*/ aParent) {
+public int /*long*/ Open (int /*long*/ aParent) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ SetCancelDownloadOnClose(int /*long*/ aCancelDownloadOnClose) {
+public int /*long*/ SetCancelDownloadOnClose (int /*long*/ aCancelDownloadOnClose) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ SetDialog(int /*long*/ aDialog) {
+public int /*long*/ SetDialog (int /*long*/ aDialog) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ SetObserver(int /*long*/ aObserver) {
+public int /*long*/ SetObserver (int /*long*/ aObserver) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIWebProgressListener */
-int /*long*/ OnLocationChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aLocation) {
+int /*long*/ OnLocationChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aLocation) {
return XPCOM.NS_OK;
}
-int /*long*/ OnProgressChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aCurSelfProgress, int /*long*/ aMaxSelfProgress, int /*long*/ aCurTotalProgress, int /*long*/ aMaxTotalProgress) {
- return OnProgressChange64(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
+int /*long*/ OnProgressChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aCurSelfProgress, int /*long*/ aMaxSelfProgress, int /*long*/ aCurTotalProgress, int /*long*/ aMaxTotalProgress) {
+ return OnProgressChange64 (aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
}
/* Note. The last 4 args in the original interface are defined as PRInt64. These each translate into two java ints. */
-int /*long*/ OnProgressChange64_32(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aCurSelfProgress1, int /*long*/ aCurSelfProgress2, int /*long*/ aMaxSelfProgress1, int /*long*/ aMaxSelfProgress2, int /*long*/ aCurTotalProgress1, int /*long*/ aCurTotalProgress2, int /*long*/ aMaxTotalProgress1, int /*long*/ aMaxTotalProgress2) {
+int /*long*/ OnProgressChange64_32 (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aCurSelfProgress1, int /*long*/ aCurSelfProgress2, int /*long*/ aMaxSelfProgress1, int /*long*/ aMaxSelfProgress2, int /*long*/ aCurTotalProgress1, int /*long*/ aCurTotalProgress2, int /*long*/ aMaxTotalProgress1, int /*long*/ aMaxTotalProgress2) {
long aCurSelfProgress = (aCurSelfProgress2 << 32) + aCurSelfProgress1;
long aMaxSelfProgress = (aMaxSelfProgress2 << 32) + aMaxSelfProgress1;
long aCurTotalProgress = (aCurTotalProgress2 << 32) + aCurTotalProgress1;
long aMaxTotalProgress = (aMaxTotalProgress2 << 32) + aMaxTotalProgress1;
- return OnProgressChange64(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
+ return OnProgressChange64 (aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
}
-int /*long*/ OnProgressChange64(int /*long*/ aWebProgress, int /*long*/ aRequest, long aCurSelfProgress, long aMaxSelfProgress, long aCurTotalProgress, long aMaxTotalProgress) {
+int /*long*/ OnProgressChange64 (int /*long*/ aWebProgress, int /*long*/ aRequest, long aCurSelfProgress, long aMaxSelfProgress, long aCurTotalProgress, long aMaxTotalProgress) {
long currentKBytes = aCurTotalProgress / 1024;
long totalKBytes = aMaxTotalProgress / 1024;
- if (shell != null & !shell.isDisposed()) {
- Object[] arguments = {new Long(currentKBytes), new Long(totalKBytes)};
- String statusMsg = Compatibility.getMessage("SWT_Download_Status", arguments); //$NON-NLS-1$
- status.setText(statusMsg);
- shell.layout(true);
- shell.getDisplay().update();
+ if (shell != null & !shell.isDisposed ()) {
+ Object[] arguments = {new Long (currentKBytes), new Long (totalKBytes)};
+ String statusMsg = Compatibility.getMessage ("SWT_Download_Status", arguments); //$NON-NLS-1$
+ status.setText (statusMsg);
+ shell.layout (true);
+ shell.getDisplay ().update ();
}
return XPCOM.NS_OK;
}
-int /*long*/ OnSecurityChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ state) {
+int /*long*/ OnSecurityChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ state) {
return XPCOM.NS_OK;
}
-int /*long*/ OnStateChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aStateFlags, int /*long*/ aStatus) {
+int /*long*/ OnStateChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aStateFlags, int /*long*/ aStatus) {
if ((aStateFlags & nsIWebProgressListener.STATE_STOP) != 0) {
cancelable = null;
- if (shell != null && !shell.isDisposed()) shell.dispose();
+ if (shell != null && !shell.isDisposed ()) shell.dispose ();
shell = null;
}
return XPCOM.NS_OK;
}
-int /*long*/ OnStatusChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aStatus, int /*long*/ aMessage) {
+int /*long*/ OnStatusChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aStatus, int /*long*/ aMessage) {
return XPCOM.NS_OK;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/FilePicker.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/FilePicker.java
index 3c3f1f00aa..3c52b67dff 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/FilePicker.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/FilePicker.java
@@ -11,9 +11,8 @@
package org.eclipse.swt.browser;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.internal.Converter;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.mozilla.*;
-import org.eclipse.swt.internal.gtk.OS;
import org.eclipse.swt.widgets.*;
class FilePicker {
@@ -21,7 +20,6 @@ class FilePicker {
XPCOMObject filePicker;
int refCount = 0;
-
int mode;
int /*long*/ parentHandle;
String[] files, masks;
@@ -40,31 +38,31 @@ int AddRef () {
void createCOMInterfaces () {
/* Create each of the interfaces that this object implements */
- supports = new XPCOMObject (new int[] {2, 0, 0}){
- public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface(args [0], args [1]);}
+ supports = new XPCOMObject (new int[] {2, 0, 0}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
};
filePicker = new XPCOMObject (new int[] {2, 0, 0, 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}) {
- public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args [0], args [1]);}
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
- public int /*long*/ method3 (int /*long*/[] args) {return Init (args [0], args [1], args [2]);}
- public int /*long*/ method4 (int /*long*/[] args) {return AppendFilters (args [0]);}
- public int /*long*/ method5 (int /*long*/[] args) {return AppendFilter (args [0], args [1]);}
- public int /*long*/ method6 (int /*long*/[] args) {return GetDefaultString (args [0]);}
- public int /*long*/ method7 (int /*long*/[] args) {return SetDefaultString (args [0]);}
- public int /*long*/ method8 (int /*long*/[] args) {return GetDefaultExtension (args [0]);}
- public int /*long*/ method9 (int /*long*/[] args) {return SetDefaultExtension (args [0]);}
- public int /*long*/ method10 (int /*long*/[] args) {return GetFilterIndex (args [0]);}
- public int /*long*/ method11 (int /*long*/[] args) {return SetFilterIndex (args [0]);}
- public int /*long*/ method12 (int /*long*/[] args) {return GetDisplayDirectory (args [0]);}
- public int /*long*/ method13 (int /*long*/[] args) {return SetDisplayDirectory (args [0]);}
- public int /*long*/ method14 (int /*long*/[] args) {return GetFile (args [0]);}
- public int /*long*/ method15 (int /*long*/[] args) {return GetFileURL (args [0]);}
- public int /*long*/ method16 (int /*long*/[] args) {return GetFiles (args [0]);}
- public int /*long*/ method17 (int /*long*/[] args) {return Show (args [0]);}
+ public int /*long*/ method3 (int /*long*/[] args) {return Init (args[0], args[1], args[2]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return AppendFilters (args[0]);}
+ public int /*long*/ method5 (int /*long*/[] args) {return AppendFilter (args[0], args[1]);}
+ public int /*long*/ method6 (int /*long*/[] args) {return GetDefaultString (args[0]);}
+ public int /*long*/ method7 (int /*long*/[] args) {return SetDefaultString (args[0]);}
+ public int /*long*/ method8 (int /*long*/[] args) {return GetDefaultExtension (args[0]);}
+ public int /*long*/ method9 (int /*long*/[] args) {return SetDefaultExtension (args[0]);}
+ public int /*long*/ method10 (int /*long*/[] args) {return GetFilterIndex (args[0]);}
+ public int /*long*/ method11 (int /*long*/[] args) {return SetFilterIndex (args[0]);}
+ public int /*long*/ method12 (int /*long*/[] args) {return GetDisplayDirectory (args[0]);}
+ public int /*long*/ method13 (int /*long*/[] args) {return SetDisplayDirectory (args[0]);}
+ public int /*long*/ method14 (int /*long*/[] args) {return GetFile (args[0]);}
+ public int /*long*/ method15 (int /*long*/[] args) {return GetFileURL (args[0]);}
+ public int /*long*/ method16 (int /*long*/[] args) {return GetFiles (args[0]);}
+ public int /*long*/ method17 (int /*long*/[] args) {return Show (args[0]);}
};
}
@@ -89,16 +87,16 @@ int /*long*/ QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
XPCOM.memmove (guid, riid, nsID.sizeof);
if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, OS.PTR_SIZEOF);
+ XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF);
AddRef ();
return XPCOM.NS_OK;
}
if (guid.Equals (nsIFilePicker.NS_IFILEPICKER_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {filePicker.getAddress ()}, OS.PTR_SIZEOF);
+ XPCOM.memmove(ppvObject, new int /*long*/[] {filePicker.getAddress ()}, C.PTR_SIZEOF);
AddRef ();
return XPCOM.NS_OK;
}
- XPCOM.memmove (ppvObject, new int /*long*/[] {0}, OS.PTR_SIZEOF);
+ XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
return XPCOM.NS_ERROR_NO_INTERFACE;
}
@@ -115,7 +113,7 @@ int /*long*/ Init (int /*long*/ parent, int /*long*/ title, int /*long*/ mode) {
this.mode = (int)/*64*/mode;
if (title != 0) {
int length = XPCOM.strlen_PRUnichar (title);
- char[] chars = new char [length];
+ char[] chars = new char[length];
XPCOM.memmove (chars, title, length * 2);
this.title = new String (chars);
}
@@ -127,18 +125,17 @@ int /*long*/ Show (int /*long*/ _retval) {
if (mode == nsIFilePicker.modeGetFolder) {
/* picking a directory */
int result = showDirectoryPicker ();
- XPCOM.memmove (_retval, new int /*long*/[] {result}, OS.PTR_SIZEOF);
+ XPCOM.memmove (_retval, new int /*long*/[] {result}, C.PTR_SIZEOF);
return XPCOM.NS_OK;
}
/* picking a file */
int style = mode == nsIFilePicker.modeSave ? SWT.SAVE : SWT.OPEN;
if (mode == nsIFilePicker.modeOpenMultiple) style |= SWT.MULTI;
- Shell parent;
- if (parentHandle != 0) {
- parent = Shell.gtk_new (Display.getCurrent (), parentHandle);
- } else {
- parent = new Shell (Display.getCurrent ());
+ Display display = Display.getCurrent ();
+ Shell parent = null; // TODO compute parent
+ if (parent == null) {
+ parent = new Shell (display);
}
FileDialog dialog = new FileDialog (parent, style);
if (title != null) dialog.setText (title);
@@ -151,16 +148,15 @@ int /*long*/ Show (int /*long*/ _retval) {
title = defaultFilename = null;
masks = null;
int result = filename == null ? nsIFilePicker.returnCancel : nsIFilePicker.returnOK;
- XPCOM.memmove (_retval, new int /*long*/[] {result}, OS.PTR_SIZEOF);
+ XPCOM.memmove (_retval, new int /*long*/[] {result}, C.PTR_SIZEOF);
return XPCOM.NS_OK;
}
int showDirectoryPicker () {
- Shell parent;
- if (parentHandle != 0) {
- parent = Shell.gtk_new (Display.getCurrent (), parentHandle);
- } else {
- parent = new Shell (Display.getCurrent ());
+ Display display = Display.getCurrent ();
+ Shell parent = null; // TODO compute parent
+ if (parent == null) {
+ parent = new Shell (display);
}
DirectoryDialog dialog = new DirectoryDialog (parent, SWT.NONE);
if (title != null) dialog.setText (title);
@@ -182,14 +178,14 @@ int /*long*/ GetFileURL (int /*long*/ aFileURL) {
int /*long*/ GetFile (int /*long*/ aFile) {
String filename = ""; //$NON-NLS-1$
if (directory != null) filename += directory + SEPARATOR;
- if (files != null && files.length > 0) filename += files [0];
+ if (files != null && files.length > 0) filename += files[0];
nsEmbedString path = new nsEmbedString (filename);
int /*long*/[] file = new int /*long*/[1];
int rc = XPCOM.NS_NewLocalFile (path.getAddress (), true, file);
path.dispose ();
if (rc != XPCOM.NS_OK) Mozilla.error (rc);
- if (file [0] == 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER);
- XPCOM.memmove (aFile, file, OS.PTR_SIZEOF);
+ if (file[0] == 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER);
+ XPCOM.memmove (aFile, file, C.PTR_SIZEOF);
return XPCOM.NS_OK;
}
@@ -200,10 +196,10 @@ int /*long*/ SetDisplayDirectory (int /*long*/ aDisplayDirectory) {
file.GetNativePath (pathname);
int length = XPCOM.nsEmbedCString_Length (pathname);
int /*long*/ buffer = XPCOM.nsEmbedCString_get (pathname);
- byte[] bytes = new byte [length];
+ byte[] bytes = new byte[length];
XPCOM.memmove (bytes, buffer, length);
XPCOM.nsEmbedCString_delete (pathname);
- char[] chars = Converter.mbcsToWcs (null, bytes);
+ char[] chars = MozillaDelegate.mbcsToWcs (null, bytes);
directory = new String (chars);
return XPCOM.NS_OK;
}
@@ -215,8 +211,8 @@ int /*long*/ GetDisplayDirectory (int /*long*/ aDisplayDirectory) {
int rc = XPCOM.NS_NewLocalFile (path.getAddress (), true, file);
path.dispose ();
if (rc != XPCOM.NS_OK) Mozilla.error (rc);
- if (file [0] == 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER);
- XPCOM.memmove (aDisplayDirectory, file, OS.PTR_SIZEOF);
+ if (file[0] == 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER);
+ XPCOM.memmove (aDisplayDirectory, file, C.PTR_SIZEOF);
return XPCOM.NS_OK;
}
@@ -239,7 +235,7 @@ int /*long*/ GetDefaultExtension (int /*long*/ aDefaultExtension) {
int /*long*/ SetDefaultString (int /*long*/ aDefaultString) {
if (aDefaultString == 0) return XPCOM.NS_OK;
int length = XPCOM.strlen_PRUnichar (aDefaultString);
- char[] chars = new char [length];
+ char[] chars = new char[length];
XPCOM.memmove (chars, aDefaultString, length * 2);
defaultFilename = new String (chars);
return XPCOM.NS_OK;
@@ -280,7 +276,7 @@ int /*long*/ AppendFilters (int /*long*/ filterMask) {
masks = addFilters;
} else {
if (addFilters != null) {
- String[] newFilters = new String [masks.length + addFilters.length];
+ String[] newFilters = new String[masks.length + addFilters.length];
System.arraycopy (masks, 0, newFilters, 0, masks.length);
System.arraycopy (addFilters, 0, newFilters, masks.length, addFilters.length);
masks = newFilters;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/FilePickerFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/FilePickerFactory.java
index e57d5f8379..bf2d41f728 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/FilePickerFactory.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/FilePickerFactory.java
@@ -10,91 +10,91 @@
*******************************************************************************/
package org.eclipse.swt.browser;
+import org.eclipse.swt.internal.C;
import org.eclipse.swt.internal.mozilla.*;
-import org.eclipse.swt.internal.gtk.OS;
class FilePickerFactory {
XPCOMObject supports;
XPCOMObject factory;
int refCount = 0;
-public FilePickerFactory() {
- createCOMInterfaces();
+public FilePickerFactory () {
+ createCOMInterfaces ();
}
-int AddRef() {
+int AddRef () {
refCount++;
return refCount;
}
-void createCOMInterfaces() {
+void createCOMInterfaces () {
/* Create each of the interfaces that this object implements */
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
+ supports = new XPCOMObject (new int[] {2, 0, 0}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
};
- factory = new XPCOMObject(new int[]{2, 0, 0, 3, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return CreateInstance(args[0], args[1], args[2]);}
- public int /*long*/ method4(int /*long*/[] args) {return LockFactory(args[0]);}
+ factory = new XPCOMObject (new int[] {2, 0, 0, 3, 1}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return CreateInstance (args[0], args[1], args[2]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return LockFactory (args[0]);}
};
}
-void disposeCOMInterfaces() {
+void disposeCOMInterfaces () {
if (supports != null) {
- supports.dispose();
+ supports.dispose ();
supports = null;
}
if (factory != null) {
- factory.dispose();
+ factory.dispose ();
factory = null;
}
}
-int /*long*/ getAddress() {
- return factory.getAddress();
+int /*long*/ getAddress () {
+ return factory.getAddress ();
}
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
+int /*long*/ QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
+ nsID guid = new nsID ();
+ XPCOM.memmove (guid, riid, nsID.sizeof);
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, OS.PTR_SIZEOF);
- AddRef();
+ if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
return XPCOM.NS_OK;
}
- if (guid.Equals(nsIFactory.NS_IFACTORY_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {factory.getAddress()}, OS.PTR_SIZEOF);
- AddRef();
+ if (guid.Equals (nsIFactory.NS_IFACTORY_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {factory.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
return XPCOM.NS_OK;
}
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, OS.PTR_SIZEOF);
+ XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
return XPCOM.NS_ERROR_NO_INTERFACE;
}
-int Release() {
+int Release () {
refCount--;
- if (refCount == 0) disposeCOMInterfaces();
+ if (refCount == 0) disposeCOMInterfaces ();
return refCount;
}
/* nsIFactory */
-public int /*long*/ CreateInstance(int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
+public int /*long*/ CreateInstance (int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
FilePicker picker = new FilePicker ();
- picker.AddRef();
- XPCOM.memmove(result, new int /*long*/[] {picker.getAddress()}, OS.PTR_SIZEOF);
+ picker.AddRef ();
+ XPCOM.memmove (result, new int /*long*/[] {picker.getAddress ()}, C.PTR_SIZEOF);
return XPCOM.NS_OK;
}
-public int /*long*/ LockFactory(int /*long*/ lock) {
+public int /*long*/ LockFactory (int /*long*/ lock) {
return XPCOM.NS_OK;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/HelperAppLauncherDialog.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/HelperAppLauncherDialog.java
index 35e68aaee0..e7fa2f93a9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/HelperAppLauncherDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/HelperAppLauncherDialog.java
@@ -11,8 +11,8 @@
package org.eclipse.swt.browser;
import org.eclipse.swt.*;
+import org.eclipse.swt.internal.C;
import org.eclipse.swt.internal.mozilla.*;
-import org.eclipse.swt.internal.gtk.OS;
import org.eclipse.swt.widgets.*;
class HelperAppLauncherDialog {
@@ -20,68 +20,68 @@ class HelperAppLauncherDialog {
XPCOMObject helperAppLauncherDialog;
int refCount = 0;
-public HelperAppLauncherDialog() {
- createCOMInterfaces();
+public HelperAppLauncherDialog () {
+ createCOMInterfaces ();
}
-int AddRef() {
+int AddRef () {
refCount++;
return refCount;
}
-void createCOMInterfaces() {
+void createCOMInterfaces () {
/* Create each of the interfaces that this object implements */
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
+ supports = new XPCOMObject (new int[] {2, 0, 0}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
};
- helperAppLauncherDialog = new XPCOMObject(new int[]{2, 0, 0, 3, 5}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return Show(args[0], args[1], args[2]);}
- public int /*long*/ method4(int /*long*/[] args) {return PromptForSaveToFile(args[0], args[1], args[2], args[3], args[4]);}
+ helperAppLauncherDialog = new XPCOMObject (new int[] {2, 0, 0, 3, 5}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return Show (args[0], args[1], args[2]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return PromptForSaveToFile (args[0], args[1], args[2], args[3], args[4]);}
};
}
-void disposeCOMInterfaces() {
+void disposeCOMInterfaces () {
if (supports != null) {
- supports.dispose();
+ supports.dispose ();
supports = null;
}
if (helperAppLauncherDialog != null) {
- helperAppLauncherDialog.dispose();
+ helperAppLauncherDialog.dispose ();
helperAppLauncherDialog = null;
}
}
-int /*long*/ getAddress() {
- return helperAppLauncherDialog.getAddress();
+int /*long*/ getAddress () {
+ return helperAppLauncherDialog.getAddress ();
}
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
+int /*long*/ QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
+ nsID guid = new nsID ();
+ XPCOM.memmove (guid, riid, nsID.sizeof);
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, OS.PTR_SIZEOF);
- AddRef();
+ if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
return XPCOM.NS_OK;
}
- if (guid.Equals(nsIHelperAppLauncherDialog.NS_IHELPERAPPLAUNCHERDIALOG_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {helperAppLauncherDialog.getAddress()}, OS.PTR_SIZEOF);
- AddRef();
+ if (guid.Equals (nsIHelperAppLauncherDialog.NS_IHELPERAPPLAUNCHERDIALOG_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {helperAppLauncherDialog.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
return XPCOM.NS_OK;
}
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, OS.PTR_SIZEOF);
+ XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
return XPCOM.NS_ERROR_NO_INTERFACE;
}
-int Release() {
+int Release () {
refCount--;
/*
* Note. This instance lives as long as the download it is binded to.
@@ -90,32 +90,32 @@ int Release() {
* cancels the File Dialog, cancels or closes the Download Dialog
* and when the Download Dialog goes away after the download is completed.
*/
- if (refCount == 0) disposeCOMInterfaces();
+ if (refCount == 0) disposeCOMInterfaces ();
return refCount;
}
/* nsIHelperAppLauncherDialog */
-public int /*long*/ Show(int /*long*/ aLauncher, int /*long*/ aContext, int /*long*/ aReason) {
+public int /*long*/ Show (int /*long*/ aLauncher, int /*long*/ aContext, int /*long*/ aReason) {
/*
* The interface for nsIHelperAppLauncher changed as of mozilla 1.8. Query the received
* nsIHelperAppLauncher for the new interface, and if it is not found then fall back to
* the old interface.
*/
- nsISupports supports = new nsISupports(aLauncher);
+ nsISupports supports = new nsISupports (aLauncher);
int /*long*/[] result = new int /*long*/[1];
- int rc = supports.QueryInterface(nsIHelperAppLauncher_1_8.NS_IHELPERAPPLAUNCHER_IID, result);
+ int rc = supports.QueryInterface (nsIHelperAppLauncher_1_8.NS_IHELPERAPPLAUNCHER_IID, result);
if (rc == 0) { /* >= 1.8 */
- nsIHelperAppLauncher_1_8 helperAppLauncher = new nsIHelperAppLauncher_1_8(aLauncher);
- rc = helperAppLauncher.SaveToDisk(0, false);
- helperAppLauncher.Release();
+ nsIHelperAppLauncher_1_8 helperAppLauncher = new nsIHelperAppLauncher_1_8 (aLauncher);
+ rc = helperAppLauncher.SaveToDisk (0, false);
+ helperAppLauncher.Release ();
return rc;
}
- nsIHelperAppLauncher helperAppLauncher = new nsIHelperAppLauncher(aLauncher); /* < 1.8 */
- return helperAppLauncher.SaveToDisk(0, false);
+ nsIHelperAppLauncher helperAppLauncher = new nsIHelperAppLauncher (aLauncher); /* < 1.8 */
+ return helperAppLauncher.SaveToDisk (0, false);
}
-public int /*long*/ PromptForSaveToFile(int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ arg3, int /*long*/ arg4) {
+public int /*long*/ PromptForSaveToFile (int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ arg3, int /*long*/ arg4) {
int /*long*/ aDefaultFile, aSuggestedFileExtension, _retval;
boolean hasLauncher = false;
@@ -132,21 +132,21 @@ public int /*long*/ PromptForSaveToFile(int /*long*/ arg0, int /*long*/ arg1, in
* The interface for nsIHelperAppLauncher changed as of mozilla 1.8, so the first
* argument must be queried for both the old and new nsIHelperAppLauncher interfaces.
*/
- nsISupports support = new nsISupports(arg0);
+ nsISupports support = new nsISupports (arg0);
int /*long*/[] result = new int /*long*/[1];
- int rc = support.QueryInterface(nsIHelperAppLauncher_1_8.NS_IHELPERAPPLAUNCHER_IID, result);
+ int rc = support.QueryInterface (nsIHelperAppLauncher_1_8.NS_IHELPERAPPLAUNCHER_IID, result);
boolean usingMozilla18 = rc == 0;
if (usingMozilla18) {
hasLauncher = true;
- nsISupports supports = new nsISupports(result[0]);
- supports.Release();
+ nsISupports supports = new nsISupports (result[0]);
+ supports.Release ();
} else {
result[0] = 0;
- rc = support.QueryInterface(nsIHelperAppLauncher.NS_IHELPERAPPLAUNCHER_IID, result);
+ rc = support.QueryInterface (nsIHelperAppLauncher.NS_IHELPERAPPLAUNCHER_IID, result);
if (rc == 0) {
hasLauncher = true;
- nsISupports supports = new nsISupports(result[0]);
- supports.Release();
+ nsISupports supports = new nsISupports (result[0]);
+ supports.Release ();
}
}
result[0] = 0;
@@ -161,43 +161,43 @@ public int /*long*/ PromptForSaveToFile(int /*long*/ arg0, int /*long*/ arg1, in
_retval = arg3;
}
- int length = XPCOM.strlen_PRUnichar(aDefaultFile);
+ int length = XPCOM.strlen_PRUnichar (aDefaultFile);
char[] dest = new char[length];
- XPCOM.memmove(dest, aDefaultFile, length * 2);
- String defaultFile = new String(dest);
+ XPCOM.memmove (dest, aDefaultFile, length * 2);
+ String defaultFile = new String (dest);
- length = XPCOM.strlen_PRUnichar(aSuggestedFileExtension);
+ length = XPCOM.strlen_PRUnichar (aSuggestedFileExtension);
dest = new char[length];
- XPCOM.memmove(dest, aSuggestedFileExtension, length * 2);
- String suggestedFileExtension = new String(dest);
-
- Shell shell = new Shell();
- FileDialog fileDialog = new FileDialog(shell, SWT.SAVE);
- fileDialog.setFileName(defaultFile);
- fileDialog.setFilterExtensions(new String[] {suggestedFileExtension});
- String name = fileDialog.open();
- shell.close();
+ XPCOM.memmove (dest, aSuggestedFileExtension, length * 2);
+ String suggestedFileExtension = new String (dest);
+
+ Shell shell = new Shell ();
+ FileDialog fileDialog = new FileDialog (shell, SWT.SAVE);
+ fileDialog.setFileName (defaultFile);
+ fileDialog.setFilterExtensions (new String[] {suggestedFileExtension});
+ String name = fileDialog.open ();
+ shell.close ();
if (name == null) {
if (hasLauncher) {
if (usingMozilla18) {
- nsIHelperAppLauncher_1_8 launcher = new nsIHelperAppLauncher_1_8(arg0);
- rc = launcher.Cancel(XPCOM.NS_BINDING_ABORTED);
+ nsIHelperAppLauncher_1_8 launcher = new nsIHelperAppLauncher_1_8 (arg0);
+ rc = launcher.Cancel (XPCOM.NS_BINDING_ABORTED);
} else {
- nsIHelperAppLauncher launcher = new nsIHelperAppLauncher(arg0);
- rc = launcher.Cancel();
+ nsIHelperAppLauncher launcher = new nsIHelperAppLauncher (arg0);
+ rc = launcher.Cancel ();
}
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
+ if (rc != XPCOM.NS_OK) Mozilla.error (rc);
return XPCOM.NS_OK;
}
return XPCOM.NS_ERROR_FAILURE;
}
- nsEmbedString path = new nsEmbedString(name);
- rc = XPCOM.NS_NewLocalFile(path.getAddress(), true, result);
- path.dispose();
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- if (result[0] == 0) Mozilla.error(XPCOM.NS_ERROR_NULL_POINTER);
+ nsEmbedString path = new nsEmbedString (name);
+ rc = XPCOM.NS_NewLocalFile (path.getAddress (), true, result);
+ path.dispose ();
+ if (rc != XPCOM.NS_OK) Mozilla.error (rc);
+ if (result[0] == 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER);
/* Our own nsIDownload has been registered during the Browser initialization. It will be invoked by Mozilla. */
- XPCOM.memmove(_retval, result, OS.PTR_SIZEOF);
+ XPCOM.memmove (_retval, result, C.PTR_SIZEOF);
return XPCOM.NS_OK;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/HelperAppLauncherDialogFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/HelperAppLauncherDialogFactory.java
index 4ff6c9d35a..b48e422e5d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/HelperAppLauncherDialogFactory.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/HelperAppLauncherDialogFactory.java
@@ -10,91 +10,91 @@
*******************************************************************************/
package org.eclipse.swt.browser;
+import org.eclipse.swt.internal.C;
import org.eclipse.swt.internal.mozilla.*;
-import org.eclipse.swt.internal.gtk.OS;
class HelperAppLauncherDialogFactory {
XPCOMObject supports;
XPCOMObject factory;
int refCount = 0;
-public HelperAppLauncherDialogFactory() {
- createCOMInterfaces();
+public HelperAppLauncherDialogFactory () {
+ createCOMInterfaces ();
}
-int AddRef() {
+int AddRef () {
refCount++;
return refCount;
}
-void createCOMInterfaces() {
+void createCOMInterfaces () {
/* Create each of the interfaces that this object implements */
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
+ supports = new XPCOMObject (new int[] {2, 0, 0}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
};
- factory = new XPCOMObject(new int[]{2, 0, 0, 3, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return CreateInstance(args[0], args[1], args[2]);}
- public int /*long*/ method4(int /*long*/[] args) {return LockFactory(args[0]);}
+ factory = new XPCOMObject (new int[] {2, 0, 0, 3, 1}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return CreateInstance (args[0], args[1], args[2]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return LockFactory (args[0]);}
};
}
-void disposeCOMInterfaces() {
+void disposeCOMInterfaces () {
if (supports != null) {
- supports.dispose();
+ supports.dispose ();
supports = null;
}
if (factory != null) {
- factory.dispose();
+ factory.dispose ();
factory = null;
}
}
-int /*long*/ getAddress() {
- return factory.getAddress();
+int /*long*/ getAddress () {
+ return factory.getAddress ();
}
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
+int /*long*/ QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
+ nsID guid = new nsID ();
+ XPCOM.memmove (guid, riid, nsID.sizeof);
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, OS.PTR_SIZEOF);
- AddRef();
+ if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
return XPCOM.NS_OK;
}
- if (guid.Equals(nsIFactory.NS_IFACTORY_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {factory.getAddress()}, OS.PTR_SIZEOF);
- AddRef();
+ if (guid.Equals (nsIFactory.NS_IFACTORY_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {factory.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
return XPCOM.NS_OK;
}
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, OS.PTR_SIZEOF);
+ XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
return XPCOM.NS_ERROR_NO_INTERFACE;
}
-int Release() {
+int Release () {
refCount--;
- if (refCount == 0) disposeCOMInterfaces();
+ if (refCount == 0) disposeCOMInterfaces ();
return refCount;
}
/* nsIFactory */
-public int /*long*/ CreateInstance(int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
- HelperAppLauncherDialog helperAppLauncherDialog = new HelperAppLauncherDialog();
- helperAppLauncherDialog.AddRef();
- XPCOM.memmove(result, new int /*long*/[] {helperAppLauncherDialog.getAddress()}, OS.PTR_SIZEOF);
+public int /*long*/ CreateInstance (int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
+ HelperAppLauncherDialog helperAppLauncherDialog = new HelperAppLauncherDialog ();
+ helperAppLauncherDialog.AddRef ();
+ XPCOM.memmove (result, new int /*long*/[] {helperAppLauncherDialog.getAddress ()}, C.PTR_SIZEOF);
return XPCOM.NS_OK;
}
-public int /*long*/ LockFactory(int /*long*/ lock) {
+public int /*long*/ LockFactory (int /*long*/ lock) {
return XPCOM.NS_OK;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/InputStream.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/InputStream.java
index 46e685db3a..3800e3a963 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/InputStream.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/InputStream.java
@@ -10,8 +10,8 @@
*******************************************************************************/
package org.eclipse.swt.browser;
+import org.eclipse.swt.internal.C;
import org.eclipse.swt.internal.mozilla.*;
-import org.eclipse.swt.internal.gtk.OS;
class InputStream {
XPCOMObject inputStream;
@@ -20,110 +20,110 @@ class InputStream {
byte[] buffer;
int index = 0;
-public InputStream(byte[] buffer) {
+public InputStream (byte[] buffer) {
this.buffer = buffer;
index = 0;
- createCOMInterfaces();
+ createCOMInterfaces ();
}
-int AddRef() {
+int AddRef () {
refCount++;
return refCount;
}
-void createCOMInterfaces() {
+void createCOMInterfaces () {
/* Create each of the interfaces that this object implements */
- inputStream = new XPCOMObject(new int[]{2, 0, 0, 0, 1, 3, 4, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return Close();}
- public int /*long*/ method4(int /*long*/[] args) {return Available(args[0]);}
- public int /*long*/ method5(int /*long*/[] args) {return Read(args[0], args[1], args[2]);}
- public int /*long*/ method6(int /*long*/[] args) {return ReadSegments(args[0], args[1], args[2], args[3]);}
- public int /*long*/ method7(int /*long*/[] args) {return IsNonBlocking(args[0]);}
+ inputStream = new XPCOMObject (new int[] {2, 0, 0, 0, 1, 3, 4, 1}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return Close ();}
+ public int /*long*/ method4 (int /*long*/[] args) {return Available (args[0]);}
+ public int /*long*/ method5 (int /*long*/[] args) {return Read (args[0], args[1], args[2]);}
+ public int /*long*/ method6 (int /*long*/[] args) {return ReadSegments (args[0], args[1], args[2], args[3]);}
+ public int /*long*/ method7 (int /*long*/[] args) {return IsNonBlocking (args[0]);}
};
}
-void disposeCOMInterfaces() {
+void disposeCOMInterfaces () {
if (inputStream != null) {
- inputStream.dispose();
+ inputStream.dispose ();
inputStream = null;
}
}
-int /*long*/ getAddress() {
- return inputStream.getAddress();
+int /*long*/ getAddress () {
+ return inputStream.getAddress ();
}
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
+int /*long*/ QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
+ nsID guid = new nsID ();
+ XPCOM.memmove (guid, riid, nsID.sizeof);
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {inputStream.getAddress()}, OS.PTR_SIZEOF);
- AddRef();
+ if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {inputStream.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
return XPCOM.NS_OK;
}
- if (guid.Equals(nsIInputStream.NS_IINPUTSTREAM_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {inputStream.getAddress()}, OS.PTR_SIZEOF);
- AddRef();
+ if (guid.Equals (nsIInputStream.NS_IINPUTSTREAM_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {inputStream.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
return XPCOM.NS_OK;
}
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, OS.PTR_SIZEOF);
+ XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
return XPCOM.NS_ERROR_NO_INTERFACE;
}
-int Release() {
+int Release () {
refCount--;
- if (refCount == 0) disposeCOMInterfaces();
+ if (refCount == 0) disposeCOMInterfaces ();
return refCount;
}
/* nsIInputStream implementation */
-int /*long*/ Close() {
+int /*long*/ Close () {
buffer = null;
index = 0;
return XPCOM.NS_OK;
}
-int /*long*/ Available(int /*long*/ _retval) {
+int /*long*/ Available (int /*long*/ _retval) {
int available = buffer == null ? 0 : buffer.length - index;
- XPCOM.memmove(_retval, new int[] {available}, 4);
+ XPCOM.memmove (_retval, new int[] {available}, 4);
return XPCOM.NS_OK;
}
int /*long*/ Read(int /*long*/ aBuf, int /*long*/ aCount, int /*long*/ _retval) {
- int max = Math.min((int)/*64*/aCount, buffer == null ? 0 : buffer.length - index);
+ int max = Math.min ((int)/*64*/aCount, buffer == null ? 0 : buffer.length - index);
if (max > 0) {
byte[] src = new byte[max];
- System.arraycopy(buffer, index, src, 0, max);
- XPCOM.memmove(aBuf, src, max);
+ System.arraycopy (buffer, index, src, 0, max);
+ XPCOM.memmove (aBuf, src, max);
index += max;
}
XPCOM.memmove(_retval, new int[] {max}, 4);
return XPCOM.NS_OK;
}
-int /*long*/ ReadSegments(int /*long*/ aWriter, int /*long*/ aClosure, int /*long*/ aCount, int /*long*/ _retval) {
- int max = Math.min((int)/*64*/aCount, buffer == null ? 0 : buffer.length - index);
+int /*long*/ ReadSegments (int /*long*/ aWriter, int /*long*/ aClosure, int /*long*/ aCount, int /*long*/ _retval) {
+ int max = Math.min ((int)/*64*/aCount, buffer == null ? 0 : buffer.length - index);
int cnt = max;
while (cnt > 0) {
int[] aWriteCount = new int[1];
- int /*long*/ rc = XPCOM.Call(aWriter, getAddress(), aClosure, buffer, index, cnt, aWriteCount);
+ int /*long*/ rc = XPCOM.Call (aWriter, getAddress (), aClosure, buffer, index, cnt, aWriteCount);
if (rc != XPCOM.NS_OK) break;
index += aWriteCount[0];
cnt -= aWriteCount[0];
}
- XPCOM.memmove(_retval, new int[] {max - cnt}, 4);
+ XPCOM.memmove (_retval, new int[] {max - cnt}, 4);
return XPCOM.NS_OK;
}
-int /*long*/ IsNonBlocking(int /*long*/ _retval) {
+int /*long*/ IsNonBlocking (int /*long*/ _retval) {
/* blocking */
- XPCOM.memmove(_retval, new int[] {0}, 4);
+ XPCOM.memmove (_retval, new int[] {0}, 4);
return XPCOM.NS_OK;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/Mozilla.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/Mozilla.java
new file mode 100644
index 0000000000..f1155c0184
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/Mozilla.java
@@ -0,0 +1,2144 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.browser;
+
+import java.io.*;
+import java.util.*;
+import org.eclipse.swt.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.mozilla.*;
+import org.eclipse.swt.layout.*;
+
+class Mozilla extends WebBrowser {
+ int /*long*/ embedHandle;
+ nsIWebBrowser webBrowser;
+ MozillaDelegate delegate;
+
+ /* Interfaces for this Mozilla embedding notification */
+ XPCOMObject supports;
+ XPCOMObject weakReference;
+ XPCOMObject webProgressListener;
+ XPCOMObject webBrowserChrome;
+ XPCOMObject webBrowserChromeFocus;
+ XPCOMObject embeddingSiteWindow;
+ XPCOMObject interfaceRequestor;
+ XPCOMObject supportsWeakReference;
+ XPCOMObject contextMenuListener;
+ XPCOMObject uriContentListener;
+ XPCOMObject tooltipListener;
+ XPCOMObject directoryServiceProviderListener;
+ int chromeFlags = nsIWebBrowserChrome.CHROME_DEFAULT;
+ int refCount = 0;
+ int /*long*/ request;
+ Point location;
+ Point size;
+ boolean addressBar, menuBar, statusBar, toolBar;
+ boolean visible, isModal;
+ Shell tip = null;
+
+ static nsIAppShell AppShell;
+ static WindowCreator WindowCreator;
+ static int BrowserCount;
+ static boolean initialized, ignoreDispose;
+ static String profileRootDirectory;
+
+ /* XULRunner detect constants */
+ static final String GRERANGE_LOWER = "1.8"; //$NON-NLS-1$
+ static final boolean LowerRangeInclusive = true;
+ static final String GRERANGE_UPPER = "1.9"; //$NON-NLS-1$
+ static final boolean UpperRangeInclusive = false;
+ static final String SEPARATOR_OS = System.getProperty("file.separator"); //$NON-NLS-1$
+ static final String XPCOM_LIB = SEPARATOR_OS + "libxpcom.so"; //$NON-NLS-1$
+
+ /* Package Name */
+ static final String URI_FROMMEMORY = "file:///"; //$NON-NLS-1$
+ static final String ABOUT_BLANK = "about:blank"; //$NON-NLS-1$
+ static final String PREFERENCE_LANGUAGES = "intl.accept_languages"; //$NON-NLS-1$
+ static final String PREFERENCE_CHARSET = "intl.charset.default"; //$NON-NLS-1$
+ static final String SEPARATOR_LOCALE = "-"; //$NON-NLS-1$
+ static final String TOKENIZER_LOCALE = ","; //$NON-NLS-1$
+ static final String PROFILE_DIR = SEPARATOR_OS + "eclipse" + SEPARATOR_OS; //$NON-NLS-1$
+ static final String HISTORY_FILE = "history.dat"; //$NON-NLS-1$
+ static final String MIMETYPES_FILE = "mimeTypes.rdf"; //$NON-NLS-1$
+ static final String PREFERENCES_FILE = "prefs.js"; //$NON-NLS-1$
+ static final String CHROME_DIR = "chrome"; //$NON-NLS-1$
+ static final String LOCALSTORE_FILE = "localstore.rdf"; //$NON-NLS-1$
+ static final String PROFILE_AFTER_CHANGE = "profile-after-change"; //$NON-NLS-1$
+ static final String PROFILE_BEFORE_CHANGE = "profile-before-change"; //$NON-NLS-1$
+ static final String PROFILE_DO_CHANGE = "profile-do-change"; //$NON-NLS-1$
+ static final String SHUTDOWN_PERSIST = "shutdown-persist"; //$NON-NLS-1$
+ static final String STARTUP = "startup"; //$NON-NLS-1$
+
+ static {
+ MozillaClearSessions = new Runnable () {
+ public void run () {
+ if (!initialized) return;
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = XPCOM.NS_GetServiceManager (result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
+ nsIServiceManager serviceManager = new nsIServiceManager (result[0]);
+ result[0] = 0;
+ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_COOKIEMANAGER_CONTRACTID, true);
+ rc = serviceManager.GetServiceByContractID (aContractID, nsICookieManager.NS_ICOOKIEMANAGER_IID, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
+ serviceManager.Release ();
+
+ nsICookieManager manager = new nsICookieManager (result[0]);
+ result[0] = 0;
+ rc = manager.GetEnumerator (result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ manager.Release ();
+
+ nsISimpleEnumerator enumerator = new nsISimpleEnumerator (result[0]);
+ boolean[] moreElements = new boolean[1];
+ rc = enumerator.HasMoreElements (moreElements);
+ if (rc != XPCOM.NS_OK) error (rc);
+ while (moreElements[0]) {
+ result[0] = 0;
+ rc = enumerator.GetNext (result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ nsICookie cookie = new nsICookie (result[0]);
+ long[] expires = new long[1];
+ rc = cookie.GetExpires (expires);
+ if (expires[0] == 0) {
+ /* indicates a session cookie */
+ int /*long*/ domain = XPCOM.nsEmbedCString_new ();
+ int /*long*/ name = XPCOM.nsEmbedCString_new ();
+ int /*long*/ path = XPCOM.nsEmbedCString_new ();
+ cookie.GetHost (domain);
+ cookie.GetName (name);
+ cookie.GetPath (path);
+ rc = manager.Remove (domain, name, path, false);
+ XPCOM.nsEmbedCString_delete (domain);
+ XPCOM.nsEmbedCString_delete (name);
+ XPCOM.nsEmbedCString_delete (path);
+ if (rc != XPCOM.NS_OK) error (rc);
+ }
+ cookie.Release ();
+ rc = enumerator.HasMoreElements (moreElements);
+ if (rc != XPCOM.NS_OK) error (rc);
+ }
+ enumerator.Release ();
+ }
+ };
+ }
+
+public void create (Composite parent, int style) {
+ delegate = new MozillaDelegate (browser);
+ Display display = parent.getDisplay ();
+
+ int /*long*/[] result = new int /*long*/[1];
+ if (!initialized) {
+ String mozillaPath = null;
+
+ boolean initLoaded = false;
+ try {
+ Library.loadLibrary ("swt-xpcominit"); //$NON-NLS-1$
+ initLoaded = true;
+ } catch (UnsatisfiedLinkError e) {
+ try {
+ /*
+ * The initial loadLibrary attempt may have failed as a result of the user's
+ * system not having libstdc++.so.6 installed, so try to load the alternate
+ * swt xpcominit library that depends on libswtc++.so.5 instead.
+ */
+ Library.loadLibrary ("swt-xpcominit-gcc3"); //$NON-NLS-1$
+ initLoaded = true;
+ } catch (UnsatisfiedLinkError ex) {
+ /*
+ * If this library still failed to load then do not attempt to detect a
+ * xulrunner to use. The Browser may still be usable if MOZILLA_FIVE_HOME
+ * points at a GRE.
+ */
+ }
+ }
+
+ boolean isXULRunner = false;
+ if (initLoaded) {
+ /* attempt to discover a XULRunner to use as the GRE */
+ GREVersionRange range = new GREVersionRange ();
+ byte[] bytes = MozillaDelegate.wcsToMbcs (null, GRERANGE_LOWER, true);
+ int /*long*/ lower = C.malloc (bytes.length);
+ C.memmove (lower, bytes, bytes.length);
+ range.lower = lower;
+ range.lowerInclusive = LowerRangeInclusive;
+
+ bytes = MozillaDelegate.wcsToMbcs (null, GRERANGE_UPPER, true);
+ int /*long*/ upper = C.malloc (bytes.length);
+ C.memmove (upper, bytes, bytes.length);
+ range.upper = upper;
+ range.upperInclusive = UpperRangeInclusive;
+
+ int length = XPCOMInit.PATH_MAX;
+ int /*long*/ greBuffer = C.malloc (length);
+ int /*long*/ propertiesPtr = C.malloc (2 * C.PTR_SIZEOF);
+ int rc = XPCOMInit.GRE_GetGREPathWithProperties (range, 1, propertiesPtr, 0, greBuffer, length);
+ C.free (lower);
+ C.free (upper);
+ C.free (propertiesPtr);
+ if (rc == XPCOM.NS_OK) {
+ /* indicates that a XULRunner was found */
+ length = C.strlen (greBuffer);
+ bytes = new byte[length];
+ C.memmove (bytes, greBuffer, length);
+ mozillaPath = new String (MozillaDelegate.mbcsToWcs (null, bytes));
+ // the following line is intentionally commented
+ isXULRunner = mozillaPath.length () > 0;
+ }
+ C.free (greBuffer);
+ }
+
+ if (isXULRunner) {
+ try {
+ Library.loadLibrary ("swt-xulrunner"); //$NON-NLS-1$
+ } catch (UnsatisfiedLinkError e) {
+ try {
+ /*
+ * The initial loadLibrary attempt may have failed as a result of the user's
+ * system not having libstdc++.so.6 installed, so try to load the alternate
+ * swt xulrunner library that depends on libswtc++.so.5 instead.
+ */
+ Library.loadLibrary ("swt-xulrunner-gcc3"); //$NON-NLS-1$
+ } catch (UnsatisfiedLinkError ex) {
+ browser.dispose ();
+ /*
+ * Print the error from the first failed attempt since at this point it's
+ * known that the failure was not due to the libstdc++.so.6 dependency.
+ */
+ SWT.error (SWT.ERROR_NO_HANDLES, e);
+ }
+ }
+ byte[] path = MozillaDelegate.wcsToMbcs (null, mozillaPath, true);
+ int rc = XPCOMGlue.XPCOMGlueStartup (path);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+
+ /*
+ * remove the trailing "libxpcom.so" from mozillaPath because the NS_InitXPCOM2
+ * invocation requires a directory name only
+ */
+ mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf (SEPARATOR_OS));
+ } else {
+ /* attempt to use the GRE pointed at by MOZILLA_FIVE_HOME */
+ int /*long*/ ptr = C.getenv (MozillaDelegate.wcsToMbcs (null, XPCOM.MOZILLA_FIVE_HOME, true));
+ if (ptr != 0) {
+ int length = C.strlen (ptr);
+ byte[] buffer = new byte[length];
+ C.memmove (buffer, ptr, length);
+ mozillaPath = new String (MozillaDelegate.mbcsToWcs (null, buffer));
+ }
+ if (mozillaPath == null) {
+ browser.dispose ();
+ SWT.error (SWT.ERROR_NO_HANDLES, null, " [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)]"); //$NON-NLS-1$
+ }
+ /*
+ * Note. Embedding a Mozilla GTK1.2 causes a crash. The workaround
+ * is to check the version of GTK used by Mozilla by looking for
+ * the libwidget_gtk.so library used by Mozilla GTK1.2. Mozilla GTK2
+ * uses the libwidget_gtk2.so library.
+ */
+ File file = new File (mozillaPath, "components/libwidget_gtk.so"); //$NON-NLS-1$
+ if (file.exists ()) {
+ browser.dispose ();
+ SWT.error (SWT.ERROR_NO_HANDLES, null, " [Mozilla GTK2 required (GTK1.2 detected)]"); //$NON-NLS-1$
+ }
+
+ try {
+ Library.loadLibrary ("swt-mozilla"); //$NON-NLS-1$
+ } catch (UnsatisfiedLinkError e) {
+ try {
+ /*
+ * The initial loadLibrary attempt may have failed as a result of the user's
+ * system not having libstdc++.so.6 installed, so try to load the alternate
+ * swt mozilla library that depends on libswtc++.so.5 instead.
+ */
+ Library.loadLibrary ("swt-mozilla-gcc3"); //$NON-NLS-1$
+ } catch (UnsatisfiedLinkError ex) {
+ browser.dispose ();
+ /*
+ * Print the error from the first failed attempt since at this point it's
+ * known that the failure was not due to the libstdc++.so.6 dependency.
+ */
+ SWT.error (SWT.ERROR_NO_HANDLES, e);
+ }
+ }
+ }
+
+ int /*long*/[] retVal = new int /*long*/[1];
+ nsEmbedString pathString = new nsEmbedString (mozillaPath);
+ int rc = XPCOM.NS_NewLocalFile (pathString.getAddress (), true, retVal);
+ pathString.dispose ();
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (retVal[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_ERROR_NULL_POINTER);
+ }
+
+ nsIFile localFile = new nsILocalFile (retVal[0]);
+ rc = XPCOM.NS_InitXPCOM2 (0, localFile.getAddress(), 0);
+ localFile.Release ();
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ SWT.error (SWT.ERROR_NO_HANDLES, null, " [MOZILLA_FIVE_HOME may not point at an embeddable GRE] [NS_InitEmbedding " + mozillaPath + " error " + rc + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ rc = XPCOM.NS_GetComponentManager (result);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+
+ nsIComponentManager componentManager = new nsIComponentManager (result[0]);
+ result[0] = 0;
+ rc = componentManager.CreateInstance (XPCOM.NS_APPSHELL_CID, 0, nsIAppShell.NS_IAPPSHELL_IID, result);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+
+ AppShell = new nsIAppShell (result[0]);
+ rc = AppShell.Create (0, null);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ rc = AppShell.Spinup ();
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+
+ WindowCreator = new WindowCreator ();
+ WindowCreator.AddRef ();
+
+ rc = XPCOM.NS_GetServiceManager (result);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+
+ nsIServiceManager serviceManager = new nsIServiceManager (result[0]);
+ result[0] = 0;
+ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_WINDOWWATCHER_CONTRACTID, true);
+ rc = serviceManager.GetServiceByContractID (aContractID, nsIWindowWatcher.NS_IWINDOWWATCHER_IID, result);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+
+ nsIWindowWatcher windowWatcher = new nsIWindowWatcher (result[0]);
+ result[0] = 0;
+ rc = windowWatcher.SetWindowCreator (WindowCreator.getAddress());
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ windowWatcher.Release ();
+
+ /* compute the root profile directory */
+ byte[] buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_DIRECTORYSERVICE_CONTRACTID, true);
+ rc = serviceManager.GetServiceByContractID (buffer, nsIDirectoryService.NS_IDIRECTORYSERVICE_IID, result);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+
+ nsIDirectoryService directoryService = new nsIDirectoryService (result[0]);
+ result[0] = 0;
+ rc = directoryService.QueryInterface (nsIProperties.NS_IPROPERTIES_IID, result);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+ directoryService.Release ();
+
+ nsIProperties properties = new nsIProperties (result[0]);
+ result[0] = 0;
+ buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_APP_APPLICATION_REGISTRY_DIR, true);
+ rc = properties.Get (buffer, nsIFile.NS_IFILE_IID, result);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+ properties.Release ();
+
+ nsIFile profileDir = new nsIFile (result[0]);
+ result[0] = 0;
+ int /*long*/ path = XPCOM.nsEmbedCString_new ();
+ rc = profileDir.GetNativePath (path);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ int length = XPCOM.nsEmbedCString_Length (path);
+ int /*long*/ ptr = XPCOM.nsEmbedCString_get (path);
+ buffer = new byte [length];
+ XPCOM.memmove (buffer, ptr, length);
+ profileRootDirectory = new String (MozillaDelegate.mbcsToWcs (null, buffer)) + PROFILE_DIR;
+ XPCOM.nsEmbedCString_delete (path);
+ profileDir.Release ();
+
+ display.addListener (SWT.Dispose, new Listener () {
+ public void handleEvent (Event event) {
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = XPCOM.NS_GetServiceManager (result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
+
+ nsIServiceManager serviceManager = new nsIServiceManager (result[0]);
+ result[0] = 0;
+ byte[] buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_OBSERVER_CONTRACTID, true);
+ rc = serviceManager.GetServiceByContractID (buffer, nsIObserverService.NS_IOBSERVERSERVICE_IID, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
+ serviceManager.Release ();
+
+ nsIObserverService observerService = new nsIObserverService (result[0]);
+ result[0] = 0;
+ buffer = MozillaDelegate.wcsToMbcs (null, PROFILE_BEFORE_CHANGE, true);
+ int length = SHUTDOWN_PERSIST.length ();
+ char[] chars = new char [length + 1];
+ SHUTDOWN_PERSIST.getChars (0, length, chars, 0);
+ rc = observerService.NotifyObservers (0, buffer, chars);
+ if (rc != XPCOM.NS_OK) error (rc);
+ observerService.Release ();
+ }
+ });
+
+ /*
+ * As a result of using a common profile the user cannot change their locale
+ * and charset. The fix for this is to set mozilla's locale and charset
+ * preference values according to the user's current locale and charset.
+ */
+ aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFSERVICE_CONTRACTID, true);
+ rc = serviceManager.GetServiceByContractID (aContractID, nsIPrefService.NS_IPREFSERVICE_IID, result);
+ serviceManager.Release ();
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+
+ nsIPrefService prefService = new nsIPrefService (result[0]);
+ result[0] = 0;
+ buffer = new byte[1];
+ rc = prefService.GetBranch (buffer, result); /* empty buffer denotes root preference level */
+ prefService.Release ();
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+
+ nsIPrefBranch prefBranch = new nsIPrefBranch (result[0]);
+ result[0] = 0;
+
+ /* get Mozilla's current locale preference value */
+ String prefLocales = null;
+ nsIPrefLocalizedString localizedString = null;
+ buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_LANGUAGES, true);
+ rc = prefBranch.GetComplexValue (buffer, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, result);
+ /*
+ * Feature of Debian. For some reason attempting to query for the current locale
+ * preference fails on Debian. The workaround for this is to assume a value of
+ * "en-us,en" since this is typically the default value when mozilla is used without
+ * a profile.
+ */
+ if (rc != XPCOM.NS_OK) {
+ prefLocales = "en-us,en" + TOKENIZER_LOCALE; //$NON-NLS-1$
+ } else {
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+ localizedString = new nsIPrefLocalizedString (result[0]);
+ result[0] = 0;
+ rc = localizedString.ToString (result);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+ length = XPCOM.strlen_PRUnichar (result[0]);
+ char[] dest = new char[length];
+ XPCOM.memmove (dest, result[0], length * 2);
+ prefLocales = new String (dest) + TOKENIZER_LOCALE;
+ }
+ result[0] = 0;
+
+ /*
+ * construct the new locale preference value by prepending the
+ * user's current locale and language to the original value
+ */
+ Locale locale = Locale.getDefault ();
+ String language = locale.getLanguage ();
+ String country = locale.getCountry ();
+ StringBuffer stringBuffer = new StringBuffer (language);
+ stringBuffer.append (SEPARATOR_LOCALE);
+ stringBuffer.append (country.toLowerCase ());
+ stringBuffer.append (TOKENIZER_LOCALE);
+ stringBuffer.append (language);
+ stringBuffer.append (TOKENIZER_LOCALE);
+ String newLocales = stringBuffer.toString ();
+ StringTokenizer tokenzier = new StringTokenizer (prefLocales, TOKENIZER_LOCALE);
+ while (tokenzier.hasMoreTokens ()) {
+ String token = (tokenzier.nextToken () + TOKENIZER_LOCALE).trim ();
+ /* ensure that duplicate locale values are not added */
+ if (newLocales.indexOf (token) == -1) {
+ stringBuffer.append (token);
+ }
+ }
+ newLocales = stringBuffer.toString ();
+ if (!newLocales.equals (prefLocales)) {
+ /* write the new locale value */
+ newLocales = newLocales.substring (0, newLocales.length () - TOKENIZER_LOCALE.length ()); /* remove trailing tokenizer */
+ length = newLocales.length ();
+ char[] charBuffer = new char[length + 1];
+ newLocales.getChars (0, length, charBuffer, 0);
+ if (localizedString == null) {
+ byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID, true);
+ rc = componentManager.CreateInstanceByContractID (contractID, 0, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, result);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+ localizedString = new nsIPrefLocalizedString (result[0]);
+ result[0] = 0;
+ }
+ localizedString.SetDataWithLength (length, charBuffer);
+ rc = prefBranch.SetComplexValue (buffer, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, localizedString.getAddress());
+ }
+ if (localizedString != null) {
+ localizedString.Release ();
+ localizedString = null;
+ }
+
+ /* get Mozilla's current charset preference value */
+ String prefCharset = null;
+ buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_CHARSET, true);
+ rc = prefBranch.GetComplexValue (buffer, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, result);
+ /*
+ * Feature of Debian. For some reason attempting to query for the current charset
+ * preference fails on Debian. The workaround for this is to assume a value of
+ * "ISO-8859-1" since this is typically the default value when mozilla is used
+ * without a profile.
+ */
+ if (rc != XPCOM.NS_OK) {
+ prefCharset = "ISO-8859-1"; //$NON_NLS-1$
+ } else {
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+ localizedString = new nsIPrefLocalizedString (result[0]);
+ result[0] = 0;
+ rc = localizedString.ToString (result);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+ length = XPCOM.strlen_PRUnichar (result[0]);
+ char[] dest = new char[length];
+ XPCOM.memmove (dest, result[0], length * 2);
+ prefCharset = new String (dest);
+ }
+ result[0] = 0;
+
+ String newCharset = System.getProperty ("file.encoding"); // $NON-NLS-1$
+ if (!newCharset.equals (prefCharset)) {
+ /* write the new charset value */
+ length = newCharset.length ();
+ char[] charBuffer = new char[length + 1];
+ newCharset.getChars (0, length, charBuffer, 0);
+ if (localizedString == null) {
+ byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID, true);
+ rc = componentManager.CreateInstanceByContractID (contractID, 0, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, result);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+ localizedString = new nsIPrefLocalizedString (result[0]);
+ result[0] = 0;
+ }
+ localizedString.SetDataWithLength (length, charBuffer);
+ rc = prefBranch.SetComplexValue (buffer, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, localizedString.getAddress ());
+ }
+ if (localizedString != null) localizedString.Release ();
+ prefBranch.Release ();
+
+ PromptServiceFactory factory = new PromptServiceFactory ();
+ factory.AddRef ();
+
+ rc = componentManager.QueryInterface (nsIComponentRegistrar.NS_ICOMPONENTREGISTRAR_IID, result);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+
+ nsIComponentRegistrar componentRegistrar = new nsIComponentRegistrar (result[0]);
+ result[0] = 0;
+ aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PROMPTSERVICE_CONTRACTID, true);
+ byte[] aClassName = MozillaDelegate.wcsToMbcs (null, "Prompt Service", true); //$NON-NLS-1$
+ rc = componentRegistrar.RegisterFactory (XPCOM.NS_PROMPTSERVICE_CID, aClassName, aContractID, factory.getAddress ());
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ factory.Release ();
+
+ HelperAppLauncherDialogFactory dialogFactory = new HelperAppLauncherDialogFactory ();
+ dialogFactory.AddRef ();
+ aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID, true);
+ aClassName = MozillaDelegate.wcsToMbcs (null, "Helper App Launcher Dialog", true); //$NON-NLS-1$
+ rc = componentRegistrar.RegisterFactory (XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CID, aClassName, aContractID, dialogFactory.getAddress ());
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ dialogFactory.Release ();
+
+ DownloadFactory downloadFactory = new DownloadFactory ();
+ downloadFactory.AddRef ();
+ aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_DOWNLOAD_CONTRACTID, true);
+ aClassName = MozillaDelegate.wcsToMbcs (null, "Download", true); //$NON-NLS-1$
+ rc = componentRegistrar.RegisterFactory (XPCOM.NS_DOWNLOAD_CID, aClassName, aContractID, downloadFactory.getAddress ());
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ downloadFactory.Release ();
+
+ DownloadFactory_1_8 downloadFactory_1_8 = new DownloadFactory_1_8 ();
+ downloadFactory_1_8.AddRef ();
+ aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_TRANSFER_CONTRACTID, true);
+ aClassName = MozillaDelegate.wcsToMbcs (null, "Transfer", true); //$NON-NLS-1$
+ rc = componentRegistrar.RegisterFactory (XPCOM.NS_DOWNLOAD_CID, aClassName, aContractID, downloadFactory_1_8.getAddress ());
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ downloadFactory_1_8.Release ();
+
+ FilePickerFactory pickerFactory = new FilePickerFactory ();
+ pickerFactory.AddRef ();
+ aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_FILEPICKER_CONTRACTID, true);
+ aClassName = MozillaDelegate.wcsToMbcs (null, "FilePicker", true); //$NON-NLS-1$
+ rc = componentRegistrar.RegisterFactory (XPCOM.NS_FILEPICKER_CID, aClassName, aContractID, pickerFactory.getAddress ());
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ pickerFactory.Release ();
+
+ componentRegistrar.Release ();
+ componentManager.Release ();
+ initialized = true;
+ }
+
+ BrowserCount++;
+ int rc = XPCOM.NS_GetComponentManager (result);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+
+ nsIComponentManager componentManager = new nsIComponentManager (result[0]);
+ result[0] = 0;
+ nsID NS_IWEBBROWSER_CID = new nsID ("F1EAC761-87E9-11d3-AF80-00A024FFC08C"); //$NON-NLS-1$
+ rc = componentManager.CreateInstance (NS_IWEBBROWSER_CID, 0, nsIWebBrowser.NS_IWEBBROWSER_IID, result);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+ componentManager.Release ();
+
+ webBrowser = new nsIWebBrowser (result[0]);
+
+ createCOMInterfaces ();
+ AddRef ();
+
+ rc = webBrowser.SetContainerWindow (webBrowserChrome.getAddress());
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+
+ rc = webBrowser.QueryInterface (nsIBaseWindow.NS_IBASEWINDOW_IID, result);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_ERROR_NO_INTERFACE);
+ }
+
+ nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]);
+ result[0] = 0;
+ Rectangle rect = browser.getClientArea ();
+ if (rect.isEmpty ()) {
+ rect.width = 1;
+ rect.height = 1;
+ }
+
+ embedHandle = delegate.getHandle ();
+
+ rc = baseWindow.InitWindow (embedHandle, 0, 0, 0, rect.width, rect.height);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (XPCOM.NS_ERROR_FAILURE);
+ }
+ rc = baseWindow.Create ();
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (XPCOM.NS_ERROR_FAILURE);
+ }
+ rc = baseWindow.SetVisibility (true);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (XPCOM.NS_ERROR_FAILURE);
+ }
+ baseWindow.Release ();
+
+ rc = webBrowser.AddWebBrowserListener (weakReference.getAddress (), nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+
+ rc = webBrowser.SetParentURIContentListener (uriContentListener.getAddress ());
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+
+ rc = XPCOM.NS_GetServiceManager (result);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+
+ nsIServiceManager serviceManager = new nsIServiceManager (result[0]);
+ result[0] = 0;
+ byte[] buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_DIRECTORYSERVICE_CONTRACTID, true);
+ rc = serviceManager.GetServiceByContractID (buffer, nsIDirectoryService.NS_IDIRECTORYSERVICE_IID, result);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+
+ nsIDirectoryService directoryService = new nsIDirectoryService (result[0]);
+ result[0] = 0;
+ rc = directoryService.RegisterProvider(directoryServiceProviderListener.getAddress ());
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ directoryService.Release ();
+
+ buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_OBSERVER_CONTRACTID, true);
+ rc = serviceManager.GetServiceByContractID (buffer, nsIObserverService.NS_IOBSERVERSERVICE_IID, result);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ if (result[0] == 0) {
+ browser.dispose ();
+ error (XPCOM.NS_NOINTERFACE);
+ }
+ serviceManager.Release ();
+
+ nsIObserverService observerService = new nsIObserverService (result[0]);
+ result[0] = 0;
+ buffer = MozillaDelegate.wcsToMbcs (null, PROFILE_DO_CHANGE, true);
+ int length = STARTUP.length ();
+ char[] chars = new char [length + 1];
+ STARTUP.getChars (0, length, chars, 0);
+ rc = observerService.NotifyObservers (0, buffer, chars);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ buffer = MozillaDelegate.wcsToMbcs (null, PROFILE_AFTER_CHANGE, true);
+ rc = observerService.NotifyObservers (0, buffer, chars);
+ if (rc != XPCOM.NS_OK) {
+ browser.dispose ();
+ error (rc);
+ }
+ observerService.Release ();
+
+ Listener listener = new Listener () {
+ public void handleEvent (Event event) {
+ switch (event.type) {
+ case SWT.Dispose: {
+ /* make this handler run after other dispose listeners */
+ if (ignoreDispose) {
+ ignoreDispose = false;
+ break;
+ }
+ ignoreDispose = true;
+ browser.notifyListeners (event.type, event);
+ event.type = SWT.NONE;
+ onDispose (event.display);
+ break;
+ }
+ case SWT.Resize: onResize (); break;
+ case SWT.FocusIn: Activate (); break;
+ case SWT.Deactivate: {
+ Display display = event.display;
+ if (Mozilla.this.browser == display.getFocusControl ()) Deactivate ();
+ break;
+ }
+ case SWT.Show: {
+ /*
+ * Feature on GTK Mozilla. Mozilla does not show up when
+ * its container (a GTK fixed handle) is made visible
+ * after having been hidden. The workaround is to reset
+ * its size after the container has been made visible.
+ */
+ Display display = event.display;
+ display.asyncExec(new Runnable () {
+ public void run() {
+ if (browser.isDisposed ()) return;
+ onResize ();
+ }
+ });
+ break;
+ }
+ }
+ }
+ };
+ int[] folderEvents = new int[] {
+ SWT.Dispose,
+ SWT.Resize,
+ SWT.FocusIn,
+ SWT.Deactivate,
+ SWT.Show,
+ SWT.KeyDown // needed to make browser traversable
+ };
+ for (int i = 0; i < folderEvents.length; i++) {
+ browser.addListener (folderEvents[i], listener);
+ }
+}
+
+public boolean back () {
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+
+ nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]);
+ rc = webNavigation.GoBack ();
+ webNavigation.Release ();
+ return rc == XPCOM.NS_OK;
+}
+
+void createCOMInterfaces () {
+ // Create each of the interfaces that this object implements
+ supports = new XPCOMObject (new int[] {2, 0, 0}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ };
+
+ weakReference = new XPCOMObject (new int[] {2, 0, 0, 2}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return QueryReferent (args[0], args[1]);}
+ };
+
+ webProgressListener = new XPCOMObject (new int[] {2, 0, 0, 4, 6, 3, 4, 3}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return OnStateChange (args[0], args[1], args[2],args[3]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], args[2], args[3], args[4], args[5]);}
+ public int /*long*/ method5 (int /*long*/[] args) {return OnLocationChange (args[0], args[1], args[2]);}
+ public int /*long*/ method6 (int /*long*/[] args) {return OnStatusChange (args[0], args[1], args[2], args[3]);}
+ public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], args[2]);}
+ };
+
+ webBrowserChrome = new XPCOMObject (new int[] {2, 0, 0, 2, 1, 1, 1, 1, 0, 2, 0, 1, 1}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return SetStatus (args[0], args[1]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return GetWebBrowser (args[0]);}
+ public int /*long*/ method5 (int /*long*/[] args) {return SetWebBrowser (args[0]);}
+ public int /*long*/ method6 (int /*long*/[] args) {return GetChromeFlags (args[0]);}
+ public int /*long*/ method7 (int /*long*/[] args) {return SetChromeFlags (args[0]);}
+ public int /*long*/ method8 (int /*long*/[] args) {return DestroyBrowserWindow ();}
+ public int /*long*/ method9 (int /*long*/[] args) {return SizeBrowserTo (args[0], args[1]);}
+ public int /*long*/ method10 (int /*long*/[] args) {return ShowAsModal ();}
+ public int /*long*/ method11 (int /*long*/[] args) {return IsWindowModal (args[0]);}
+ public int /*long*/ method12 (int /*long*/[] args) {return ExitModalEventLoop (args[0]);}
+ };
+
+ webBrowserChromeFocus = new XPCOMObject (new int[] {2, 0, 0, 0, 0}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return FocusNextElement ();}
+ public int /*long*/ method4 (int /*long*/[] args) {return FocusPrevElement ();}
+ };
+
+ embeddingSiteWindow = new XPCOMObject (new int[] {2, 0, 0, 5, 5, 0, 1, 1, 1, 1, 1}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return SetDimensions (args[0], args[1], args[2], args[3], args[4]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return GetDimensions (args[0], args[1], args[2], args[3], args[4]);}
+ public int /*long*/ method5 (int /*long*/[] args) {return SetFocus ();}
+ public int /*long*/ method6 (int /*long*/[] args) {return GetVisibility (args[0]);}
+ public int /*long*/ method7 (int /*long*/[] args) {return SetVisibility (args[0]);}
+ public int /*long*/ method8 (int /*long*/[] args) {return GetTitle (args[0]);}
+ public int /*long*/ method9 (int /*long*/[] args) {return SetTitle (args[0]);}
+ public int /*long*/ method10 (int /*long*/[] args) {return GetSiteWindow (args[0]);}
+ };
+
+ interfaceRequestor = new XPCOMObject (new int[] {2, 0, 0, 2} ){
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return GetInterface (args[0], args[1]);}
+ };
+
+ supportsWeakReference = new XPCOMObject (new int[] {2, 0, 0, 1}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return GetWeakReference (args[0]);}
+ };
+
+ contextMenuListener = new XPCOMObject (new int[] {2, 0, 0, 3}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return OnShowContextMenu (args[0],args[1],args[2]);}
+ };
+
+ uriContentListener = new XPCOMObject (new int[] {2, 0, 0, 2, 5, 3, 4, 1, 1, 1, 1}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return OnStartURIOpen (args[0], args[1]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return DoContent (args[0], args[1], args[2], args[3], args[4]);}
+ public int /*long*/ method5 (int /*long*/[] args) {return IsPreferred (args[0], args[1], args[2]);}
+ public int /*long*/ method6 (int /*long*/[] args) {return CanHandleContent (args[0], args[1], args[2], args[3]);}
+ public int /*long*/ method7 (int /*long*/[] args) {return GetLoadCookie (args[0]);}
+ public int /*long*/ method8 (int /*long*/[] args) {return SetLoadCookie (args[0]);}
+ public int /*long*/ method9 (int /*long*/[] args) {return GetParentContentListener (args[0]);}
+ public int /*long*/ method10 (int /*long*/[] args) {return SetParentContentListener (args[0]);}
+ };
+
+ tooltipListener = new XPCOMObject (new int[] {2, 0, 0, 3, 0}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return OnShowTooltip (args[0], args[1], args[2]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return OnHideTooltip ();}
+ };
+
+ directoryServiceProviderListener = new XPCOMObject (new int[] {2, 0, 0, 3}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return GetFile (args[0], args[1], args[2]);}
+ };
+}
+
+void disposeCOMInterfaces () {
+ if (supports != null) {
+ supports.dispose ();
+ supports = null;
+ }
+ if (weakReference != null) {
+ weakReference.dispose ();
+ weakReference = null;
+ }
+ if (webProgressListener != null) {
+ webProgressListener.dispose ();
+ webProgressListener = null;
+ }
+ if (webBrowserChrome != null) {
+ webBrowserChrome.dispose ();
+ webBrowserChrome = null;
+ }
+ if (webBrowserChromeFocus != null) {
+ webBrowserChromeFocus.dispose ();
+ webBrowserChromeFocus = null;
+ }
+ if (embeddingSiteWindow != null) {
+ embeddingSiteWindow.dispose ();
+ embeddingSiteWindow = null;
+ }
+ if (interfaceRequestor != null) {
+ interfaceRequestor.dispose ();
+ interfaceRequestor = null;
+ }
+ if (supportsWeakReference != null) {
+ supportsWeakReference.dispose ();
+ supportsWeakReference = null;
+ }
+ if (contextMenuListener != null) {
+ contextMenuListener.dispose ();
+ contextMenuListener = null;
+ }
+ if (uriContentListener != null) {
+ uriContentListener.dispose ();
+ uriContentListener = null;
+ }
+ if (tooltipListener != null) {
+ tooltipListener.dispose ();
+ tooltipListener = null;
+ }
+}
+
+public boolean execute (String script) {
+ String url = "javascript:" + script + ";void(0);"; //$NON-NLS-1$ //$NON-NLS-2$
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+
+ nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]);
+ char[] arg = url.toCharArray ();
+ char[] c = new char[arg.length+1];
+ System.arraycopy (arg, 0, c, 0, arg.length);
+ rc = webNavigation.LoadURI (c, nsIWebNavigation.LOAD_FLAGS_NONE, 0, 0, 0);
+ webNavigation.Release ();
+ return rc == XPCOM.NS_OK;
+}
+
+static Browser findBrowser (int /*long*/ handle) {
+ return MozillaDelegate.findBrowser (handle);
+}
+
+public boolean forward () {
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+
+ nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]);
+ rc = webNavigation.GoForward ();
+ webNavigation.Release ();
+
+ return rc == XPCOM.NS_OK;
+}
+
+public String getUrl () {
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+
+ nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]);
+ int /*long*/[] aCurrentURI = new int /*long*/[1];
+ rc = webNavigation.GetCurrentURI (aCurrentURI);
+ if (rc != XPCOM.NS_OK) error (rc);
+ webNavigation.Release ();
+
+ byte[] dest = null;
+ if (aCurrentURI[0] != 0) {
+ nsIURI uri = new nsIURI (aCurrentURI[0]);
+ int /*long*/ aSpec = XPCOM.nsEmbedCString_new ();
+ rc = uri.GetSpec (aSpec);
+ if (rc != XPCOM.NS_OK) error (rc);
+ int length = XPCOM.nsEmbedCString_Length (aSpec);
+ int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec);
+ dest = new byte[length];
+ XPCOM.memmove (dest, buffer, length);
+ XPCOM.nsEmbedCString_delete (aSpec);
+ uri.Release ();
+ }
+ if (dest == null) return ""; //$NON-NLS-1$
+ /*
+ * If the URI indicates that the current page is being rendered from
+ * memory (ie.- via setText()) then answer about:blank as the URL
+ * to be consistent with win32.
+ */
+ String location = new String (dest);
+ if (location.equals (URI_FROMMEMORY)) location = ABOUT_BLANK;
+ return location;
+}
+
+public boolean isBackEnabled () {
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+
+ nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]);
+ boolean[] aCanGoBack = new boolean[1];
+ rc = webNavigation.GetCanGoBack (aCanGoBack);
+ webNavigation.Release ();
+ return aCanGoBack[0];
+}
+
+public boolean isForwardEnabled () {
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+
+ nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]);
+ boolean[] aCanGoForward = new boolean[1];
+ rc = webNavigation.GetCanGoForward (aCanGoForward);
+ webNavigation.Release ();
+ return aCanGoForward[0];
+}
+
+static String error (int code) {
+ throw new SWTError ("XPCOM error " + code); //$NON-NLS-1$
+}
+
+void onDispose (Display display) {
+ int rc = webBrowser.RemoveWebBrowserListener (weakReference.getAddress (), nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID);
+ if (rc != XPCOM.NS_OK) error (rc);
+
+ rc = webBrowser.SetParentURIContentListener (0);
+ if (rc != XPCOM.NS_OK) error (rc);
+
+ int /*long*/[] result = new int /*long*/[1];
+ rc = webBrowser.QueryInterface (nsIBaseWindow.NS_IBASEWINDOW_IID, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+
+ nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]);
+ rc = baseWindow.Destroy ();
+ if (rc != XPCOM.NS_OK) error (rc);
+ baseWindow.Release ();
+
+ Release ();
+ webBrowser.Release ();
+
+ if (tip != null && !tip.isDisposed ()) tip.dispose ();
+ tip = null;
+
+ delegate.onDispose (embedHandle);
+ embedHandle = 0;
+ BrowserCount--;
+}
+
+void Activate () {
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = webBrowser.QueryInterface (nsIWebBrowserFocus.NS_IWEBBROWSERFOCUS_IID, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+
+ nsIWebBrowserFocus webBrowserFocus = new nsIWebBrowserFocus (result[0]);
+ rc = webBrowserFocus.Activate ();
+ if (rc != XPCOM.NS_OK) error (rc);
+ webBrowserFocus.Release ();
+}
+
+void Deactivate () {
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = webBrowser.QueryInterface (nsIWebBrowserFocus.NS_IWEBBROWSERFOCUS_IID, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+
+ nsIWebBrowserFocus webBrowserFocus = new nsIWebBrowserFocus (result[0]);
+ rc = webBrowserFocus.Deactivate ();
+ if (rc != XPCOM.NS_OK) error (rc);
+ webBrowserFocus.Release ();
+}
+
+void onResize () {
+ Rectangle rect = browser.getClientArea ();
+ int width = Math.max (1, rect.width);
+ int height = Math.max (1, rect.height);
+
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = webBrowser.QueryInterface (nsIBaseWindow.NS_IBASEWINDOW_IID, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+
+ delegate.setSize (embedHandle, width, height);
+ nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]);
+ rc = baseWindow.SetPositionAndSize (0, 0, width, height, true);
+ if (rc != XPCOM.NS_OK) error (rc);
+ baseWindow.Release ();
+}
+
+public void refresh () {
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
+ if (rc != XPCOM.NS_OK) error(rc);
+ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+
+ nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]);
+ rc = webNavigation.Reload (nsIWebNavigation.LOAD_FLAGS_NONE);
+ webNavigation.Release ();
+ if (rc == XPCOM.NS_OK) return;
+ /*
+ * Feature in Mozilla. Reload returns an error code NS_ERROR_INVALID_POINTER
+ * when it is called immediately after a request to load a new document using
+ * LoadURI. The workaround is to ignore this error code.
+ *
+ * Feature in Mozilla. Attempting to reload a file that no longer exists
+ * returns an error code of NS_ERROR_FILE_NOT_FOUND. This is equivalent to
+ * attempting to load a non-existent local url, which is not a Browser error,
+ * so this error code should be ignored.
+ */
+ if (rc != XPCOM.NS_ERROR_INVALID_POINTER && rc != XPCOM.NS_ERROR_FILE_NOT_FOUND) error (rc);
+}
+
+public boolean setText (String html) {
+ /*
+ * Feature in Mozilla. The focus memory of Mozilla must be
+ * properly managed through the nsIWebBrowserFocus interface.
+ * In particular, nsIWebBrowserFocus.deactivate must be called
+ * when the focus moves from the browser (or one of its children
+ * managed by Mozilla to another widget. We currently do not
+ * get notified when a widget takes focus away from the Browser.
+ * As a result, deactivate is not properly called. This causes
+ * Mozilla to retake focus the next time a document is loaded.
+ * This breaks the case where the HTML loaded in the Browser
+ * varies while the user enters characters in a text widget. The text
+ * widget loses focus every time new content is loaded.
+ * The current workaround is to call deactivate everytime if
+ * the browser currently does not have focus. A better workaround
+ * would be to have a way to call deactivate when the Browser
+ * or one of its children loses focus.
+ */
+ if (browser != browser.getDisplay ().getFocusControl ()) Deactivate ();
+
+ /*
+ * Convert the String containing HTML to an array of
+ * bytes with UTF-8 data.
+ */
+ byte[] data = null;
+ try {
+ data = html.getBytes ("UTF-8"); //$NON-NLS-1$
+ } catch (UnsupportedEncodingException e) {
+ return false;
+ }
+
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = XPCOM.NS_GetServiceManager (result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
+
+ nsIServiceManager serviceManager = new nsIServiceManager (result[0]);
+ result[0] = 0;
+ rc = serviceManager.GetService (XPCOM.NS_IOSERVICE_CID, nsIIOService.NS_IIOSERVICE_IID, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
+ serviceManager.Release ();
+
+ nsIIOService ioService = new nsIIOService (result[0]);
+ result[0] = 0;
+ /*
+ * Note. Mozilla ignores LINK tags used to load CSS stylesheets
+ * when the URI protocol for the nsInputStreamChannel
+ * is about:blank. The fix is to specify the file protocol.
+ */
+ byte[] aString = MozillaDelegate.wcsToMbcs (null, URI_FROMMEMORY, false);
+ int /*long*/ aSpec = XPCOM.nsEmbedCString_new (aString, aString.length);
+ rc = ioService.NewURI (aSpec, null, 0, result);
+ XPCOM.nsEmbedCString_delete (aSpec);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
+ ioService.Release ();
+
+ nsIURI uri = new nsIURI (result[0]);
+ result[0] = 0;
+
+ /* aContentType */
+ byte[] contentTypeBuffer = MozillaDelegate.wcsToMbcs (null, "text/html", true); // $NON-NLS-1$
+ int /*long*/ aContentType = XPCOM.nsEmbedCString_new (contentTypeBuffer, contentTypeBuffer.length);
+
+ /*
+ * First try to use nsIWebBrowserStream to set the text into the Browser, since this
+ * interface is frozen. However, this may fail because this interface was only introduced
+ * as of mozilla 1.8; if this interface is not found then use the pre-1.8 approach of
+ * utilizing nsIDocShell instead.
+ */
+ result[0] = 0;
+ rc = webBrowser.QueryInterface (nsIWebBrowserStream.NS_IWEBBROWSERSTREAM_IID, result);
+ if (rc == XPCOM.NS_OK) {
+ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+ nsIWebBrowserStream stream = new nsIWebBrowserStream (result[0]);
+ rc = stream.OpenStream (uri.getAddress (), aContentType);
+ if (rc != XPCOM.NS_OK) error (rc);
+ int /*long*/ ptr = C.malloc (data.length);
+ XPCOM.memmove (ptr, data, data.length);
+ int pageSize = 8192;
+ int pageCount = data.length / pageSize + 1;
+ int /*long*/ current = ptr;
+ for (int i = 0; i < pageCount; i++) {
+ int length = i == pageCount - 1 ? data.length % pageSize : pageSize;
+ if (length > 0) {
+ rc = stream.AppendToStream (current, length);
+ if (rc != XPCOM.NS_OK) error (rc);
+ }
+ current += pageSize;
+ }
+ rc = stream.CloseStream ();
+ if (rc != XPCOM.NS_OK) error (rc);
+ C.free (ptr);
+ stream.Release ();
+ } else {
+ rc = webBrowser.QueryInterface (nsIInterfaceRequestor.NS_IINTERFACEREQUESTOR_IID, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+
+ nsIInterfaceRequestor interfaceRequestor = new nsIInterfaceRequestor (result[0]);
+ result[0] = 0;
+ rc = interfaceRequestor.GetInterface (nsIDocShell.NS_IDOCSHELL_IID, result);
+ interfaceRequestor.Release ();
+
+ nsIDocShell docShell = new nsIDocShell (result[0]);
+ result[0] = 0;
+ byte[] contentCharsetBuffer = MozillaDelegate.wcsToMbcs (null, "UTF-8", true); //$NON-NLS-1$
+ int /*long*/ aContentCharset = XPCOM.nsEmbedCString_new (contentCharsetBuffer, contentCharsetBuffer.length);
+
+ /*
+ * Feature in Mozilla. LoadStream invokes the nsIInputStream argument
+ * through a different thread. The callback mechanism must attach
+ * a non java thread to the JVM otherwise the nsIInputStream Read and
+ * Close methods never get called.
+ */
+ InputStream inputStream = new InputStream (data);
+ inputStream.AddRef ();
+ rc = docShell.LoadStream(inputStream.getAddress (), uri.getAddress (), aContentType, aContentCharset, 0);
+ if (rc != XPCOM.NS_OK) error (rc);
+ XPCOM.nsEmbedCString_delete (aContentCharset);
+ inputStream.Release ();
+ docShell.Release ();
+ }
+
+ XPCOM.nsEmbedCString_delete (aContentType);
+ uri.Release ();
+ return true;
+}
+
+public boolean setUrl (String url) {
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+
+ nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]);
+ char[] arg = url.toCharArray ();
+ char[] c = new char[arg.length + 1];
+ System.arraycopy (arg, 0, c, 0, arg.length);
+ rc = webNavigation.LoadURI (c, nsIWebNavigation.LOAD_FLAGS_NONE, 0, 0, 0);
+ webNavigation.Release ();
+ return rc == XPCOM.NS_OK;
+}
+
+public void stop () {
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+
+ nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]);
+ rc = webNavigation.Stop (nsIWebNavigation.STOP_ALL);
+ if (rc != XPCOM.NS_OK) error (rc);
+ webNavigation.Release ();
+}
+
+/* nsISupports */
+
+int /*long*/ QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
+ if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
+
+ nsID guid = new nsID ();
+ XPCOM.memmove (guid, riid, nsID.sizeof);
+
+ if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
+ return XPCOM.NS_OK;
+ }
+ if (guid.Equals (nsIWeakReference.NS_IWEAKREFERENCE_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {weakReference.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
+ return XPCOM.NS_OK;
+ }
+ if (guid.Equals (nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {webProgressListener.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
+ return XPCOM.NS_OK;
+ }
+ if (guid.Equals (nsIWebBrowserChrome.NS_IWEBBROWSERCHROME_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {webBrowserChrome.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
+ return XPCOM.NS_OK;
+ }
+ if (guid.Equals (nsIWebBrowserChromeFocus.NS_IWEBBROWSERCHROMEFOCUS_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {webBrowserChromeFocus.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
+ return XPCOM.NS_OK;
+ }
+ if (guid.Equals (nsIEmbeddingSiteWindow.NS_IEMBEDDINGSITEWINDOW_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {embeddingSiteWindow.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
+ return XPCOM.NS_OK;
+ }
+ if (guid.Equals (nsIInterfaceRequestor.NS_IINTERFACEREQUESTOR_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {interfaceRequestor.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
+ return XPCOM.NS_OK;
+ }
+ if (guid.Equals (nsISupportsWeakReference.NS_ISUPPORTSWEAKREFERENCE_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {supportsWeakReference.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
+ return XPCOM.NS_OK;
+ }
+ if (guid.Equals (nsIContextMenuListener.NS_ICONTEXTMENULISTENER_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {contextMenuListener.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
+ return XPCOM.NS_OK;
+ }
+ if (guid.Equals (nsIURIContentListener.NS_IURICONTENTLISTENER_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {uriContentListener.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
+ return XPCOM.NS_OK;
+ }
+ if (guid.Equals (nsITooltipListener.NS_ITOOLTIPLISTENER_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {tooltipListener.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
+ return XPCOM.NS_OK;
+ }
+ if (guid.Equals (nsIDirectoryServiceProvider.NS_IDIRECTORYSERVICEPROVIDER_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {directoryServiceProviderListener.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
+ return XPCOM.NS_OK;
+ }
+ XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
+ return XPCOM.NS_ERROR_NO_INTERFACE;
+}
+
+int /*long*/ AddRef () {
+ refCount++;
+ return refCount;
+}
+
+int /*long*/ Release () {
+ refCount--;
+ if (refCount == 0) disposeCOMInterfaces ();
+ return refCount;
+}
+
+/* nsIWeakReference */
+
+int /*long*/ QueryReferent (int /*long*/ riid, int /*long*/ ppvObject) {
+ return QueryInterface (riid,ppvObject);
+}
+
+/* nsIInterfaceRequestor */
+
+int /*long*/ GetInterface (int /*long*/ riid, int /*long*/ ppvObject) {
+ if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
+ nsID guid = new nsID ();
+ XPCOM.memmove (guid, riid, nsID.sizeof);
+ if (guid.Equals (nsIDOMWindow.NS_IDOMWINDOW_IID)) {
+ int /*long*/[] aContentDOMWindow = new int /*long*/[1];
+ int rc = webBrowser.GetContentDOMWindow (aContentDOMWindow);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (aContentDOMWindow[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+ XPCOM.memmove (ppvObject, aContentDOMWindow, C.PTR_SIZEOF);
+ return rc;
+ }
+ return QueryInterface (riid,ppvObject);
+}
+
+int /*long*/ GetWeakReference (int /*long*/ ppvObject) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {weakReference.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
+ return XPCOM.NS_OK;
+}
+
+/* nsIWebProgressListener */
+
+int /*long*/ OnStateChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aStateFlags, int /*long*/ aStatus) {
+ if ((aStateFlags & nsIWebProgressListener.STATE_IS_DOCUMENT) == 0) return XPCOM.NS_OK;
+ if ((aStateFlags & nsIWebProgressListener.STATE_START) != 0) {
+ if (request == 0) request = aRequest;
+ } else if ((aStateFlags & nsIWebProgressListener.STATE_REDIRECTING) != 0) {
+ if (request == aRequest) request = 0;
+ } else if ((aStateFlags & nsIWebProgressListener.STATE_STOP) != 0) {
+ /*
+ * Feature on Mozilla. When a request is redirected (STATE_REDIRECTING),
+ * it never reaches the state STATE_STOP and it is replaced with a new request.
+ * The new request is received when it is in the state STATE_STOP.
+ * To handle this case, the variable request is set to 0 when the corresponding
+ * request is redirected. The following request received with the state STATE_STOP
+ * - the new request resulting from the redirection - is used to send
+ * the ProgressListener.completed event.
+ */
+ if (request == aRequest || request == 0) {
+ request = 0;
+ StatusTextEvent event = new StatusTextEvent (browser);
+ event.display = browser.getDisplay ();
+ event.widget = browser;
+ event.text = ""; //$NON-NLS-1$
+ for (int i = 0; i < statusTextListeners.length; i++) {
+ statusTextListeners[i].changed (event);
+ }
+ ProgressEvent event2 = new ProgressEvent (browser);
+ event2.display = browser.getDisplay ();
+ event2.widget = browser;
+ for (int i = 0; i < progressListeners.length; i++) {
+ progressListeners[i].completed (event2);
+ }
+ }
+ }
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ OnProgressChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aCurSelfProgress, int /*long*/ aMaxSelfProgress, int /*long*/ aCurTotalProgress, int /*long*/ aMaxTotalProgress) {
+ if (progressListeners.length == 0) return XPCOM.NS_OK;
+ ProgressEvent event = new ProgressEvent (browser);
+ event.display = browser.getDisplay ();
+ event.widget = browser;
+ event.current = (int)/*64*/aCurTotalProgress;
+ event.total = (int)/*64*/aMaxTotalProgress;
+ for (int i = 0; i < progressListeners.length; i++) {
+ progressListeners[i].changed (event);
+ }
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ OnLocationChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aLocation) {
+ /*
+ * Feature on Mozilla. When a page is loaded via setText before a previous
+ * setText page load has completed, the expected OnStateChange STATE_STOP for the
+ * original setText never arrives because it gets replaced by the OnStateChange
+ * STATE_STOP for the new request. This results in the request field never being
+ * cleared because the original request's OnStateChange STATE_STOP is still expected
+ * (but never arrives). To handle this case, the request field is updated to the new
+ * overriding request since its OnStateChange STATE_STOP will be received next.
+ */
+ if (request != 0 && request != aRequest) request = aRequest;
+
+ if (locationListeners.length == 0) return XPCOM.NS_OK;
+
+ nsIWebProgress webProgress = new nsIWebProgress (aWebProgress);
+ int /*long*/[] aDOMWindow = new int /*long*/[1];
+ int rc = webProgress.GetDOMWindow (aDOMWindow);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (aDOMWindow[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+
+ nsIDOMWindow domWindow = new nsIDOMWindow (aDOMWindow[0]);
+ int /*long*/[] aTop = new int /*long*/[1];
+ rc = domWindow.GetTop (aTop);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (aTop[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+ domWindow.Release ();
+
+ nsIDOMWindow topWindow = new nsIDOMWindow (aTop[0]);
+ topWindow.Release ();
+
+ nsIURI location = new nsIURI (aLocation);
+ int /*long*/ aSpec = XPCOM.nsEmbedCString_new ();
+ location.GetSpec (aSpec);
+ int length = XPCOM.nsEmbedCString_Length (aSpec);
+ int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec);
+ byte[] dest = new byte[length];
+ XPCOM.memmove (dest, buffer, length);
+ XPCOM.nsEmbedCString_delete (aSpec);
+
+ LocationEvent event = new LocationEvent (browser);
+ event.display = browser.getDisplay ();
+ event.widget = browser;
+ event.location = new String (dest);
+ if (event.location.equals (URI_FROMMEMORY)) {
+ /*
+ * If the URI indicates that the page is being rendered from memory
+ * (ie.- via setText()) then set the event location to about:blank
+ * to be consistent with win32.
+ */
+ event.location = ABOUT_BLANK;
+ }
+ event.top = aTop[0] == aDOMWindow[0];
+ for (int i = 0; i < locationListeners.length; i++) {
+ locationListeners[i].changed (event);
+ }
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ OnStatusChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aStatus, int /*long*/ aMessage) {
+ if (statusTextListeners.length == 0) return XPCOM.NS_OK;
+ StatusTextEvent event = new StatusTextEvent (browser);
+ event.display = browser.getDisplay ();
+ event.widget = browser;
+ int length = XPCOM.strlen_PRUnichar (aMessage);
+ char[] dest = new char[length];
+ XPCOM.memmove (dest, aMessage, length * 2);
+ event.text = new String (dest);
+ for (int i = 0; i < statusTextListeners.length; i++) {
+ statusTextListeners[i].changed (event);
+ }
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ OnSecurityChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ state) {
+ return XPCOM.NS_OK;
+}
+
+/* nsIWebBrowserChrome */
+
+int /*long*/ SetStatus (int /*long*/ statusType, int /*long*/ status) {
+ StatusTextEvent event = new StatusTextEvent (browser);
+ event.display = browser.getDisplay ();
+ event.widget = browser;
+ int length = XPCOM.strlen_PRUnichar (status);
+ char[] dest = new char[length];
+ XPCOM.memmove (dest, status, length * 2);
+ String string = new String (dest);
+ event.text = string;
+ for (int i = 0; i < statusTextListeners.length; i++) {
+ statusTextListeners[i].changed (event);
+ }
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ GetWebBrowser (int /*long*/ aWebBrowser) {
+ int /*long*/[] ret = new int /*long*/[1];
+ if (webBrowser != null) {
+ webBrowser.AddRef ();
+ ret[0] = webBrowser.getAddress ();
+ }
+ XPCOM.memmove (aWebBrowser, ret, C.PTR_SIZEOF);
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ SetWebBrowser (int /*long*/ aWebBrowser) {
+ if (webBrowser != null) webBrowser.Release ();
+ webBrowser = aWebBrowser != 0 ? new nsIWebBrowser (aWebBrowser) : null;
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ GetChromeFlags (int /*long*/ aChromeFlags) {
+ int[] ret = new int[1];
+ ret[0] = chromeFlags;
+ /* aChromeFlags is a pointer to a type of size 4 */
+ XPCOM.memmove (aChromeFlags, ret, 4);
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ SetChromeFlags (int /*long*/ aChromeFlags) {
+ chromeFlags = (int)/*64*/aChromeFlags;
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ DestroyBrowserWindow () {
+ WindowEvent newEvent = new WindowEvent (browser);
+ newEvent.display = browser.getDisplay ();
+ newEvent.widget = browser;
+ for (int i = 0; i < closeWindowListeners.length; i++) {
+ closeWindowListeners[i].close (newEvent);
+ }
+ /*
+ * Note on Mozilla. The DestroyBrowserWindow notification cannot be cancelled.
+ * The browser widget cannot be used after this notification has been received.
+ * The application is advised to close the window hosting the browser widget.
+ * The browser widget must be disposed in all cases.
+ */
+ browser.dispose ();
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ SizeBrowserTo (int /*long*/ aCX, int /*long*/ aCY) {
+ size = new Point ((int)/*64*/aCX, (int)/*64*/aCY);
+ if (isModal) {
+ Shell shell = browser.getShell ();
+ shell.setSize (shell.computeSize (size.x, size.y));
+ }
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ ShowAsModal () {
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = XPCOM.NS_GetServiceManager (result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
+
+ nsIServiceManager serviceManager = new nsIServiceManager (result[0]);
+ result[0] = 0;
+ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_CONTEXTSTACK_CONTRACTID, true);
+ rc = serviceManager.GetServiceByContractID (aContractID, nsIJSContextStack.NS_IJSCONTEXTSTACK_IID, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
+ serviceManager.Release ();
+
+ nsIJSContextStack stack = new nsIJSContextStack (result[0]);
+ result[0] = 0;
+ rc = stack.Push (0);
+ if (rc != XPCOM.NS_OK) error (rc);
+
+ Shell shell = browser.getShell ();
+ Display display = browser.getDisplay ();
+ while (!shell.isDisposed ()) {
+ if (!display.readAndDispatch ()) display.sleep ();
+ }
+
+ rc = stack.Pop (result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ stack.Release ();
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ IsWindowModal (int /*long*/ retval) {
+ /* Note. boolean remains of size 4 on 64 bit machine */
+ XPCOM.memmove (retval, new int[] {isModal ? 1 : 0}, 4);
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ ExitModalEventLoop (int /*long*/ aStatus) {
+ return XPCOM.NS_OK;
+}
+
+/* nsIEmbeddingSiteWindow */
+
+int /*long*/ SetDimensions (int /*long*/ flags, int /*long*/ x, int /*long*/ y, int /*long*/ cx, int /*long*/ cy) {
+ if (flags == nsIEmbeddingSiteWindow.DIM_FLAGS_POSITION) location = new Point ((int)/*64*/x, (int)/*64*/y);
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ GetDimensions (int /*long*/ flags, int /*long*/ x, int /*long*/ y, int /*long*/ cx, int /*long*/ cy) {
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ SetFocus () {
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = webBrowser.QueryInterface (nsIBaseWindow.NS_IBASEWINDOW_IID, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_ERROR_NO_INTERFACE);
+
+ nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]);
+ rc = baseWindow.SetFocus ();
+ if (rc != XPCOM.NS_OK) error (rc);
+ baseWindow.Release ();
+
+ /*
+ * Note. Mozilla notifies here that one of the children took
+ * focus. This could or should be used to fire an SWT.FOCUS_IN
+ * event on Browser focus listeners.
+ */
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ GetVisibility (int /*long*/ aVisibility) {
+ /* Note. boolean remains of size 4 on 64 bit machine */
+ XPCOM.memmove (aVisibility, new int[] {browser.isVisible () ? 1 : 0}, 4);
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ SetVisibility (int /*long*/ aVisibility) {
+ WindowEvent event = new WindowEvent (browser);
+ event.display = browser.getDisplay ();
+ event.widget = browser;
+ if (aVisibility == 1) {
+ /*
+ * Bug in Mozilla. When the JavaScript window.open is executed, Mozilla
+ * fires multiple SetVisibility 1 notifications. The workaround is
+ * to ignore subsequent notifications.
+ */
+ if (!visible) {
+ visible = true;
+ event.location = location;
+ event.size = size;
+ event.addressBar = addressBar;
+ event.menuBar = menuBar;
+ event.statusBar = statusBar;
+ event.toolBar = toolBar;
+ for (int i = 0; i < visibilityWindowListeners.length; i++) {
+ visibilityWindowListeners[i].show (event);
+ }
+ location = null;
+ size = null;
+ }
+ } else {
+ visible = false;
+ for (int i = 0; i < visibilityWindowListeners.length; i++) {
+ visibilityWindowListeners[i].hide (event);
+ }
+ }
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ GetTitle (int /*long*/ aTitle) {
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ SetTitle (int /*long*/ aTitle) {
+ if (titleListeners.length == 0) return XPCOM.NS_OK;
+ TitleEvent event = new TitleEvent (browser);
+ event.display = browser.getDisplay ();
+ event.widget = browser;
+ /*
+ * To be consistent with other platforms the title event should
+ * contain the page's url if the page does not contain a <title>
+ * tag.
+ */
+ int length = XPCOM.strlen_PRUnichar (aTitle);
+ if (length > 0) {
+ char[] dest = new char[length];
+ XPCOM.memmove (dest, aTitle, length * 2);
+ event.title = new String (dest);
+ } else {
+ event.title = getUrl ();
+ }
+ for (int i = 0; i < titleListeners.length; i++) {
+ titleListeners[i].changed (event);
+ }
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ GetSiteWindow (int /*long*/ aSiteWindow) {
+ /*
+ * Note. The handle is expected to be an HWND on Windows and
+ * a GtkWidget* on GTK. This callback is invoked on Windows
+ * when the javascript window.print is invoked and the print
+ * dialog comes up. If no handle is returned, the print dialog
+ * does not come up on this platform.
+ */
+ XPCOM.memmove (aSiteWindow, new int /*long*/[] {embedHandle}, C.PTR_SIZEOF);
+ return XPCOM.NS_OK;
+}
+
+/* nsIWebBrowserChromeFocus */
+
+int /*long*/ FocusNextElement () {
+ /*
+ * Bug in Mozilla embedding API. Mozilla takes back the focus after sending
+ * this event. This prevents tabbing out of Mozilla. This behaviour can be reproduced
+ * with the Mozilla application TestGtkEmbed. The workaround is to
+ * send the traversal notification after this callback returns.
+ */
+ browser.getDisplay ().asyncExec (new Runnable () {
+ public void run () {
+ browser.traverse (SWT.TRAVERSE_TAB_NEXT);
+ }
+ });
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ FocusPrevElement () {
+ /*
+ * Bug in Mozilla embedding API. Mozilla takes back the focus after sending
+ * this event. This prevents tabbing out of Mozilla. This behaviour can be reproduced
+ * with the Mozilla application TestGtkEmbed. The workaround is to
+ * send the traversal notification after this callback returns.
+ */
+ browser.getDisplay ().asyncExec (new Runnable () {
+ public void run () {
+ browser.traverse (SWT.TRAVERSE_TAB_PREVIOUS);
+ }
+ });
+ return XPCOM.NS_OK;
+}
+
+/* nsIContextMenuListener */
+
+int /*long*/ OnShowContextMenu (int /*long*/ aContextFlags, int /*long*/ aEvent, int /*long*/ aNode) {
+ nsIDOMEvent domEvent = new nsIDOMEvent (aEvent);
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = domEvent.QueryInterface (nsIDOMMouseEvent.NS_IDOMMOUSEEVENT_IID, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
+
+ nsIDOMMouseEvent domMouseEvent = new nsIDOMMouseEvent (result[0]);
+ int[] aScreenX = new int[1], aScreenY = new int[1];
+ rc = domMouseEvent.GetScreenX (aScreenX);
+ if (rc != XPCOM.NS_OK) error (rc);
+ rc = domMouseEvent.GetScreenY (aScreenY);
+ if (rc != XPCOM.NS_OK) error (rc);
+ domMouseEvent.Release ();
+
+ Event event = new Event ();
+ event.x = aScreenX[0];
+ event.y = aScreenY[0];
+ browser.notifyListeners (SWT.MenuDetect, event);
+ if (!event.doit) return XPCOM.NS_OK;
+ Menu menu = browser.getMenu ();
+ if (menu != null && !menu.isDisposed ()) {
+ if (aScreenX[0] != event.x || aScreenY[0] != event.y) {
+ menu.setLocation (event.x, event.y);
+ }
+ menu.setVisible (true);
+ }
+ return XPCOM.NS_OK;
+}
+
+/* nsIURIContentListener */
+
+int /*long*/ OnStartURIOpen (int /*long*/ aURI, int /*long*/ retval) {
+ nsIURI location = new nsIURI (aURI);
+ int /*long*/ aSpec = XPCOM.nsEmbedCString_new ();
+ location.GetSpec (aSpec);
+ int length = XPCOM.nsEmbedCString_Length (aSpec);
+ int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec);
+ buffer = XPCOM.nsEmbedCString_get (aSpec);
+ byte[] dest = new byte[length];
+ XPCOM.memmove (dest, buffer, length);
+ XPCOM.nsEmbedCString_delete (aSpec);
+ String value = new String (dest);
+ if (locationListeners.length == 0) {
+ XPCOM.memmove (retval, new int[] {0}, 4);
+ return XPCOM.NS_OK;
+ }
+ boolean doit = true;
+ if (request == 0) {
+ LocationEvent event = new LocationEvent (browser);
+ event.display = browser.getDisplay();
+ event.widget = browser;
+ event.location = value;
+ if (event.location.equals (URI_FROMMEMORY)) {
+ /*
+ * If the URI indicates that the page is being rendered from memory
+ * (ie.- via setText()) then set the event location to about:blank
+ * to be consistent with win32.
+ */
+ event.location = ABOUT_BLANK;
+ }
+ event.doit = doit;
+ for (int i = 0; i < locationListeners.length; i++) {
+ locationListeners[i].changing (event);
+ }
+ doit = event.doit;
+ }
+ /* Note. boolean remains of size 4 on 64 bit machine */
+ XPCOM.memmove (retval, new int[] {doit ? 0 : 1}, 4);
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ DoContent (int /*long*/ aContentType, int /*long*/ aIsContentPreferred, int /*long*/ aRequest, int /*long*/ aContentHandler, int /*long*/ retval) {
+ return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
+}
+
+int /*long*/ IsPreferred (int /*long*/ aContentType, int /*long*/ aDesiredContentType, int /*long*/ retval) {
+ boolean preferred = false;
+ int size = XPCOM.strlen (aContentType);
+ if (size > 0) {
+ byte[] typeBytes = new byte[size + 1];
+ XPCOM.memmove (typeBytes, aContentType, size);
+ String contentType = new String (typeBytes);
+
+ /* do not attempt to handle known problematic content types */
+ if (!contentType.equals (XPCOM.CONTENT_MAYBETEXT) && !contentType.equals (XPCOM.CONTENT_MULTIPART)) {
+ /* determine whether browser can handle the content type */
+ int /*long*/[] result = new int /*long*/[1];
+ int rc = XPCOM.NS_GetServiceManager (result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
+ nsIServiceManager serviceManager = new nsIServiceManager (result[0]);
+ result[0] = 0;
+ rc = serviceManager.GetService (XPCOM.NS_CATEGORYMANAGER_CID, nsICategoryManager.NS_ICATEGORYMANAGER_IID, result);
+ serviceManager.Release ();
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_NOINTERFACE);
+
+ nsICategoryManager categoryManager = new nsICategoryManager (result[0]);
+ result[0] = 0;
+ byte[] categoryBytes = MozillaDelegate.wcsToMbcs (null, "Gecko-Content-Viewers", true); //$NON-NLS-1$
+ rc = categoryManager.GetCategoryEntry (categoryBytes, typeBytes, result);
+ categoryManager.Release ();
+ /* if no viewer for the content type is registered then rc == XPCOM.NS_ERROR_NOT_AVAILABLE */
+ preferred = rc == XPCOM.NS_OK;
+ }
+ }
+
+ /* note that boolean remains of size 4 on 64 bit machines */
+ XPCOM.memmove(retval, new int[] {preferred ? 1 : 0}, 4);
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ CanHandleContent (int /*long*/ aContentType, int /*long*/ aIsContentPreferred, int /*long*/ aDesiredContentType, int /*long*/ retval) {
+ return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
+}
+
+int /*long*/ GetLoadCookie (int /*long*/ aLoadCookie) {
+ return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
+}
+
+int /*long*/ SetLoadCookie (int /*long*/ aLoadCookie) {
+ return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
+}
+
+int /*long*/ GetParentContentListener (int /*long*/ aParentContentListener) {
+ return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
+}
+
+int /*long*/ SetParentContentListener (int /*long*/ aParentContentListener) {
+ return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
+}
+
+/* nsITooltipListener */
+
+int /*long*/ OnShowTooltip (int /*long*/ aXCoords, int /*long*/ aYCoords, int /*long*/ aTipText) {
+ int length = XPCOM.strlen_PRUnichar (aTipText);
+ char[] dest = new char[length];
+ XPCOM.memmove (dest, aTipText, length * 2);
+ String text = new String (dest);
+ if (tip != null && !tip.isDisposed ()) tip.dispose ();
+ Display display = browser.getDisplay ();
+ Shell parent = browser.getShell ();
+ tip = new Shell (parent, SWT.ON_TOP);
+ tip.setLayout (new FillLayout());
+ Label label = new Label (tip, SWT.CENTER);
+ label.setForeground (display.getSystemColor (SWT.COLOR_INFO_FOREGROUND));
+ label.setBackground (display.getSystemColor (SWT.COLOR_INFO_BACKGROUND));
+ label.setText (text);
+ /*
+ * Bug in Mozilla embedded API. Tooltip coordinates are wrong for
+ * elements inside an inline frame (IFrame tag). The workaround is
+ * to position the tooltip based on the mouse cursor location.
+ */
+ Point point = display.getCursorLocation ();
+ /* Assuming cursor is 21x21 because this is the size of
+ * the arrow cursor on Windows
+ */
+ point.y += 21;
+ tip.setLocation (point);
+ tip.pack ();
+ tip.setVisible (true);
+ return XPCOM.NS_OK;
+}
+
+int /*long*/ OnHideTooltip () {
+ if (tip != null && !tip.isDisposed ()) tip.dispose ();
+ tip = null;
+ return XPCOM.NS_OK;
+}
+
+/* nsIDirectoryServiceProvider */
+
+int /*long*/ GetFile (int /*long*/ prop, int /*long*/ persistent, int /*long*/ retVal) {
+ int size = XPCOM.strlen (prop);
+ byte[] bytes = new byte[size];
+ XPCOM.memmove (bytes, prop, size);
+ String propertyName = new String (MozillaDelegate.mbcsToWcs (null, bytes));
+ String propertyValue = null;
+
+ if (propertyName.equals (XPCOM.NS_APP_HISTORY_50_FILE)) {
+ propertyValue = profileRootDirectory + HISTORY_FILE;
+ } else if (propertyName.equals (XPCOM.NS_APP_USER_MIMETYPES_50_FILE)) {
+ propertyValue = profileRootDirectory + MIMETYPES_FILE;
+ } else if (propertyName.equals (XPCOM.NS_APP_PREFS_50_FILE)) {
+ propertyValue = profileRootDirectory + PREFERENCES_FILE;
+ } else if (propertyName.equals (XPCOM.NS_APP_PREFS_50_DIR)) {
+ propertyValue = profileRootDirectory;
+ } else if (propertyName.equals (XPCOM.NS_APP_USER_CHROME_DIR)) {
+ propertyValue = profileRootDirectory + CHROME_DIR;
+ } else if (propertyName.equals (XPCOM.NS_APP_USER_PROFILE_50_DIR)) {
+ propertyValue = profileRootDirectory;
+ } else if (propertyName.equals (XPCOM.NS_APP_LOCALSTORE_50_FILE)) {
+ propertyValue = profileRootDirectory + LOCALSTORE_FILE;
+ } else if (propertyName.equals (XPCOM.NS_APP_CACHE_PARENT_DIR)) {
+ propertyValue = profileRootDirectory;
+ } else if (propertyName.equals (XPCOM.NS_OS_HOME_DIR)) {
+ propertyValue = System.getProperty("user.home"); //$NON-NLS-1$
+ } else if (propertyName.equals (XPCOM.NS_OS_TEMP_DIR)) {
+ propertyValue = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$
+ }
+
+ if (propertyValue != null && propertyValue.length () > 0) {
+ int /*long*/[] result = new int /*long*/[1];
+ nsEmbedString pathString = new nsEmbedString (propertyValue);
+ int rc = XPCOM.NS_NewLocalFile (pathString.getAddress (), true, result);
+ if (rc != XPCOM.NS_OK) error (rc);
+ if (result[0] == 0) error (XPCOM.NS_ERROR_NULL_POINTER);
+ pathString.dispose ();
+ XPCOM.memmove (retVal, new int /*long*/[] {result[0]}, C.PTR_SIZEOF);
+ /* note that boolean remains of size 4 on 64 bit machines */
+ XPCOM.memmove (persistent, new int[] {1}, 4);
+ }
+
+ return XPCOM.NS_OK;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/PromptService.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/PromptService.java
index 4d7eb9472d..83430783cd 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/PromptService.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/PromptService.java
@@ -13,7 +13,6 @@ package org.eclipse.swt.browser;
import org.eclipse.swt.*;
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.mozilla.*;
-import org.eclipse.swt.internal.gtk.OS;
import org.eclipse.swt.widgets.*;
class PromptService {
@@ -21,132 +20,132 @@ class PromptService {
XPCOMObject promptService;
int refCount = 0;
-public PromptService() {
- createCOMInterfaces();
+public PromptService () {
+ createCOMInterfaces ();
}
-int AddRef() {
+int AddRef () {
refCount++;
return refCount;
}
-void createCOMInterfaces() {
+void createCOMInterfaces () {
/* Create each of the interfaces that this object implements */
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
+ supports = new XPCOMObject (new int[] {2, 0, 0}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
};
- promptService = new XPCOMObject(new int[]{2, 0, 0, 3, 5, 4, 6, 10, 7, 8, 7, 7}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return Alert(args[0], args[1], args[2]);}
- public int /*long*/ method4(int /*long*/[] args) {return AlertCheck(args[0], args[1], args[2], args[3], args[4]);}
- public int /*long*/ method5(int /*long*/[] args) {return Confirm(args[0], args[1], args[2], args[3]);}
- public int /*long*/ method6(int /*long*/[] args) {return ConfirmCheck(args[0], args[1], args[2], args[3], args[4], args[5]);}
- public int /*long*/ method7(int /*long*/[] args) {return ConfirmEx(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]);}
- public int /*long*/ method8(int /*long*/[] args) {return Prompt(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);}
- public int /*long*/ method9(int /*long*/[] args) {return PromptUsernameAndPassword(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);}
- public int /*long*/ method10(int /*long*/[] args) {return PromptPassword(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);}
- public int /*long*/ method11(int /*long*/[] args) {return Select(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);}
+ promptService = new XPCOMObject (new int[] {2, 0, 0, 3, 5, 4, 6, 10, 7, 8, 7, 7}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return Alert (args[0], args[1], args[2]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return AlertCheck (args[0], args[1], args[2], args[3], args[4]);}
+ public int /*long*/ method5 (int /*long*/[] args) {return Confirm (args[0], args[1], args[2], args[3]);}
+ public int /*long*/ method6 (int /*long*/[] args) {return ConfirmCheck (args[0], args[1], args[2], args[3], args[4], args[5]);}
+ public int /*long*/ method7 (int /*long*/[] args) {return ConfirmEx (args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]);}
+ public int /*long*/ method8 (int /*long*/[] args) {return Prompt (args[0], args[1], args[2], args[3], args[4], args[5], args[6]);}
+ public int /*long*/ method9 (int /*long*/[] args) {return PromptUsernameAndPassword (args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);}
+ public int /*long*/ method10 (int /*long*/[] args) {return PromptPassword (args[0], args[1], args[2], args[3], args[4], args[5], args[6]);}
+ public int /*long*/ method11 (int /*long*/[] args) {return Select (args[0], args[1], args[2], args[3], args[4], args[5], args[6]);}
};
}
-void disposeCOMInterfaces() {
+void disposeCOMInterfaces () {
if (supports != null) {
- supports.dispose();
+ supports.dispose ();
supports = null;
}
if (promptService != null) {
- promptService.dispose();
+ promptService.dispose ();
promptService = null;
}
}
-int /*long*/ getAddress() {
- return promptService.getAddress();
+int /*long*/ getAddress () {
+ return promptService.getAddress ();
}
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
+int /*long*/ QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
+ nsID guid = new nsID ();
+ XPCOM.memmove (guid, riid, nsID.sizeof);
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, OS.PTR_SIZEOF);
- AddRef();
+ if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
return XPCOM.NS_OK;
}
- if (guid.Equals(nsIPromptService.NS_IPROMPTSERVICE_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {promptService.getAddress()}, OS.PTR_SIZEOF);
- AddRef();
+ if (guid.Equals (nsIPromptService.NS_IPROMPTSERVICE_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {promptService.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
return XPCOM.NS_OK;
}
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, OS.PTR_SIZEOF);
+ XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
return XPCOM.NS_ERROR_NO_INTERFACE;
}
-int Release() {
+int Release () {
refCount--;
- if (refCount == 0) disposeCOMInterfaces();
+ if (refCount == 0) disposeCOMInterfaces ();
return refCount;
}
-Browser getBrowser(int /*long*/ aDOMWindow) {
+Browser getBrowser (int /*long*/ aDOMWindow) {
int /*long*/[] result = new int /*long*/[1];
- int rc = XPCOM.NS_GetServiceManager(result);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- if (result[0] == 0) Mozilla.error(XPCOM.NS_NOINTERFACE);
+ int rc = XPCOM.NS_GetServiceManager (result);
+ if (rc != XPCOM.NS_OK) Mozilla.error (rc);
+ if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE);
- nsIServiceManager serviceManager = new nsIServiceManager(result[0]);
+ nsIServiceManager serviceManager = new nsIServiceManager (result[0]);
result[0] = 0;
- byte[] aContractID = Converter.wcsToMbcs(null, XPCOM.NS_WINDOWWATCHER_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID(aContractID, nsIWindowWatcher.NS_IWINDOWWATCHER_IID, result);
+ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_WINDOWWATCHER_CONTRACTID, true);
+ rc = serviceManager.GetServiceByContractID (aContractID, nsIWindowWatcher.NS_IWINDOWWATCHER_IID, result);
if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- if (result[0] == 0) Mozilla.error(XPCOM.NS_NOINTERFACE);
- serviceManager.Release();
+ if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE);
+ serviceManager.Release ();
- nsIWindowWatcher windowWatcher = new nsIWindowWatcher(result[0]);
+ nsIWindowWatcher windowWatcher = new nsIWindowWatcher (result[0]);
result[0] = 0;
- rc = windowWatcher.GetChromeForWindow(aDOMWindow, result);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- if (result[0] == 0) Mozilla.error(XPCOM.NS_NOINTERFACE);
- windowWatcher.Release();
+ rc = windowWatcher.GetChromeForWindow (aDOMWindow, result);
+ if (rc != XPCOM.NS_OK) Mozilla.error (rc);
+ if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE);
+ windowWatcher.Release ();
- nsIWebBrowserChrome webBrowserChrome = new nsIWebBrowserChrome(result[0]);
+ nsIWebBrowserChrome webBrowserChrome = new nsIWebBrowserChrome (result[0]);
result[0] = 0;
- rc = webBrowserChrome.QueryInterface(nsIEmbeddingSiteWindow.NS_IEMBEDDINGSITEWINDOW_IID, result);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- if (result[0] == 0) Mozilla.error(XPCOM.NS_NOINTERFACE);
- webBrowserChrome.Release();
+ rc = webBrowserChrome.QueryInterface (nsIEmbeddingSiteWindow.NS_IEMBEDDINGSITEWINDOW_IID, result);
+ if (rc != XPCOM.NS_OK) Mozilla.error (rc);
+ if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE);
+ webBrowserChrome.Release ();
- nsIEmbeddingSiteWindow embeddingSiteWindow = new nsIEmbeddingSiteWindow(result[0]);
+ nsIEmbeddingSiteWindow embeddingSiteWindow = new nsIEmbeddingSiteWindow (result[0]);
result[0] = 0;
- rc = embeddingSiteWindow.GetSiteWindow(result);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- if (result[0] == 0) Mozilla.error(XPCOM.NS_NOINTERFACE);
- embeddingSiteWindow.Release();
+ rc = embeddingSiteWindow.GetSiteWindow (result);
+ if (rc != XPCOM.NS_OK) Mozilla.error (rc);
+ if (result[0] == 0) Mozilla.error (XPCOM.NS_NOINTERFACE);
+ embeddingSiteWindow.Release ();
- return Mozilla.findBrowser(result[0]);
+ return Mozilla.findBrowser (result[0]);
}
-String getLabel(int buttonFlag, int index, int /*long*/ buttonTitle) {
+String getLabel (int buttonFlag, int index, int /*long*/ buttonTitle) {
String label = null;
int flag = (buttonFlag & (0xff * index)) / index;
switch (flag) {
- case nsIPromptService.BUTTON_TITLE_CANCEL : label = SWT.getMessage("SWT_Cancel"); break; //$NON-NLS-1$
- case nsIPromptService.BUTTON_TITLE_NO : label = SWT.getMessage("SWT_No"); break; //$NON-NLS-1$
- case nsIPromptService.BUTTON_TITLE_OK : label = SWT.getMessage("SWT_OK"); break; //$NON-NLS-1$
- case nsIPromptService.BUTTON_TITLE_SAVE : label = SWT.getMessage("SWT_Save"); break; //$NON-NLS-1$
- case nsIPromptService.BUTTON_TITLE_YES : label = SWT.getMessage("SWT_Yes"); break; //$NON-NLS-1$
+ case nsIPromptService.BUTTON_TITLE_CANCEL : label = SWT.getMessage ("SWT_Cancel"); break; //$NON-NLS-1$
+ case nsIPromptService.BUTTON_TITLE_NO : label = SWT.getMessage ("SWT_No"); break; //$NON-NLS-1$
+ case nsIPromptService.BUTTON_TITLE_OK : label = SWT.getMessage ("SWT_OK"); break; //$NON-NLS-1$
+ case nsIPromptService.BUTTON_TITLE_SAVE : label = SWT.getMessage ("SWT_Save"); break; //$NON-NLS-1$
+ case nsIPromptService.BUTTON_TITLE_YES : label = SWT.getMessage ("SWT_Yes"); break; //$NON-NLS-1$
case nsIPromptService.BUTTON_TITLE_IS_STRING : {
- int length = XPCOM.strlen_PRUnichar(buttonTitle);
+ int length = XPCOM.strlen_PRUnichar (buttonTitle);
char[] dest = new char[length];
- XPCOM.memmove(dest, buttonTitle, length * 2);
- label = new String(dest);
+ XPCOM.memmove (dest, buttonTitle, length * 2);
+ label = new String (dest);
}
}
return label;
@@ -154,130 +153,130 @@ String getLabel(int buttonFlag, int index, int /*long*/ buttonTitle) {
/* nsIPromptService */
-public int /*long*/ Alert(int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text) {
- Browser browser = getBrowser(parent);
+public int /*long*/ Alert (int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text) {
+ Browser browser = getBrowser (parent);
- int length = XPCOM.strlen_PRUnichar(dialogTitle);
+ int length = XPCOM.strlen_PRUnichar (dialogTitle);
char[] dest = new char[length];
- XPCOM.memmove(dest, dialogTitle, length * 2);
- String titleLabel = new String(dest);
+ XPCOM.memmove (dest, dialogTitle, length * 2);
+ String titleLabel = new String (dest);
- length = XPCOM.strlen_PRUnichar(text);
+ length = XPCOM.strlen_PRUnichar (text);
dest = new char[length];
- XPCOM.memmove(dest, text, length * 2);
- String textLabel = new String(dest);
+ XPCOM.memmove (dest, text, length * 2);
+ String textLabel = new String (dest);
- MessageBox messageBox = new MessageBox(browser.getShell(), SWT.OK | SWT.ICON_WARNING);
- messageBox.setText(titleLabel);
- messageBox.setMessage(textLabel);
- messageBox.open();
+ MessageBox messageBox = new MessageBox (browser.getShell (), SWT.OK | SWT.ICON_WARNING);
+ messageBox.setText (titleLabel);
+ messageBox.setMessage (textLabel);
+ messageBox.open ();
return XPCOM.NS_OK;
}
-public int /*long*/ AlertCheck(int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ checkMsg, int /*long*/ checkValue) {
+public int /*long*/ AlertCheck (int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ checkMsg, int /*long*/ checkValue) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ Confirm(int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ _retval) {
- Browser browser = getBrowser(parent);
+public int /*long*/ Confirm (int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ _retval) {
+ Browser browser = getBrowser (parent);
- int length = XPCOM.strlen_PRUnichar(dialogTitle);
+ int length = XPCOM.strlen_PRUnichar (dialogTitle);
char[] dest = new char[length];
- XPCOM.memmove(dest, dialogTitle, length * 2);
- String titleLabel = new String(dest);
+ XPCOM.memmove (dest, dialogTitle, length * 2);
+ String titleLabel = new String (dest);
- length = XPCOM.strlen_PRUnichar(text);
+ length = XPCOM.strlen_PRUnichar (text);
dest = new char[length];
- XPCOM.memmove(dest, text, length * 2);
- String textLabel = new String(dest);
+ XPCOM.memmove (dest, text, length * 2);
+ String textLabel = new String (dest);
- MessageBox messageBox = new MessageBox(browser.getShell(), SWT.OK | SWT.CANCEL | SWT.ICON_QUESTION);
- messageBox.setText(titleLabel);
- messageBox.setMessage(textLabel);
- int id = messageBox.open();
- int[] result = { id == SWT.OK ? 1 : 0};
- XPCOM.memmove(_retval, result, 4);
+ MessageBox messageBox = new MessageBox (browser.getShell (), SWT.OK | SWT.CANCEL | SWT.ICON_QUESTION);
+ messageBox.setText (titleLabel);
+ messageBox.setMessage (textLabel);
+ int id = messageBox.open ();
+ int[] result = {id == SWT.OK ? 1 : 0};
+ XPCOM.memmove (_retval, result, 4);
return XPCOM.NS_OK;
}
-public int /*long*/ ConfirmCheck(int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ checkMsg, int /*long*/ checkValue, int /*long*/ _retval) {
+public int /*long*/ ConfirmCheck (int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ checkMsg, int /*long*/ checkValue, int /*long*/ _retval) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ ConfirmEx(int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ buttonFlags, int /*long*/ button0Title, int /*long*/ button1Title, int /*long*/ button2Title, int /*long*/ checkMsg, int /*long*/ checkValue, int /*long*/ _retval) {
- Browser browser = getBrowser(parent);
+public int /*long*/ ConfirmEx (int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ buttonFlags, int /*long*/ button0Title, int /*long*/ button1Title, int /*long*/ button2Title, int /*long*/ checkMsg, int /*long*/ checkValue, int /*long*/ _retval) {
+ Browser browser = getBrowser (parent);
- int length = XPCOM.strlen_PRUnichar(dialogTitle);
+ int length = XPCOM.strlen_PRUnichar (dialogTitle);
char[] dest = new char[length];
- XPCOM.memmove(dest, dialogTitle, length * 2);
- String titleLabel = new String(dest);
-
- length = XPCOM.strlen_PRUnichar(text);
+ XPCOM.memmove (dest, dialogTitle, length * 2);
+ String titleLabel = new String (dest);
+
+ length = XPCOM.strlen_PRUnichar (text);
dest = new char[length];
- XPCOM.memmove(dest, text, length * 2);
- String textLabel = new String(dest);
+ XPCOM.memmove (dest, text, length * 2);
+ String textLabel = new String (dest);
String checkLabel = null;
if (checkMsg != 0) {
- length = XPCOM.strlen_PRUnichar(checkMsg);
+ length = XPCOM.strlen_PRUnichar (checkMsg);
dest = new char[length];
- XPCOM.memmove(dest, checkMsg, length * 2);
- checkLabel = new String(dest);
+ XPCOM.memmove (dest, checkMsg, length * 2);
+ checkLabel = new String (dest);
}
- String button1Label = getLabel((int)/*64*/buttonFlags, nsIPromptService.BUTTON_POS_0, button0Title);
- String button2Label = getLabel((int)/*64*/buttonFlags, nsIPromptService.BUTTON_POS_1, button1Title);
- String button3Label = getLabel((int)/*64*/buttonFlags, nsIPromptService.BUTTON_POS_2, button2Title);
+ String button1Label = getLabel ((int)/*64*/buttonFlags, nsIPromptService.BUTTON_POS_0, button0Title);
+ String button2Label = getLabel ((int)/*64*/buttonFlags, nsIPromptService.BUTTON_POS_1, button1Title);
+ String button3Label = getLabel ((int)/*64*/buttonFlags, nsIPromptService.BUTTON_POS_2, button2Title);
- PromptDialog dialog = new PromptDialog(browser.getShell());
+ PromptDialog dialog = new PromptDialog (browser.getShell ());
int[] check = new int[1], result = new int[1];
- if (checkValue != 0) XPCOM.memmove(check, checkValue, 4);
- dialog.confirmEx(titleLabel, textLabel, checkLabel, button1Label, button2Label, button3Label, check, result);
- if (checkValue != 0) XPCOM.memmove(checkValue, check, 4);
- XPCOM.memmove(_retval, result, 4);
+ if (checkValue != 0) XPCOM.memmove (check, checkValue, 4);
+ dialog.confirmEx (titleLabel, textLabel, checkLabel, button1Label, button2Label, button3Label, check, result);
+ if (checkValue != 0) XPCOM.memmove (checkValue, check, 4);
+ XPCOM.memmove (_retval, result, 4);
return XPCOM.NS_OK;
}
-public int /*long*/ Prompt(int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ value, int /*long*/ checkMsg, int /*long*/ checkValue, int /*long*/ _retval) {
- Browser browser = getBrowser(parent);
+public int /*long*/ Prompt (int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ value, int /*long*/ checkMsg, int /*long*/ checkValue, int /*long*/ _retval) {
+ Browser browser = getBrowser (parent);
String titleLabel = null, textLabel, checkLabel = null;
String[] valueLabel = new String[1];
char[] dest;
int length;
if (dialogTitle != 0) {
- length = XPCOM.strlen_PRUnichar(dialogTitle);
+ length = XPCOM.strlen_PRUnichar (dialogTitle);
dest = new char[length];
- XPCOM.memmove(dest, dialogTitle, length * 2);
- titleLabel = new String(dest);
+ XPCOM.memmove (dest, dialogTitle, length * 2);
+ titleLabel = new String (dest);
}
- length = XPCOM.strlen_PRUnichar(text);
+ length = XPCOM.strlen_PRUnichar (text);
dest = new char[length];
- XPCOM.memmove(dest, text, length * 2);
- textLabel = new String(dest);
+ XPCOM.memmove (dest, text, length * 2);
+ textLabel = new String (dest);
int /*long*/[] valueAddr = new int /*long*/[1];
- XPCOM.memmove(valueAddr, value, OS.PTR_SIZEOF);
+ XPCOM.memmove (valueAddr, value, C.PTR_SIZEOF);
if (valueAddr[0] != 0) {
- length = XPCOM.strlen_PRUnichar(valueAddr[0]);
+ length = XPCOM.strlen_PRUnichar (valueAddr[0]);
dest = new char[length];
- XPCOM.memmove(dest, valueAddr[0], length * 2);
- valueLabel[0] = new String(dest);
+ XPCOM.memmove (dest, valueAddr[0], length * 2);
+ valueLabel[0] = new String (dest);
}
if (checkMsg != 0) {
- length = XPCOM.strlen_PRUnichar(checkMsg);
+ length = XPCOM.strlen_PRUnichar (checkMsg);
dest = new char[length];
- XPCOM.memmove(dest, checkMsg, length * 2);
- checkLabel = new String(dest);
+ XPCOM.memmove (dest, checkMsg, length * 2);
+ checkLabel = new String (dest);
}
- PromptDialog dialog = new PromptDialog(browser.getShell());
+ PromptDialog dialog = new PromptDialog (browser.getShell());
int[] check = new int[1], result = new int[1];
- if (checkValue != 0) XPCOM.memmove(check, checkValue, 4);
- dialog.prompt(titleLabel, textLabel, checkLabel, valueLabel, check, result);
+ if (checkValue != 0) XPCOM.memmove (check, checkValue, 4);
+ dialog.prompt (titleLabel, textLabel, checkLabel, valueLabel, check, result);
- XPCOM.memmove(_retval, result, 4);
+ XPCOM.memmove (_retval, result, 4);
if (result[0] == 1) {
/*
* User selected OK. User name and password are returned as PRUnichar values. Any default
@@ -288,89 +287,89 @@ public int /*long*/ Prompt(int /*long*/ parent, int /*long*/ dialogTitle, int /*
char[] buffer;
int /*long*/[] result2 = new int /*long*/[1];
if (valueLabel[0] != null) {
- cnt = valueLabel[0].length();
+ cnt = valueLabel[0].length ();
buffer = new char[cnt + 1];
- valueLabel[0].getChars(0, cnt, buffer, 0);
+ valueLabel[0].getChars (0, cnt, buffer, 0);
size = buffer.length * 2;
- ptr = OS.g_malloc(size);
- XPCOM.memmove(ptr, buffer, size);
- XPCOM.memmove(value, new int /*long*/[] {ptr}, OS.PTR_SIZEOF);
+ ptr = C.malloc (size);
+ XPCOM.memmove (ptr, buffer, size);
+ XPCOM.memmove (value, new int /*long*/[] {ptr}, C.PTR_SIZEOF);
if (valueAddr[0] != 0) {
- int rc = XPCOM.NS_GetServiceManager(result2);
- if (rc != XPCOM.NS_OK) SWT.error(rc);
- if (result2[0] == 0) SWT.error(XPCOM.NS_NOINTERFACE);
+ int rc = XPCOM.NS_GetServiceManager (result2);
+ if (rc != XPCOM.NS_OK) SWT.error (rc);
+ if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE);
- nsIServiceManager serviceManager = new nsIServiceManager(result2[0]);
+ nsIServiceManager serviceManager = new nsIServiceManager (result2[0]);
result2[0] = 0;
- byte[] aContractID = Converter.wcsToMbcs(null, XPCOM.NS_MEMORY_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID(aContractID, nsIMemory.NS_IMEMORY_IID, result2);
- if (rc != XPCOM.NS_OK) SWT.error(rc);
- if (result2[0] == 0) SWT.error(XPCOM.NS_NOINTERFACE);
- serviceManager.Release();
+ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true);
+ rc = serviceManager.GetServiceByContractID (aContractID, nsIMemory.NS_IMEMORY_IID, result2);
+ if (rc != XPCOM.NS_OK) SWT.error (rc);
+ if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE);
+ serviceManager.Release ();
- nsIMemory memory = new nsIMemory(result2[0]);
+ nsIMemory memory = new nsIMemory (result2[0]);
result2[0] = 0;
- memory.Free(valueAddr[0]);
- memory.Release();
+ memory.Free (valueAddr[0]);
+ memory.Release ();
}
}
}
- if (checkValue != 0) XPCOM.memmove(checkValue, check, 4);
+ if (checkValue != 0) XPCOM.memmove (checkValue, check, 4);
return XPCOM.NS_OK;
}
-public int /*long*/ PromptUsernameAndPassword(int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ username, int /*long*/ password, int /*long*/ checkMsg, int /*long*/ checkValue, int /*long*/ _retval) {
- Browser browser = getBrowser(parent);
+public int /*long*/ PromptUsernameAndPassword (int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ username, int /*long*/ password, int /*long*/ checkMsg, int /*long*/ checkValue, int /*long*/ _retval) {
+ Browser browser = getBrowser (parent);
String titleLabel, textLabel, checkLabel = null;
String[] userLabel = new String[1], passLabel = new String[1];
char[] dest;
int length;
if (dialogTitle != 0) {
- length = XPCOM.strlen_PRUnichar(dialogTitle);
+ length = XPCOM.strlen_PRUnichar (dialogTitle);
dest = new char[length];
- XPCOM.memmove(dest, dialogTitle, length * 2);
- titleLabel = new String(dest);
+ XPCOM.memmove (dest, dialogTitle, length * 2);
+ titleLabel = new String (dest);
} else {
titleLabel = ""; //$NON-NLS-1$
}
- length = XPCOM.strlen_PRUnichar(text);
+ length = XPCOM.strlen_PRUnichar (text);
dest = new char[length];
- XPCOM.memmove(dest, text, length * 2);
- textLabel = new String(dest);
+ XPCOM.memmove (dest, text, length * 2);
+ textLabel = new String (dest);
int /*long*/[] userAddr = new int /*long*/[1];
- XPCOM.memmove(userAddr, username, OS.PTR_SIZEOF);
+ XPCOM.memmove (userAddr, username, C.PTR_SIZEOF);
if (userAddr[0] != 0) {
- length = XPCOM.strlen_PRUnichar(userAddr[0]);
+ length = XPCOM.strlen_PRUnichar (userAddr[0]);
dest = new char[length];
- XPCOM.memmove(dest, userAddr[0], length * 2);
- userLabel[0] = new String(dest);
+ XPCOM.memmove (dest, userAddr[0], length * 2);
+ userLabel[0] = new String (dest);
}
int /*long*/[] passAddr = new int /*long*/[1];
- XPCOM.memmove(passAddr, password, OS.PTR_SIZEOF);
+ XPCOM.memmove (passAddr, password, C.PTR_SIZEOF);
if (passAddr[0] != 0) {
- length = XPCOM.strlen_PRUnichar(passAddr[0]);
+ length = XPCOM.strlen_PRUnichar (passAddr[0]);
dest = new char[length];
- XPCOM.memmove(dest, passAddr[0], length * 2);
- passLabel[0] = new String(dest);
+ XPCOM.memmove (dest, passAddr[0], length * 2);
+ passLabel[0] = new String (dest);
}
if (checkMsg != 0) {
- length = XPCOM.strlen_PRUnichar(checkMsg);
+ length = XPCOM.strlen_PRUnichar (checkMsg);
dest = new char[length];
- XPCOM.memmove(dest, checkMsg, length * 2);
- checkLabel = new String(dest);
+ XPCOM.memmove (dest, checkMsg, length * 2);
+ checkLabel = new String (dest);
}
- PromptDialog dialog = new PromptDialog(browser.getShell());
+ PromptDialog dialog = new PromptDialog (browser.getShell());
int[] check = new int[1], result = new int[1];
- if (checkValue != 0) XPCOM.memmove(check, checkValue, 4);
- dialog.promptUsernameAndPassword(titleLabel, textLabel, checkLabel, userLabel, passLabel, check, result);
+ if (checkValue != 0) XPCOM.memmove (check, checkValue, 4);
+ dialog.promptUsernameAndPassword (titleLabel, textLabel, checkLabel, userLabel, passLabel, check, result);
- XPCOM.memmove(_retval, result, 4);
+ XPCOM.memmove (_retval, result, 4);
if (result[0] == 1) {
/*
* User selected OK. User name and password are returned as PRUnichar values. Any default
@@ -381,71 +380,71 @@ public int /*long*/ PromptUsernameAndPassword(int /*long*/ parent, int /*long*/
char[] buffer;
int /*long*/[] result2 = new int /*long*/[1];
if (userLabel[0] != null) {
- cnt = userLabel[0].length();
+ cnt = userLabel[0].length ();
buffer = new char[cnt + 1];
- userLabel[0].getChars(0, cnt, buffer, 0);
+ userLabel[0].getChars (0, cnt, buffer, 0);
size = buffer.length * 2;
- ptr = OS.g_malloc(size);
- XPCOM.memmove(ptr, buffer, size);
- XPCOM.memmove(username, new int /*long*/[] {ptr}, OS.PTR_SIZEOF);
+ ptr = C.malloc (size);
+ XPCOM.memmove (ptr, buffer, size);
+ XPCOM.memmove (username, new int /*long*/[] {ptr}, C.PTR_SIZEOF);
if (userAddr[0] != 0) {
- int rc = XPCOM.NS_GetServiceManager(result2);
- if (rc != XPCOM.NS_OK) SWT.error(rc);
- if (result2[0] == 0) SWT.error(XPCOM.NS_NOINTERFACE);
+ int rc = XPCOM.NS_GetServiceManager (result2);
+ if (rc != XPCOM.NS_OK) SWT.error (rc);
+ if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE);
- nsIServiceManager serviceManager = new nsIServiceManager(result2[0]);
+ nsIServiceManager serviceManager = new nsIServiceManager (result2[0]);
result2[0] = 0;
- byte[] aContractID = Converter.wcsToMbcs(null, XPCOM.NS_MEMORY_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID(aContractID, nsIMemory.NS_IMEMORY_IID, result2);
- if (rc != XPCOM.NS_OK) SWT.error(rc);
- if (result[0] == 0) SWT.error(XPCOM.NS_NOINTERFACE);
- serviceManager.Release();
+ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true);
+ rc = serviceManager.GetServiceByContractID (aContractID, nsIMemory.NS_IMEMORY_IID, result2);
+ if (rc != XPCOM.NS_OK) SWT.error (rc);
+ if (result[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE);
+ serviceManager.Release ();
- nsIMemory memory = new nsIMemory(result2[0]);
+ nsIMemory memory = new nsIMemory (result2[0]);
result2[0] = 0;
- memory.Free(userAddr[0]);
- memory.Release();
+ memory.Free (userAddr[0]);
+ memory.Release ();
}
}
if (passLabel[0] != null) {
- cnt = passLabel[0].length();
+ cnt = passLabel[0].length ();
buffer = new char[cnt + 1];
- passLabel[0].getChars(0, cnt, buffer, 0);
+ passLabel[0].getChars (0, cnt, buffer, 0);
size = buffer.length * 2;
- ptr = OS.g_malloc(size);
- XPCOM.memmove(ptr, buffer, size);
- XPCOM.memmove(password, new int /*long*/[] {ptr}, OS.PTR_SIZEOF);
+ ptr = C.malloc (size);
+ XPCOM.memmove (ptr, buffer, size);
+ XPCOM.memmove (password, new int /*long*/[] {ptr}, C.PTR_SIZEOF);
if (passAddr[0] != 0) {
- int rc = XPCOM.NS_GetServiceManager(result2);
- if (rc != XPCOM.NS_OK) SWT.error(rc);
- if (result2[0] == 0) SWT.error(XPCOM.NS_NOINTERFACE);
-
- nsIServiceManager serviceManager = new nsIServiceManager(result2[0]);
+ int rc = XPCOM.NS_GetServiceManager (result2);
+ if (rc != XPCOM.NS_OK) SWT.error (rc);
+ if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE);
+
+ nsIServiceManager serviceManager = new nsIServiceManager (result2[0]);
result2[0] = 0;
- byte[] aContractID = Converter.wcsToMbcs(null, XPCOM.NS_MEMORY_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID(aContractID, nsIMemory.NS_IMEMORY_IID, result2);
- if (rc != XPCOM.NS_OK) SWT.error(rc);
- if (result2[0] == 0) SWT.error(XPCOM.NS_NOINTERFACE);
- serviceManager.Release();
-
- nsIMemory memory = new nsIMemory(result2[0]);
+ byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true);
+ rc = serviceManager.GetServiceByContractID (aContractID, nsIMemory.NS_IMEMORY_IID, result2);
+ if (rc != XPCOM.NS_OK) SWT.error (rc);
+ if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE);
+ serviceManager.Release ();
+
+ nsIMemory memory = new nsIMemory (result2[0]);
result2[0] = 0;
- memory.Free(passAddr[0]);
- memory.Release();
+ memory.Free (passAddr[0]);
+ memory.Release ();
}
}
}
- if (checkValue != 0) XPCOM.memmove(checkValue, check, 4);
+ if (checkValue != 0) XPCOM.memmove (checkValue, check, 4);
return XPCOM.NS_OK;
}
-public int /*long*/ PromptPassword(int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ password, int /*long*/ checkMsg, int /*long*/ checkValue, int /*long*/ _retval) {
+public int /*long*/ PromptPassword (int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ password, int /*long*/ checkMsg, int /*long*/ checkValue, int /*long*/ _retval) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ Select(int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ count, int /*long*/ selectList, int /*long*/ outSelection, int /*long*/ _retval) {
+public int /*long*/ Select (int /*long*/ parent, int /*long*/ dialogTitle, int /*long*/ text, int /*long*/ count, int /*long*/ selectList, int /*long*/ outSelection, int /*long*/ _retval) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/PromptServiceFactory.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/PromptServiceFactory.java
index 8988887590..d6b674d485 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/PromptServiceFactory.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/PromptServiceFactory.java
@@ -10,91 +10,91 @@
*******************************************************************************/
package org.eclipse.swt.browser;
+import org.eclipse.swt.internal.C;
import org.eclipse.swt.internal.mozilla.*;
-import org.eclipse.swt.internal.gtk.*;
class PromptServiceFactory {
XPCOMObject supports;
XPCOMObject factory;
int refCount = 0;
-public PromptServiceFactory() {
- createCOMInterfaces();
+public PromptServiceFactory () {
+ createCOMInterfaces ();
}
-int AddRef() {
+int AddRef () {
refCount++;
return refCount;
}
-void createCOMInterfaces() {
+void createCOMInterfaces () {
/* Create each of the interfaces that this object implements */
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
+ supports = new XPCOMObject (new int[] {2, 0, 0}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
};
- factory = new XPCOMObject(new int[]{2, 0, 0, 3, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return CreateInstance(args[0], args[1], args[2]);}
- public int /*long*/ method4(int /*long*/[] args) {return LockFactory(args[0]);}
+ factory = new XPCOMObject (new int[] {2, 0, 0, 3, 1}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return CreateInstance (args[0], args[1], args[2]);}
+ public int /*long*/ method4 (int /*long*/[] args) {return LockFactory (args[0]);}
};
}
-void disposeCOMInterfaces() {
+void disposeCOMInterfaces () {
if (supports != null) {
- supports.dispose();
+ supports.dispose ();
supports = null;
}
if (factory != null) {
- factory.dispose();
+ factory.dispose ();
factory = null;
}
}
-int /*long*/ getAddress() {
- return factory.getAddress();
+int /*long*/ getAddress () {
+ return factory.getAddress ();
}
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
+int /*long*/ QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
+ nsID guid = new nsID ();
+ XPCOM.memmove (guid, riid, nsID.sizeof);
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, OS.PTR_SIZEOF);
- AddRef();
+ if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
return XPCOM.NS_OK;
}
- if (guid.Equals(nsIFactory.NS_IFACTORY_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {factory.getAddress()}, OS.PTR_SIZEOF);
- AddRef();
+ if (guid.Equals (nsIFactory.NS_IFACTORY_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {factory.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
return XPCOM.NS_OK;
}
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, OS.PTR_SIZEOF);
+ XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
return XPCOM.NS_ERROR_NO_INTERFACE;
}
-int Release() {
+int Release () {
refCount--;
- if (refCount == 0) disposeCOMInterfaces();
+ if (refCount == 0) disposeCOMInterfaces ();
return refCount;
}
/* nsIFactory */
-public int /*long*/ CreateInstance(int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
- PromptService promptService = new PromptService();
- promptService.AddRef();
- XPCOM.memmove(result, new int /*long*/[] {promptService.getAddress()}, OS.PTR_SIZEOF);
+public int /*long*/ CreateInstance (int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) {
+ PromptService promptService = new PromptService ();
+ promptService.AddRef ();
+ XPCOM.memmove (result, new int /*long*/[] {promptService.getAddress ()}, C.PTR_SIZEOF);
return XPCOM.NS_OK;
}
-public int /*long*/ LockFactory(int /*long*/ lock) {
+public int /*long*/ LockFactory (int /*long*/ lock) {
return XPCOM.NS_OK;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/WindowCreator.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/WindowCreator.java
index 9c59675e44..e501c74d3d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/WindowCreator.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/browser/WindowCreator.java
@@ -12,8 +12,8 @@ package org.eclipse.swt.browser;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.C;
import org.eclipse.swt.internal.mozilla.*;
-import org.eclipse.swt.internal.gtk.OS;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
@@ -22,102 +22,102 @@ class WindowCreator {
XPCOMObject windowCreator;
int refCount = 0;
-public WindowCreator() {
- createCOMInterfaces();
+public WindowCreator () {
+ createCOMInterfaces ();
}
-int AddRef() {
+int AddRef () {
refCount++;
return refCount;
}
-void createCOMInterfaces() {
+void createCOMInterfaces () {
/* Create each of the interfaces that this object implements */
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
+ supports = new XPCOMObject (new int[] {2, 0, 0}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
};
- windowCreator = new XPCOMObject(new int[]{2, 0, 0, 3}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return CreateChromeWindow(args[0], args[1], args[2]);}
+ windowCreator = new XPCOMObject (new int[] {2, 0, 0, 3}) {
+ public int /*long*/ method0 (int /*long*/[] args) {return QueryInterface (args[0], args[1]);}
+ public int /*long*/ method1 (int /*long*/[] args) {return AddRef ();}
+ public int /*long*/ method2 (int /*long*/[] args) {return Release ();}
+ public int /*long*/ method3 (int /*long*/[] args) {return CreateChromeWindow (args[0], args[1], args[2]);}
};
}
-void disposeCOMInterfaces() {
+void disposeCOMInterfaces () {
if (supports != null) {
- supports.dispose();
+ supports.dispose ();
supports = null;
}
if (windowCreator != null) {
- windowCreator.dispose();
+ windowCreator.dispose ();
windowCreator = null;
}
}
-int /*long*/ getAddress() {
- return windowCreator.getAddress();
+int /*long*/ getAddress () {
+ return windowCreator.getAddress ();
}
-int /*long*/ QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) {
+int /*long*/ QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) {
if (riid == 0 || ppvObject == 0) return XPCOM.NS_ERROR_NO_INTERFACE;
- nsID guid = new nsID();
- XPCOM.memmove(guid, riid, nsID.sizeof);
+ nsID guid = new nsID ();
+ XPCOM.memmove (guid, riid, nsID.sizeof);
- if (guid.Equals(nsISupports.NS_ISUPPORTS_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {supports.getAddress()}, OS.PTR_SIZEOF);
- AddRef();
+ if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
return XPCOM.NS_OK;
}
- if (guid.Equals(nsIWindowCreator.NS_IWINDOWCREATOR_IID)) {
- XPCOM.memmove(ppvObject, new int /*long*/[] {windowCreator.getAddress()}, OS.PTR_SIZEOF);
- AddRef();
+ if (guid.Equals (nsIWindowCreator.NS_IWINDOWCREATOR_IID)) {
+ XPCOM.memmove (ppvObject, new int /*long*/[] {windowCreator.getAddress ()}, C.PTR_SIZEOF);
+ AddRef ();
return XPCOM.NS_OK;
}
- XPCOM.memmove(ppvObject, new int /*long*/[] {0}, OS.PTR_SIZEOF);
+ XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF);
return XPCOM.NS_ERROR_NO_INTERFACE;
}
-int Release() {
+int Release () {
refCount--;
- if (refCount == 0) disposeCOMInterfaces();
+ if (refCount == 0) disposeCOMInterfaces ();
return refCount;
}
/* nsIWindowCreator */
-int /*long*/ CreateChromeWindow(int /*long*/ parent, int /*long*/ chromeFlags, int /*long*/ _retval) {
+int /*long*/ CreateChromeWindow (int /*long*/ parent, int /*long*/ chromeFlags, int /*long*/ _retval) {
if (parent == 0 && (chromeFlags & nsIWebBrowserChrome.CHROME_MODAL) == 0) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
Browser src = null;
if (parent != 0) {
- nsIWebBrowserChrome browserChromeParent = new nsIWebBrowserChrome(parent);
+ nsIWebBrowserChrome browserChromeParent = new nsIWebBrowserChrome (parent);
int /*long*/[] aWebBrowser = new int /*long*/[1];
- int rc = browserChromeParent.GetWebBrowser(aWebBrowser);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- if (aWebBrowser[0] == 0) Mozilla.error(XPCOM.NS_ERROR_NO_INTERFACE);
+ int rc = browserChromeParent.GetWebBrowser (aWebBrowser);
+ if (rc != XPCOM.NS_OK) Mozilla.error (rc);
+ if (aWebBrowser[0] == 0) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE);
- nsIWebBrowser webBrowser = new nsIWebBrowser(aWebBrowser[0]);
+ nsIWebBrowser webBrowser = new nsIWebBrowser (aWebBrowser[0]);
int /*long*/[] result = new int /*long*/[1];
- rc = webBrowser.QueryInterface(nsIBaseWindow.NS_IBASEWINDOW_IID, result);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- if (result[0] == 0) Mozilla.error(XPCOM.NS_ERROR_NO_INTERFACE);
- webBrowser.Release();
+ rc = webBrowser.QueryInterface (nsIBaseWindow.NS_IBASEWINDOW_IID, result);
+ if (rc != XPCOM.NS_OK) Mozilla.error (rc);
+ if (result[0] == 0) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE);
+ webBrowser.Release ();
- nsIBaseWindow baseWindow = new nsIBaseWindow(result[0]);
+ nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]);
result[0] = 0;
int /*long*/[] aParentNativeWindow = new int /*long*/[1];
- rc = baseWindow.GetParentNativeWindow(aParentNativeWindow);
- if (rc != XPCOM.NS_OK) Mozilla.error(rc);
- if (aParentNativeWindow[0] == 0) Mozilla.error(XPCOM.NS_ERROR_NO_INTERFACE);
- baseWindow.Release();
+ rc = baseWindow.GetParentNativeWindow (aParentNativeWindow);
+ if (rc != XPCOM.NS_OK) Mozilla.error (rc);
+ if (aParentNativeWindow[0] == 0) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE);
+ baseWindow.Release ();
- src = Mozilla.findBrowser(aParentNativeWindow[0]);
+ src = Mozilla.findBrowser (aParentNativeWindow[0]);
}
final Browser browser;
boolean doit = false;
@@ -131,39 +131,39 @@ int /*long*/ CreateChromeWindow(int /*long*/ parent, int /*long*/ chromeFlags, i
* modal requests are handled here and not exposed to the user.
*/
final Shell shell = src == null ?
- new Shell(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL) :
- new Shell(src.getShell(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
- shell.setLayout(new FillLayout());
- browser = new Browser(shell, src.getStyle() & SWT.NONE /*MOZILLA*/); // TODO
- browser.addVisibilityWindowListener(new VisibilityWindowListener() {
- public void hide(WindowEvent event) {
+ new Shell (SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL) :
+ new Shell (src.getShell(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+ shell.setLayout (new FillLayout ());
+ browser = new Browser (shell, src.getStyle () & SWT.MOZILLA);
+ browser.addVisibilityWindowListener (new VisibilityWindowListener () {
+ public void hide (WindowEvent event) {
}
- public void show(WindowEvent event) {
- if (event.location != null) shell.setLocation(event.location);
+ public void show (WindowEvent event) {
+ if (event.location != null) shell.setLocation (event.location);
if (event.size != null) {
Point size = event.size;
- shell.setSize(shell.computeSize(size.x, size.y));
+ shell.setSize (shell.computeSize (size.x, size.y));
}
- shell.open();
+ shell.open ();
((Mozilla)browser.webBrowser).isModal = true;
}
});
- browser.addCloseWindowListener(new CloseWindowListener() {
- public void close(WindowEvent event) {
- shell.close();
+ browser.addCloseWindowListener (new CloseWindowListener () {
+ public void close (WindowEvent event) {
+ shell.close ();
}
});
doit = true;
} else {
- WindowEvent event = new WindowEvent(src);
- event.display = src.getDisplay();
+ WindowEvent event = new WindowEvent (src);
+ event.display = src.getDisplay ();
event.widget = src;
event.required = true;
for (int i = 0; i < src.webBrowser.openWindowListeners.length; i++) {
- src.webBrowser.openWindowListeners[i].open(event);
+ src.webBrowser.openWindowListeners[i].open (event);
}
browser = event.browser;
- doit = browser != null && !browser.isDisposed();
+ doit = browser != null && !browser.isDisposed ();
if (doit) {
((Mozilla)browser.webBrowser).addressBar = (chromeFlags & nsIWebBrowserChrome.CHROME_LOCATIONBAR) != 0;
((Mozilla)browser.webBrowser).menuBar = (chromeFlags & nsIWebBrowserChrome.CHROME_MENUBAR) != 0;
@@ -172,10 +172,10 @@ int /*long*/ CreateChromeWindow(int /*long*/ parent, int /*long*/ chromeFlags, i
}
}
if (doit) {
- int /*long*/ address = ((Mozilla)browser.webBrowser).webBrowserChrome.getAddress();
- nsIWebBrowserChrome webBrowserChrome = new nsIWebBrowserChrome(address);
- webBrowserChrome.AddRef();
- XPCOM.memmove(_retval, new int /*long*/[] {address}, OS.PTR_SIZEOF);
+ int /*long*/ address = ((Mozilla)browser.webBrowser).webBrowserChrome.getAddress ();
+ nsIWebBrowserChrome webBrowserChrome = new nsIWebBrowserChrome (address);
+ webBrowserChrome.AddRef ();
+ XPCOM.memmove (_retval, new int /*long*/[] {address}, C.PTR_SIZEOF);
}
return doit ? XPCOM.NS_OK : XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/internal/mozilla/XPCOMObject.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/internal/mozilla/XPCOMObject.java
index 4959c25264..05296f6cfd 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/internal/mozilla/XPCOMObject.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/mozilla/org/eclipse/swt/internal/mozilla/XPCOMObject.java
@@ -13,7 +13,6 @@ package org.eclipse.swt.internal.mozilla;
import java.util.*;
import org.eclipse.swt.*;
import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
public class XPCOMObject {
@@ -22,755 +21,755 @@ public class XPCOMObject {
static private final int MAX_ARG_COUNT = 12;
static private final int MAX_VTABLE_LENGTH = 80;
static private Callback[][] Callbacks = new Callback[MAX_VTABLE_LENGTH][MAX_ARG_COUNT];
- static private Hashtable ObjectMap = new Hashtable();
+ static private Hashtable ObjectMap = new Hashtable ();
-public XPCOMObject(int[] argCounts) {
+public XPCOMObject (int[] argCounts) {
int /*long*/[] callbackAddresses = new int /*long*/[argCounts.length];
for (int i = 0, length = argCounts.length; i < length; i++){
if ((Callbacks[i][argCounts[i]]) == null) {
- Callbacks[i][argCounts[i]] = new Callback(this.getClass(), "callback"+i, argCounts[i] + 1, true); //$NON-NLS-1$
+ Callbacks[i][argCounts[i]] = new Callback (getClass (), "callback"+i, argCounts[i] + 1, true); //$NON-NLS-1$
}
- callbackAddresses[i] = Callbacks[i][argCounts[i]].getAddress();
+ callbackAddresses[i] = Callbacks[i][argCounts[i]].getAddress ();
if (callbackAddresses[i] == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
}
- int /*long*/ pVtable = OS.g_malloc(OS.PTR_SIZEOF * argCounts.length);
- XPCOM.memmove(pVtable, callbackAddresses, OS.PTR_SIZEOF * argCounts.length);
- ppVtable = OS.g_malloc(OS.PTR_SIZEOF);
- XPCOM.memmove(ppVtable, new int /*long*/[] {pVtable}, OS.PTR_SIZEOF);
- ObjectMap.put(new LONG(ppVtable), this);
+ int /*long*/ pVtable = C.malloc (C.PTR_SIZEOF * argCounts.length);
+ XPCOM.memmove (pVtable, callbackAddresses, C.PTR_SIZEOF * argCounts.length);
+ ppVtable = C.malloc (C.PTR_SIZEOF);
+ XPCOM.memmove (ppVtable, new int /*long*/[] {pVtable}, C.PTR_SIZEOF);
+ ObjectMap.put (new LONG (ppVtable), this);
}
-static int /*long*/ callback0(int /*long*/[] callbackArgs) {
+static int /*long*/ callback0 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method0(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method0 (args);
}
-static int /*long*/ callback1(int /*long*/[] callbackArgs) {
+static int /*long*/ callback1 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method1(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method1 (args);
}
-static int /*long*/ callback10(int /*long*/[] callbackArgs) {
+static int /*long*/ callback10 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method10(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method10 (args);
}
-static int /*long*/ callback11(int /*long*/[] callbackArgs) {
+static int /*long*/ callback11 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method11(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method11 (args);
}
-static int /*long*/ callback12(int /*long*/[] callbackArgs) {
+static int /*long*/ callback12 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method12(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method12 (args);
}
-static int /*long*/ callback13(int /*long*/[] callbackArgs) {
+static int /*long*/ callback13 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method13(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method13 (args);
}
-static int /*long*/ callback14(int /*long*/[] callbackArgs) {
+static int /*long*/ callback14 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method14(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method14 (args);
}
-static int /*long*/ callback15(int /*long*/[] callbackArgs) {
+static int /*long*/ callback15 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method15(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method15 (args);
}
-static int /*long*/ callback16(int /*long*/[] callbackArgs) {
+static int /*long*/ callback16 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method16(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method16 (args);
}
-static int /*long*/ callback17(int /*long*/[] callbackArgs) {
+static int /*long*/ callback17 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method17(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method17 (args);
}
-static int /*long*/ callback18(int /*long*/[] callbackArgs) {
+static int /*long*/ callback18 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method18(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method18 (args);
}
-static int /*long*/ callback19(int /*long*/[] callbackArgs) {
+static int /*long*/ callback19 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method19(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method19 (args);
}
-static int /*long*/ callback2(int /*long*/[] callbackArgs) {
+static int /*long*/ callback2 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method2(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method2 (args);
}
-static int /*long*/ callback20(int /*long*/[] callbackArgs) {
+static int /*long*/ callback20 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method20(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method20 (args);
}
-static int /*long*/ callback21(int /*long*/[] callbackArgs) {
+static int /*long*/ callback21 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method21(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method21 (args);
}
-static int /*long*/ callback22(int /*long*/[] callbackArgs) {
+static int /*long*/ callback22 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method22(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method22 (args);
}
-static int /*long*/ callback23(int /*long*/[] callbackArgs) {
+static int /*long*/ callback23 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method23(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method23 (args);
}
-static int /*long*/ callback24(int /*long*/[] callbackArgs) {
+static int /*long*/ callback24 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method24(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method24 (args);
}
-static int /*long*/ callback25(int /*long*/[] callbackArgs) {
+static int /*long*/ callback25 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method25(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method25 (args);
}
-static int /*long*/ callback26(int /*long*/[] callbackArgs) {
+static int /*long*/ callback26 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method26(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method26 (args);
}
-static int /*long*/ callback27(int /*long*/[] callbackArgs) {
+static int /*long*/ callback27 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method27(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method27 (args);
}
-static int /*long*/ callback28(int /*long*/[] callbackArgs) {
+static int /*long*/ callback28 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method28(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method28 (args);
}
-static int /*long*/ callback29(int /*long*/[] callbackArgs) {
+static int /*long*/ callback29 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method29(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method29 (args);
}
-static int /*long*/ callback3(int /*long*/[] callbackArgs) {
+static int /*long*/ callback3 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method3(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method3 (args);
}
-static int /*long*/ callback30(int /*long*/[] callbackArgs) {
+static int /*long*/ callback30 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method30(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method30 (args);
}
-static int /*long*/ callback31(int /*long*/[] callbackArgs) {
+static int /*long*/ callback31 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method31(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method31 (args);
}
-static int /*long*/ callback32(int /*long*/[] callbackArgs) {
+static int /*long*/ callback32 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method32(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method32 (args);
}
-static int /*long*/ callback33(int /*long*/[] callbackArgs) {
+static int /*long*/ callback33 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method33(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method33 (args);
}
-static int /*long*/ callback34(int /*long*/[] callbackArgs) {
+static int /*long*/ callback34 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method34(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method34 (args);
}
-static int /*long*/ callback35(int /*long*/[] callbackArgs) {
+static int /*long*/ callback35 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method35(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method35 (args);
}
-static int /*long*/ callback36(int /*long*/[] callbackArgs) {
+static int /*long*/ callback36 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method36(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method36 (args);
}
-static int /*long*/ callback37(int /*long*/[] callbackArgs) {
+static int /*long*/ callback37 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method37(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method37 (args);
}
-static int /*long*/ callback38(int /*long*/[] callbackArgs) {
+static int /*long*/ callback38 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method38(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method38 (args);
}
-static int /*long*/ callback39(int /*long*/[] callbackArgs) {
+static int /*long*/ callback39 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method39(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method39 (args);
}
-static int /*long*/ callback4(int /*long*/[] callbackArgs) {
+static int /*long*/ callback4 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method4(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method4 (args);
}
-static int /*long*/ callback40(int /*long*/[] callbackArgs) {
+static int /*long*/ callback40 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method40(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method40 (args);
}
-static int /*long*/ callback41(int /*long*/[] callbackArgs) {
+static int /*long*/ callback41 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method41(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method41 (args);
}
-static int /*long*/ callback42(int /*long*/[] callbackArgs) {
+static int /*long*/ callback42 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method42(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method42 (args);
}
-static int /*long*/ callback43(int /*long*/[] callbackArgs) {
+static int /*long*/ callback43 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method43(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method43 (args);
}
-static int /*long*/ callback44(int /*long*/[] callbackArgs) {
+static int /*long*/ callback44 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method44(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method44 (args);
}
-static int /*long*/ callback45(int /*long*/[] callbackArgs) {
+static int /*long*/ callback45 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method45(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method45 (args);
}
-static int /*long*/ callback46(int /*long*/[] callbackArgs) {
+static int /*long*/ callback46 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method46(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method46 (args);
}
-static int /*long*/ callback47(int /*long*/[] callbackArgs) {
+static int /*long*/ callback47 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method47(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method47 (args);
}
-static int /*long*/ callback48(int /*long*/[] callbackArgs) {
+static int /*long*/ callback48 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method48(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method48 (args);
}
-static int /*long*/ callback49(int /*long*/[] callbackArgs) {
+static int /*long*/ callback49 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method49(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method49 (args);
}
-static int /*long*/ callback5(int /*long*/[] callbackArgs) {
+static int /*long*/ callback5 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method5(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method5 (args);
}
-static int /*long*/ callback50(int /*long*/[] callbackArgs) {
+static int /*long*/ callback50 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method50(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method50 (args);
}
-static int /*long*/ callback51(int /*long*/[] callbackArgs) {
+static int /*long*/ callback51 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method51(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method51 (args);
}
-static int /*long*/ callback52(int /*long*/[] callbackArgs) {
+static int /*long*/ callback52 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method52(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method52 (args);
}
-static int /*long*/ callback53(int /*long*/[] callbackArgs) {
+static int /*long*/ callback53 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method53(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method53 (args);
}
-static int /*long*/ callback54(int /*long*/[] callbackArgs) {
+static int /*long*/ callback54 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method54(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method54 (args);
}
-static int /*long*/ callback55(int /*long*/[] callbackArgs) {
+static int /*long*/ callback55 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method55(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method55 (args);
}
-static int /*long*/ callback56(int /*long*/[] callbackArgs) {
+static int /*long*/ callback56 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method56(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method56 (args);
}
-static int /*long*/ callback57(int /*long*/[] callbackArgs) {
+static int /*long*/ callback57 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method57(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method57 (args);
}
-static int /*long*/ callback58(int /*long*/[] callbackArgs) {
+static int /*long*/ callback58 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method58(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method58 (args);
}
-static int /*long*/ callback59(int /*long*/[] callbackArgs) {
+static int /*long*/ callback59 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method59(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method59 (args);
}
-static int /*long*/ callback6(int /*long*/[] callbackArgs) {
+static int /*long*/ callback6 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method6(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method6 (args);
}
-static int /*long*/ callback60(int /*long*/[] callbackArgs) {
+static int /*long*/ callback60 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method60(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method60 (args);
}
-static int /*long*/ callback61(int /*long*/[] callbackArgs) {
+static int /*long*/ callback61 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method61(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method61 (args);
}
-static int /*long*/ callback62(int /*long*/[] callbackArgs) {
+static int /*long*/ callback62 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method62(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method62 (args);
}
-static int /*long*/ callback63(int /*long*/[] callbackArgs) {
+static int /*long*/ callback63 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method63(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method63 (args);
}
-static int /*long*/ callback64(int /*long*/[] callbackArgs) {
+static int /*long*/ callback64 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method64(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method64 (args);
}
-static int /*long*/ callback65(int /*long*/[] callbackArgs) {
+static int /*long*/ callback65 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method65(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method65 (args);
}
-static int /*long*/ callback66(int /*long*/[] callbackArgs) {
+static int /*long*/ callback66 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method66(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method66 (args);
}
-static int /*long*/ callback67(int /*long*/[] callbackArgs) {
+static int /*long*/ callback67 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method67(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method67 (args);
}
-static int /*long*/ callback68(int /*long*/[] callbackArgs) {
+static int /*long*/ callback68 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method68(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method68 (args);
}
-static int /*long*/ callback69(int /*long*/[] callbackArgs) {
+static int /*long*/ callback69 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method69(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method69 (args);
}
-static int /*long*/ callback7(int /*long*/[] callbackArgs) {
+static int /*long*/ callback7 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method7(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method7 (args);
}
-static int /*long*/ callback70(int /*long*/[] callbackArgs) {
+static int /*long*/ callback70 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method70(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method70 (args);
}
-static int /*long*/ callback71(int /*long*/[] callbackArgs) {
+static int /*long*/ callback71 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method71(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method71 (args);
}
-static int /*long*/ callback72(int /*long*/[] callbackArgs) {
+static int /*long*/ callback72 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method72(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method72 (args);
}
-static int /*long*/ callback73(int /*long*/[] callbackArgs) {
+static int /*long*/ callback73 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method73(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method73 (args);
}
-static int /*long*/ callback74(int /*long*/[] callbackArgs) {
+static int /*long*/ callback74 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method74(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method74 (args);
}
-static int /*long*/ callback75(int /*long*/[] callbackArgs) {
+static int /*long*/ callback75 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method75(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method75 (args);
}
-static int /*long*/ callback76(int /*long*/[] callbackArgs) {
+static int /*long*/ callback76 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method76(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method76 (args);
}
-static int /*long*/ callback77(int /*long*/[] callbackArgs) {
+static int /*long*/ callback77 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method77(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method77 (args);
}
-static int /*long*/ callback78(int /*long*/[] callbackArgs) {
+static int /*long*/ callback78 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method78(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method78 (args);
}
-static int /*long*/ callback79(int /*long*/[] callbackArgs) {
+static int /*long*/ callback79 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method79(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method79 (args);
}
-static int /*long*/ callback8(int /*long*/[] callbackArgs) {
+static int /*long*/ callback8 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method8(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method8 (args);
}
-static int /*long*/ callback9(int /*long*/[] callbackArgs) {
+static int /*long*/ callback9 (int /*long*/[] callbackArgs) {
// find the object on which this call was invoked
int /*long*/ address = callbackArgs[0];
- Object object = ObjectMap.get(new LONG(address));
+ Object object = ObjectMap.get (new LONG (address));
if (object == null) return XPCOM.NS_ERROR_FAILURE;
int /*long*/[] args = new int /*long*/[callbackArgs.length - 1];
- System.arraycopy(callbackArgs, 1, args, 0, args.length);
- return ((XPCOMObject) object).method9(args);
+ System.arraycopy (callbackArgs, 1, args, 0, args.length);
+ return ((XPCOMObject) object).method9 (args);
}
public void dispose() {
// free the memory for this reference
int /*long*/[] pVtable = new int /*long*/[1];
- XPCOM.memmove(pVtable, ppVtable, OS.PTR_SIZEOF);
- OS.g_free(pVtable[0]);
- OS.g_free(ppVtable);
+ XPCOM.memmove (pVtable, ppVtable, C.PTR_SIZEOF);
+ C.free (pVtable[0]);
+ C.free (ppVtable);
// remove this ppVtable from the list
- ObjectMap.remove(new LONG(ppVtable));
+ ObjectMap.remove (new LONG (ppVtable));
ppVtable = 0;
}
@@ -779,244 +778,244 @@ public int /*long*/ getAddress () {
return ppVtable;
}
-public int /*long*/ method0(int /*long*/[] args) {
+public int /*long*/ method0 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method1(int /*long*/[] args) {
+public int /*long*/ method1 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method10(int /*long*/[] args) {
+public int /*long*/ method10 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method11(int /*long*/[] args) {
+public int /*long*/ method11 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method12(int /*long*/[] args) {
+public int /*long*/ method12 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method13(int /*long*/[] args) {
+public int /*long*/ method13 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method14(int /*long*/[] args) {
+public int /*long*/ method14 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method15(int /*long*/[] args) {
+public int /*long*/ method15 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method16(int /*long*/[] args) {
+public int /*long*/ method16 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method17(int /*long*/[] args) {
+public int /*long*/ method17 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method18(int /*long*/[] args) {
+public int /*long*/ method18 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method19(int /*long*/[] args) {
+public int /*long*/ method19 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method2(int /*long*/[] args) {
+public int /*long*/ method2 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method20(int /*long*/[] args) {
+public int /*long*/ method20 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method21(int /*long*/[] args) {
+public int /*long*/ method21 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method22(int /*long*/[] args) {
+public int /*long*/ method22 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method23(int /*long*/[] args) {
+public int /*long*/ method23 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method24(int /*long*/[] args) {
+public int /*long*/ method24 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method25(int /*long*/[] args) {
+public int /*long*/ method25 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method26(int /*long*/[] args) {
+public int /*long*/ method26 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method27(int /*long*/[] args) {
+public int /*long*/ method27 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method28(int /*long*/[] args) {
+public int /*long*/ method28 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method29(int /*long*/[] args) {
+public int /*long*/ method29 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method3(int /*long*/[] args) {
+public int /*long*/ method3 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method30(int /*long*/[] args) {
+public int /*long*/ method30 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method31(int /*long*/[] args) {
+public int /*long*/ method31 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method32(int /*long*/[] args) {
+public int /*long*/ method32 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method33(int /*long*/[] args) {
+public int /*long*/ method33 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method34(int /*long*/[] args) {
+public int /*long*/ method34 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method35(int /*long*/[] args) {
+public int /*long*/ method35 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method36(int /*long*/[] args) {
+public int /*long*/ method36 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method37(int /*long*/[] args) {
+public int /*long*/ method37 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method38(int /*long*/[] args) {
+public int /*long*/ method38 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method39(int /*long*/[] args) {
+public int /*long*/ method39 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method4(int /*long*/[] args) {
+public int /*long*/ method4 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method40(int /*long*/[] args) {
+public int /*long*/ method40 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method41(int /*long*/[] args) {
+public int /*long*/ method41 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method42(int /*long*/[] args) {
+public int /*long*/ method42 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method43(int /*long*/[] args) {
+public int /*long*/ method43 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method44(int /*long*/[] args) {
+public int /*long*/ method44 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method45(int /*long*/[] args) {
+public int /*long*/ method45 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method46(int /*long*/[] args) {
+public int /*long*/ method46 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method47(int /*long*/[] args) {
+public int /*long*/ method47 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method48(int /*long*/[] args) {
+public int /*long*/ method48 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method49(int /*long*/[] args) {
+public int /*long*/ method49 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method5(int /*long*/[] args) {
+public int /*long*/ method5 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method50(int /*long*/[] args) {
+public int /*long*/ method50 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method51(int /*long*/[] args) {
+public int /*long*/ method51 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method52(int /*long*/[] args) {
+public int /*long*/ method52 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method53(int /*long*/[] args) {
+public int /*long*/ method53 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method54(int /*long*/[] args) {
+public int /*long*/ method54 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method55(int /*long*/[] args) {
+public int /*long*/ method55 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method56(int /*long*/[] args) {
+public int /*long*/ method56 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method57(int /*long*/[] args) {
+public int /*long*/ method57 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method58(int /*long*/[] args) {
+public int /*long*/ method58 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method59(int /*long*/[] args) {
+public int /*long*/ method59 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method6(int /*long*/[] args) {
+public int /*long*/ method6 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method60(int /*long*/[] args) {
+public int /*long*/ method60 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method61(int /*long*/[] args) {
+public int /*long*/ method61 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method62(int /*long*/[] args) {
+public int /*long*/ method62 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method63(int /*long*/[] args) {
+public int /*long*/ method63 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method64(int /*long*/[] args) {
+public int /*long*/ method64 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method65(int /*long*/[] args) {
+public int /*long*/ method65 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method66(int /*long*/[] args) {
+public int /*long*/ method66 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method67(int /*long*/[] args) {
+public int /*long*/ method67 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method68(int /*long*/[] args) {
+public int /*long*/ method68 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method69(int /*long*/[] args) {
+public int /*long*/ method69 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method7(int /*long*/[] args) {
+public int /*long*/ method7 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method70(int /*long*/[] args) {
+public int /*long*/ method70 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method71(int /*long*/[] args) {
+public int /*long*/ method71 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method72(int /*long*/[] args) {
+public int /*long*/ method72 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method73(int /*long*/[] args) {
+public int /*long*/ method73 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method74(int /*long*/[] args) {
+public int /*long*/ method74 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method75(int /*long*/[] args) {
+public int /*long*/ method75 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method76(int /*long*/[] args) {
+public int /*long*/ method76 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method77(int /*long*/[] args) {
+public int /*long*/ method77 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method78(int /*long*/[] args) {
+public int /*long*/ method78 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method79(int /*long*/[] args) {
+public int /*long*/ method79 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method8(int /*long*/[] args) {
+public int /*long*/ method8 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
-public int /*long*/ method9(int /*long*/[] args) {
+public int /*long*/ method9 (int /*long*/[] args) {
return XPCOM.NS_ERROR_NOT_IMPLEMENTED;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/MozillaDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/MozillaDelegate.java
new file mode 100644
index 0000000000..99b56ac95c
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/MozillaDelegate.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.browser;
+
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.internal.win32.OS;
+import org.eclipse.swt.widgets.*;
+
+class MozillaDelegate {
+ Browser browser;
+
+MozillaDelegate (Browser browser) {
+ super ();
+ this.browser = browser;
+}
+
+static Browser findBrowser (int /*long*/ handle) {
+ Display display = Display.getCurrent ();
+ return (Browser)display.findWidget (handle);
+}
+
+int /*long*/ getHandle () {
+ return browser.handle;
+}
+
+public static char[] mbcsToWcs (String codePage, byte[] buffer) {
+ char[] chars = new char[buffer.length];
+ int charCount = OS.MultiByteToWideChar (OS.CP_ACP, OS.MB_PRECOMPOSED, buffer, buffer.length, chars, chars.length);
+ if (charCount == chars.length) return chars;
+ char[] result = new char[charCount];
+ System.arraycopy (chars, 0, result, 0, charCount);
+ return result;
+}
+
+void onDispose (int /*long*/ embedHandle) {
+}
+
+void setSize (int /*long*/ embedHandle, int width, int height) {
+}
+
+public static byte[] wcsToMbcs (String codePage, String string, boolean terminate) {
+ int byteCount;
+ char[] chars = new char[string.length()];
+ string.getChars (0, chars.length, chars, 0);
+ byte[] bytes = new byte[byteCount = chars.length * 2 + (terminate ? 1 : 0)];
+ byteCount = OS.WideCharToMultiByte (OS.CP_ACP, 0, chars, chars.length, bytes, byteCount, null, null);
+ if (terminate) {
+ byteCount++;
+ } else {
+ if (bytes.length != byteCount) {
+ byte[] result = new byte[byteCount];
+ System.arraycopy (bytes, 0, result, 0, byteCount);
+ bytes = result;
+ }
+ }
+ return bytes;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/swt_xpcom.rc b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/swt_xpcom.rc
new file mode 100644
index 0000000000..e46095f457
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/swt_xpcom.rc
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#include "windows.h"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION SWT_COMMA_VERSION
+ PRODUCTVERSION 0,0,0,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40000L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Eclipse Foundation\0"
+ VALUE "FileDescription", "SWT for Windows native library\0"
+ VALUE "FileVersion", SWT_FILE_VERSION
+ VALUE "InternalName", "SWT\0"
+ VALUE "LegalCopyright", "Copyright (c) 2000, 2006 IBM Corp. All Rights Reserved.\0"
+ VALUE "OriginalFilename", SWT_ORG_FILENAME
+ VALUE "ProductName", "Standard Widget Toolkit\0"
+ VALUE "ProductVersion", "0,0,0,0\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp
index fea900c84b..a00d3335ef 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp
@@ -2094,22 +2094,6 @@ JNIEXPORT jboolean JNICALL XPCOM_NATIVE(nsID_1Equals)
}
#endif
-#ifndef NO_nsID_1Parse
-JNIEXPORT jboolean JNICALL XPCOM_NATIVE(nsID_1Parse)
- (JNIEnv *env, jclass that, jint arg0, jstring arg1)
-{
- const char *lparg1= NULL;
- jboolean rc = 0;
- XPCOM_NATIVE_ENTER(env, that, nsID_1Parse_FUNC);
- if (arg1) if ((lparg1 = env->GetStringUTFChars(arg1, NULL)) == NULL) goto fail;
- rc = (jboolean)((nsID *)arg0)->Parse((const char *)lparg1);
-fail:
- if (arg1 && lparg1) env->ReleaseStringUTFChars(arg1, lparg1);
- XPCOM_NATIVE_EXIT(env, that, nsID_1Parse_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_nsID_1delete
JNIEXPORT void JNICALL XPCOM_NATIVE(nsID_1delete)
(JNIEnv *env, jclass that, jint arg0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp
index 716d40b77e..f5db4e2af8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp
@@ -14,8 +14,8 @@
#ifdef NATIVE_STATS
-int XPCOM_nativeFunctionCount = 124;
-int XPCOM_nativeFunctionCallCount[124];
+int XPCOM_nativeFunctionCount = 123;
+int XPCOM_nativeFunctionCallCount[123];
char * XPCOM_nativeFunctionNames[] = {
"Call",
"NS_1GetComponentManager",
@@ -137,7 +137,6 @@ char * XPCOM_nativeFunctionNames[] = {
"nsEmbedString_1new__",
"nsEmbedString_1new___3C",
"nsID_1Equals",
- "nsID_1Parse",
"nsID_1delete",
"nsID_1new",
"strlen_1PRUnichar",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h
index 35a667c44e..a615c7580f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h
@@ -141,7 +141,6 @@ typedef enum {
nsEmbedString_1new___FUNC,
nsEmbedString_1new___3C_FUNC,
nsID_1Equals_FUNC,
- nsID_1Parse_FUNC,
nsID_1delete_FUNC,
nsID_1new_FUNC,
strlen_1PRUnichar_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcomglue.h b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcomglue.h
index 6ed2fa8ab5..795a73b714 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcomglue.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcomglue.h
@@ -14,6 +14,7 @@
#define NDEBUG
+#define XPCOM_GLUE 1
#include "nsXPCOMGlue.h"
#ifdef _WIN32
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java
index aafd1e43ad..51b806ac75 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java
@@ -114,7 +114,6 @@ public static final native int nsEmbedCString_Length(int /*long*/ ptr);
public static final native int /*long*/ nsEmbedCString_get(int /*long*/ ptr);
public static final native void nsID_delete(int /*long*/ ptr);
public static final native int /*long*/ nsID_new();
-public static final native boolean nsID_Parse(int /*long*/ ptr, String aIDStr);
public static final native boolean nsID_Equals(int /*long*/ ptr, int /*long*/ other);
public static final native int /*long*/ nsEmbedString_new();
public static final native int /*long*/ nsEmbedString_new(char[] aString);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsID.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsID.java
index 7cf9ad5c6b..9ecff4eeaa 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsID.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsID.java
@@ -41,7 +41,7 @@ public nsID() {
public nsID(String id) {
Parse(id);
}
-
+
public boolean Equals(nsID other) {
int /*long*/ ptr = XPCOM.nsID_new();
XPCOM.memmove(ptr, this, nsID.sizeof);
@@ -53,11 +53,24 @@ public boolean Equals(nsID other) {
return result;
}
-public boolean Parse(String aIDStr) {
- int /*long*/ ptr = XPCOM.nsID_new();
- boolean result = XPCOM.nsID_Parse(ptr, aIDStr);
- XPCOM.memmove(this, ptr, nsID.sizeof);
- XPCOM.nsID_delete(ptr);
- return result;
-}
+public void Parse (String aIDStr) {
+ if(aIDStr == null) throw new Error ();
+ int i = 0;
+ for (; i < 8; i++) m0 = (m0 << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16);
+ if (aIDStr.charAt (i++) != '-') throw new Error ();
+ for (; i < 13; i++) m1 = (short)((m1 << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
+ if (aIDStr.charAt (i++) != '-') throw new Error ();
+ for (; i < 18; i++) m2 = (short)((m2 << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
+ if (aIDStr.charAt (i++) != '-') throw new Error ();
+ for (; i < 21; i++) m3[0] = (byte)((m3[0] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
+ for (; i < 23; i++) m3[1] = (byte)((m3[1] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
+ if (aIDStr.charAt (i++) != '-') throw new Error ();
+ for (; i < 26; i++) m3[2] = (byte)((m3[2] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
+ for (; i < 28; i++) m3[3] = (byte)((m3[3] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
+ for (; i < 30; i++) m3[4] = (byte)((m3[4] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
+ for (; i < 32; i++) m3[5] = (byte)((m3[5] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
+ for (; i < 34; i++) m3[6] = (byte)((m3[6] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
+ for (; i < 36; i++) m3[7] = (byte)((m3[7] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
+}
+
} \ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/Mozilla.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/Mozilla.java
deleted file mode 100755
index 27a1c4861f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/Mozilla.java
+++ /dev/null
@@ -1,2267 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.browser;
-
-import java.io.*;
-import java.util.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-import org.eclipse.swt.internal.mozilla.*;
-import org.eclipse.swt.layout.*;
-
-class Mozilla extends WebBrowser {
- int /*long*/ embedHandle;
- int /*long*/ mozillaHandle;
- nsIWebBrowser webBrowser;
-
- /* Interfaces for this Mozilla embedding notification */
- XPCOMObject supports;
- XPCOMObject weakReference;
- XPCOMObject webProgressListener;
- XPCOMObject webBrowserChrome;
- XPCOMObject webBrowserChromeFocus;
- XPCOMObject embeddingSiteWindow;
- XPCOMObject interfaceRequestor;
- XPCOMObject supportsWeakReference;
- XPCOMObject contextMenuListener;
- XPCOMObject uriContentListener;
- XPCOMObject tooltipListener;
- XPCOMObject directoryServiceProviderListener;
- int chromeFlags = nsIWebBrowserChrome.CHROME_DEFAULT;
- int refCount = 0;
- int /*long*/ request;
- Point location;
- Point size;
- boolean addressBar, menuBar, statusBar, toolBar;
- boolean visible, isModal;
- Shell tip = null;
-
- static nsIAppShell AppShell;
- static WindowCreator WindowCreator;
- static int BrowserCount;
- static boolean initialized, ignoreDispose;
- static Callback eventCallback;
- static int /*long*/ eventProc;
- static String profileRootDirectory;
-
- /* XULRunner detect constants */
- static final String GRERANGE_LOWER = "1.8"; //$NON-NLS-1$
- static final boolean LowerRangeInclusive = true;
- static final String GRERANGE_UPPER = "1.9"; //$NON-NLS-1$
- static final boolean UpperRangeInclusive = false;
- static final String SEPARATOR_OS = System.getProperty("file.separator"); //$NON-NLS-1$
- static final String XPCOM_LIB = "/libxpcom.so"; //$NON-NLS-1$
-
- /* Package Name */
- static final String ADD_WIDGET_KEY = "org.eclipse.swt.internal.addWidget"; //$NON-NLS-1$
- static final String URI_FROMMEMORY = "file:///"; //$NON-NLS-1$
- static final String ABOUT_BLANK = "about:blank"; //$NON-NLS-1$
- static final String PREFERENCE_LANGUAGES = "intl.accept_languages"; //$NON-NLS-1$
- static final String PREFERENCE_CHARSET = "intl.charset.default"; //$NON-NLS-1$
- static final String SEPARATOR_LOCALE = "-"; //$NON-NLS-1$
- static final String TOKENIZER_LOCALE = ","; //$NON-NLS-1$
- static final String PROFILE_DIR = "/eclipse/"; //$NON-NLS-1$
- static final String HISTORY_FILE = "history.dat"; //$NON-NLS-1$
- static final String MIMETYPES_FILE = "mimeTypes.rdf"; //$NON-NLS-1$
- static final String PREFERENCES_FILE = "prefs.js"; //$NON-NLS-1$
- static final String CHROME_DIR = "chrome"; //$NON-NLS-1$
- static final String LOCALSTORE_FILE = "localstore.rdf"; //$NON-NLS-1$
- static final String PROFILE_AFTER_CHANGE = "profile-after-change"; //$NON-NLS-1$
- static final String PROFILE_BEFORE_CHANGE = "profile-before-change"; //$NON-NLS-1$
- static final String PROFILE_DO_CHANGE = "profile-do-change"; //$NON-NLS-1$
- static final String SHUTDOWN_PERSIST = "shutdown-persist"; //$NON-NLS-1$
- static final String STARTUP = "startup"; //$NON-NLS-1$
- static final int STOP_PROPOGATE = 1;
-
- static {
- MozillaClearSessions = new Runnable() {
- public void run() {
- if (!initialized) return;
- int /*long*/[] result = new int /*long*/[1];
- int rc = XPCOM.NS_GetServiceManager (result);
- if (rc != XPCOM.NS_OK) error (rc);
- if (result [0] == 0) error (XPCOM.NS_NOINTERFACE);
- nsIServiceManager serviceManager = new nsIServiceManager (result [0]);
- result [0] = 0;
- byte[] aContractID = Converter.wcsToMbcs(null, XPCOM.NS_COOKIEMANAGER_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID (aContractID, nsICookieManager.NS_ICOOKIEMANAGER_IID, result);
- if (rc != XPCOM.NS_OK) error (rc);
- if (result [0] == 0) error (XPCOM.NS_NOINTERFACE);
- serviceManager.Release ();
-
- nsICookieManager manager = new nsICookieManager (result [0]);
- result [0] = 0;
- rc = manager.GetEnumerator (result);
- if (rc != XPCOM.NS_OK) error (rc);
- manager.Release ();
-
- nsISimpleEnumerator enumerator = new nsISimpleEnumerator (result [0]);
- boolean[] moreElements = new boolean [1];
- rc = enumerator.HasMoreElements (moreElements);
- if (rc != XPCOM.NS_OK) error (rc);
- while (moreElements [0]) {
- result [0] = 0;
- rc = enumerator.GetNext (result);
- if (rc != XPCOM.NS_OK) error (rc);
- nsICookie cookie = new nsICookie (result [0]);
- long[] expires = new long [1];
- rc = cookie.GetExpires (expires);
- if (expires [0] == 0) {
- /* indicates a session cookie */
- int /*long*/ domain = XPCOM.nsEmbedCString_new ();
- int /*long*/ name = XPCOM.nsEmbedCString_new ();
- int /*long*/ path = XPCOM.nsEmbedCString_new ();
- cookie.GetHost (domain);
- cookie.GetName (name);
- cookie.GetPath (path);
- rc = manager.Remove (domain, name, path, false);
- XPCOM.nsEmbedCString_delete (domain);
- XPCOM.nsEmbedCString_delete (name);
- XPCOM.nsEmbedCString_delete (path);
- if (rc != XPCOM.NS_OK) error (rc);
- }
- cookie.Release ();
- rc = enumerator.HasMoreElements (moreElements);
- if (rc != XPCOM.NS_OK) error (rc);
- }
- enumerator.Release ();
- }
- };
- }
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * lists the style constants that are applicable to the class.
- * Style bits are also inherited from superclasses.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- * @exception SWTError <ul>
- * <li>ERROR_NO_HANDLES if a handle could not be obtained for browser creation</li>
- * </ul>
- *
- * @see #getStyle
- *
- * @since 3.0
- */
-public void create(Composite parent, int style) {
- Display display = parent.getDisplay();
- display.setData(Browser.NO_INPUT_METHOD, null);
-
- int /*long*/[] result = new int /*long*/[1];
- if (!initialized) {
- String mozillaPath = null;
-
- boolean initLoaded = false;
- try {
- Library.loadLibrary ("swt-xpcominit"); //$NON-NLS-1$
- initLoaded = true;
- } catch (UnsatisfiedLinkError e) {
- try {
- /*
- * The initial loadLibrary attempt may have failed as a result of the user's
- * system not having libstdc++.so.6 installed, so try to load the alternate
- * swt xpcominit library that depends on libswtc++.so.5 instead.
- */
- Library.loadLibrary ("swt-xpcominit-gcc3"); //$NON-NLS-1$
- initLoaded = true;
- } catch (UnsatisfiedLinkError ex) {
- /*
- * If this library still failed to load then do not attempt to detect a
- * xulrunner to use. The Browser may still be usable if MOZILLA_FIVE_HOME
- * points at a GRE.
- */
- }
- }
-
- boolean isXULRunner = false;
- if (initLoaded) {
- /* attempt to discover a XULRunner to use as the GRE */
- GREVersionRange range = new GREVersionRange();
- byte[] bytes = Converter.wcsToMbcs(null, GRERANGE_LOWER, true);
- int /*long*/ lower = OS.g_malloc (bytes.length);
- OS.memmove (lower, bytes, bytes.length);
- range.lower = lower;
- range.lowerInclusive = LowerRangeInclusive;
-
- bytes = Converter.wcsToMbcs(null, GRERANGE_UPPER, true);
- int /*long*/ upper = OS.g_malloc (bytes.length);
- OS.memmove (upper, bytes, bytes.length);
- range.upper = upper;
- range.upperInclusive = UpperRangeInclusive;
-
- int length = XPCOMInit.PATH_MAX;
- int /*long*/ greBuffer = OS.g_malloc(length);
- int /*long*/ propertiesPtr = OS.g_malloc(2 * OS.PTR_SIZEOF);
- int rc = XPCOMInit.GRE_GetGREPathWithProperties(range, 1, propertiesPtr, 0, greBuffer, length);
- OS.g_free(lower);
- OS.g_free(upper);
- OS.g_free(propertiesPtr);
- if (rc == XPCOM.NS_OK) {
- /* indicates that a XULRunner was found */
- length = OS.strlen(greBuffer);
- bytes = new byte[length];
- OS.memmove(bytes, greBuffer, length);
- mozillaPath = new String(Converter.mbcsToWcs(null, bytes));
- // the following line is intentionally commented
- isXULRunner = mozillaPath.length() > 0;
- }
- OS.g_free(greBuffer);
- }
-
- if (isXULRunner) {
- try {
- Library.loadLibrary ("swt-xulrunner"); //$NON-NLS-1$
- } catch (UnsatisfiedLinkError e) {
- try {
- /*
- * The initial loadLibrary attempt may have failed as a result of the user's
- * system not having libstdc++.so.6 installed, so try to load the alternate
- * swt xulrunner library that depends on libswtc++.so.5 instead.
- */
- Library.loadLibrary ("swt-xulrunner-gcc3"); //$NON-NLS-1$
- } catch (UnsatisfiedLinkError ex) {
- browser.dispose ();
- /*
- * Print the error from the first failed attempt since at this point it's
- * known that the failure was not due to the libstdc++.so.6 dependency.
- */
- SWT.error (SWT.ERROR_NO_HANDLES, e);
- }
- }
- byte[] path = Converter.wcsToMbcs(null, mozillaPath, true);
- int rc = XPCOMGlue.XPCOMGlueStartup(path);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
-
- /*
- * remove the trailing "libxpcom.so" from mozillaPath because the NS_InitXPCOM2
- * invocation requires a directory name only
- */
- mozillaPath = mozillaPath.substring(0, mozillaPath.lastIndexOf(SEPARATOR_OS));
- } else {
- /* attempt to use the GRE pointed at by MOZILLA_FIVE_HOME */
- int /*long*/ ptr = OS.getenv(Converter.wcsToMbcs(null, XPCOM.MOZILLA_FIVE_HOME, true));
- if (ptr != 0) {
- int length = OS.strlen(ptr);
- byte[] buffer = new byte[length];
- OS.memmove(buffer, ptr, length);
- mozillaPath = new String (Converter.mbcsToWcs (null, buffer));
- }
- if (mozillaPath == null) {
- browser.dispose();
- SWT.error(SWT.ERROR_NO_HANDLES, null, " [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)]"); //$NON-NLS-1$
- }
- /*
- * Note. Embedding a Mozilla GTK1.2 causes a crash. The workaround
- * is to check the version of GTK used by Mozilla by looking for
- * the libwidget_gtk.so library used by Mozilla GTK1.2. Mozilla GTK2
- * uses the libwidget_gtk2.so library.
- */
- File file = new File(mozillaPath, "components/libwidget_gtk.so"); //$NON-NLS-1$
- if (file.exists()) {
- browser.dispose();
- SWT.error(SWT.ERROR_NO_HANDLES, null, " [Mozilla GTK2 required (GTK1.2 detected)]"); //$NON-NLS-1$
- }
-
- try {
- Library.loadLibrary ("swt-mozilla"); //$NON-NLS-1$
- } catch (UnsatisfiedLinkError e) {
- try {
- /*
- * The initial loadLibrary attempt may have failed as a result of the user's
- * system not having libstdc++.so.6 installed, so try to load the alternate
- * swt mozilla library that depends on libswtc++.so.5 instead.
- */
- Library.loadLibrary ("swt-mozilla-gcc3"); //$NON-NLS-1$
- } catch (UnsatisfiedLinkError ex) {
- browser.dispose ();
- /*
- * Print the error from the first failed attempt since at this point it's
- * known that the failure was not due to the libstdc++.so.6 dependency.
- */
- SWT.error (SWT.ERROR_NO_HANDLES, e);
- }
- }
- }
-
- int /*long*/[] retVal = new int /*long*/[1];
- nsEmbedString pathString = new nsEmbedString(mozillaPath);
- int rc = XPCOM.NS_NewLocalFile(pathString.getAddress(), true, retVal);
- pathString.dispose();
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (retVal[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_ERROR_NULL_POINTER);
- }
-
- nsIFile localFile = new nsILocalFile(retVal[0]);
- rc = XPCOM.NS_InitXPCOM2(0, localFile.getAddress(), 0);
- localFile.Release();
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- SWT.error(SWT.ERROR_NO_HANDLES, null, " [MOZILLA_FIVE_HOME may not point at an embeddable GRE] [NS_InitEmbedding " + mozillaPath + " error " + rc + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- rc = XPCOM.NS_GetComponentManager(result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- nsIComponentManager componentManager = new nsIComponentManager(result[0]);
- result[0] = 0;
- rc = componentManager.CreateInstance(XPCOM.NS_APPSHELL_CID, 0, nsIAppShell.NS_IAPPSHELL_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- AppShell = new nsIAppShell(result[0]);
- rc = AppShell.Create(0, null);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- rc = AppShell.Spinup();
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
-
- WindowCreator = new WindowCreator();
- WindowCreator.AddRef();
-
- rc = XPCOM.NS_GetServiceManager(result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- nsIServiceManager serviceManager = new nsIServiceManager(result[0]);
- result[0] = 0;
- byte[] aContractID = Converter.wcsToMbcs(null, XPCOM.NS_WINDOWWATCHER_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID(aContractID, nsIWindowWatcher.NS_IWINDOWWATCHER_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- nsIWindowWatcher windowWatcher = new nsIWindowWatcher(result[0]);
- result[0] = 0;
- rc = windowWatcher.SetWindowCreator(WindowCreator.getAddress());
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- windowWatcher.Release();
-
- /* compute the root profile directory */
- byte[] buffer = Converter.wcsToMbcs(null, XPCOM.NS_DIRECTORYSERVICE_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID(buffer, nsIDirectoryService.NS_IDIRECTORYSERVICE_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- nsIDirectoryService directoryService = new nsIDirectoryService(result[0]);
- result[0] = 0;
- rc = directoryService.QueryInterface(nsIProperties.NS_IPROPERTIES_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
- directoryService.Release();
-
- nsIProperties properties = new nsIProperties(result[0]);
- result[0] = 0;
- buffer = Converter.wcsToMbcs(null, XPCOM.NS_APP_APPLICATION_REGISTRY_DIR, true);
- rc = properties.Get(buffer, nsIFile.NS_IFILE_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
- properties.Release();
-
- nsIFile profileDir = new nsIFile(result[0]);
- result[0] = 0;
- int /*long*/ path = XPCOM.nsEmbedCString_new();
- rc = profileDir.GetNativePath(path);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- int length = XPCOM.nsEmbedCString_Length(path);
- int /*long*/ ptr = XPCOM.nsEmbedCString_get(path);
- buffer = new byte [length];
- XPCOM.memmove(buffer, ptr, length);
- profileRootDirectory = new String(Converter.mbcsToWcs(null, buffer)) + PROFILE_DIR;
- XPCOM.nsEmbedCString_delete(path);
- profileDir.Release();
-
- display.addListener(SWT.Dispose, new Listener() {
- public void handleEvent(Event event) {
- int /*long*/[] result = new int /*long*/[1];
- int rc = XPCOM.NS_GetServiceManager(result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_NOINTERFACE);
-
- nsIServiceManager serviceManager = new nsIServiceManager(result[0]);
- result[0] = 0;
- byte[] buffer = Converter.wcsToMbcs(null, XPCOM.NS_OBSERVER_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID(buffer, nsIObserverService.NS_IOBSERVERSERVICE_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_NOINTERFACE);
- serviceManager.Release();
-
- nsIObserverService observerService = new nsIObserverService(result[0]);
- result[0] = 0;
- buffer = Converter.wcsToMbcs(null, PROFILE_BEFORE_CHANGE, true);
- int length = SHUTDOWN_PERSIST.length();
- char[] chars = new char [length + 1];
- SHUTDOWN_PERSIST.getChars(0, length, chars, 0);
- rc = observerService.NotifyObservers(0, buffer, chars);
- if (rc != XPCOM.NS_OK) error(rc);
- observerService.Release();
- }
- });
-
- /*
- * As a result of using a common profile the user cannot change their locale
- * and charset. The fix for this is to set mozilla's locale and charset
- * preference values according to the user's current locale and charset.
- */
- aContractID = Converter.wcsToMbcs(null, XPCOM.NS_PREFSERVICE_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID(aContractID, nsIPrefService.NS_IPREFSERVICE_IID, result);
- serviceManager.Release();
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- nsIPrefService prefService = new nsIPrefService(result[0]);
- result[0] = 0;
- buffer = new byte[1];
- rc = prefService.GetBranch(buffer, result); /* empty buffer denotes root preference level */
- prefService.Release();
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- nsIPrefBranch prefBranch = new nsIPrefBranch(result[0]);
- result[0] = 0;
-
- /* get Mozilla's current locale preference value */
- String prefLocales = null;
- nsIPrefLocalizedString localizedString = null;
- buffer = Converter.wcsToMbcs(null, PREFERENCE_LANGUAGES, true);
- rc = prefBranch.GetComplexValue(buffer, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, result);
- /*
- * Feature of Debian. For some reason attempting to query for the current locale
- * preference fails on Debian. The workaround for this is to assume a value of
- * "en-us,en" since this is typically the default value when mozilla is used without
- * a profile.
- */
- if (rc != XPCOM.NS_OK) {
- prefLocales = "en-us,en" + TOKENIZER_LOCALE; //$NON-NLS-1$
- } else {
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
- localizedString = new nsIPrefLocalizedString(result[0]);
- result[0] = 0;
- rc = localizedString.ToString(result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
- length = XPCOM.strlen_PRUnichar(result[0]);
- char[] dest = new char[length];
- XPCOM.memmove(dest, result[0], length * 2);
- prefLocales = new String(dest) + TOKENIZER_LOCALE;
- }
- result[0] = 0;
-
- /*
- * construct the new locale preference value by prepending the
- * user's current locale and language to the original value
- */
- Locale locale = Locale.getDefault();
- String language = locale.getLanguage();
- String country = locale.getCountry();
- StringBuffer stringBuffer = new StringBuffer (language);
- stringBuffer.append(SEPARATOR_LOCALE);
- stringBuffer.append(country.toLowerCase());
- stringBuffer.append(TOKENIZER_LOCALE);
- stringBuffer.append(language);
- stringBuffer.append(TOKENIZER_LOCALE);
- String newLocales = stringBuffer.toString();
- StringTokenizer tokenzier = new StringTokenizer(prefLocales, TOKENIZER_LOCALE);
- while (tokenzier.hasMoreTokens()) {
- String token = (tokenzier.nextToken() + TOKENIZER_LOCALE).trim();
- /* ensure that duplicate locale values are not added */
- if (newLocales.indexOf(token) == -1) {
- stringBuffer.append(token);
- }
- }
- newLocales = stringBuffer.toString();
- if (!newLocales.equals(prefLocales)) {
- /* write the new locale value */
- newLocales = newLocales.substring(0, newLocales.length() - TOKENIZER_LOCALE.length ()); /* remove trailing tokenizer */
- length = newLocales.length();
- char[] charBuffer = new char[length + 1];
- newLocales.getChars(0, length, charBuffer, 0);
- if (localizedString == null) {
- byte[] contractID = Converter.wcsToMbcs(null, XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID, true);
- rc = componentManager.CreateInstanceByContractID(contractID, 0, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
- localizedString = new nsIPrefLocalizedString(result[0]);
- result[0] = 0;
- }
- localizedString.SetDataWithLength(length, charBuffer);
- rc = prefBranch.SetComplexValue(buffer, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, localizedString.getAddress());
- }
- if (localizedString != null) {
- localizedString.Release();
- localizedString = null;
- }
-
- /* get Mozilla's current charset preference value */
- String prefCharset = null;
- buffer = Converter.wcsToMbcs(null, PREFERENCE_CHARSET, true);
- rc = prefBranch.GetComplexValue(buffer, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, result);
- /*
- * Feature of Debian. For some reason attempting to query for the current charset
- * preference fails on Debian. The workaround for this is to assume a value of
- * "ISO-8859-1" since this is typically the default value when mozilla is used
- * without a profile.
- */
- if (rc != XPCOM.NS_OK) {
- prefCharset = "ISO-8859-1"; //$NON_NLS-1$
- } else {
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
- localizedString = new nsIPrefLocalizedString(result[0]);
- result[0] = 0;
- rc = localizedString.ToString(result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
- length = XPCOM.strlen_PRUnichar(result[0]);
- char[] dest = new char[length];
- XPCOM.memmove(dest, result[0], length * 2);
- prefCharset = new String(dest);
- }
- result[0] = 0;
-
- String newCharset = System.getProperty("file.encoding"); // $NON-NLS-1$
- if (!newCharset.equals(prefCharset)) {
- /* write the new charset value */
- length = newCharset.length();
- char[] charBuffer = new char[length + 1];
- newCharset.getChars(0, length, charBuffer, 0);
- if (localizedString == null) {
- byte[] contractID = Converter.wcsToMbcs(null, XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID, true);
- rc = componentManager.CreateInstanceByContractID(contractID, 0, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
- localizedString = new nsIPrefLocalizedString(result[0]);
- result[0] = 0;
- }
- localizedString.SetDataWithLength(length, charBuffer);
- rc = prefBranch.SetComplexValue(buffer, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, localizedString.getAddress());
- }
- if (localizedString != null) localizedString.Release();
- prefBranch.Release();
-
- PromptServiceFactory factory = new PromptServiceFactory();
- factory.AddRef();
-
- rc = componentManager.QueryInterface(nsIComponentRegistrar.NS_ICOMPONENTREGISTRAR_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- nsIComponentRegistrar componentRegistrar = new nsIComponentRegistrar(result[0]);
- result[0] = 0;
- aContractID = Converter.wcsToMbcs(null, XPCOM.NS_PROMPTSERVICE_CONTRACTID, true);
- byte[] aClassName = Converter.wcsToMbcs(null, "Prompt Service", true); //$NON-NLS-1$
- rc = componentRegistrar.RegisterFactory(XPCOM.NS_PROMPTSERVICE_CID, aClassName, aContractID, factory.getAddress());
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- factory.Release();
-
- HelperAppLauncherDialogFactory dialogFactory = new HelperAppLauncherDialogFactory();
- dialogFactory.AddRef();
- aContractID = Converter.wcsToMbcs(null, XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID, true);
- aClassName = Converter.wcsToMbcs(null, "Helper App Launcher Dialog", true); //$NON-NLS-1$
- rc = componentRegistrar.RegisterFactory(XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CID, aClassName, aContractID, dialogFactory.getAddress());
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- dialogFactory.Release();
-
- DownloadFactory downloadFactory = new DownloadFactory();
- downloadFactory.AddRef();
- aContractID = Converter.wcsToMbcs(null, XPCOM.NS_DOWNLOAD_CONTRACTID, true);
- aClassName = Converter.wcsToMbcs(null, "Download", true); //$NON-NLS-1$
- rc = componentRegistrar.RegisterFactory(XPCOM.NS_DOWNLOAD_CID, aClassName, aContractID, downloadFactory.getAddress());
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- downloadFactory.Release();
-
- DownloadFactory_1_8 downloadFactory_1_8 = new DownloadFactory_1_8();
- downloadFactory_1_8.AddRef();
- aContractID = Converter.wcsToMbcs(null, XPCOM.NS_TRANSFER_CONTRACTID, true);
- aClassName = Converter.wcsToMbcs(null, "Transfer", true); //$NON-NLS-1$
- rc = componentRegistrar.RegisterFactory(XPCOM.NS_DOWNLOAD_CID, aClassName, aContractID, downloadFactory_1_8.getAddress());
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- downloadFactory_1_8.Release();
-
- FilePickerFactory pickerFactory = new FilePickerFactory();
- pickerFactory.AddRef();
- aContractID = Converter.wcsToMbcs(null, XPCOM.NS_FILEPICKER_CONTRACTID, true);
- aClassName = Converter.wcsToMbcs(null, "FilePicker", true); //$NON-NLS-1$
- rc = componentRegistrar.RegisterFactory(XPCOM.NS_FILEPICKER_CID, aClassName, aContractID, pickerFactory.getAddress());
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- pickerFactory.Release();
-
- componentRegistrar.Release();
- componentManager.Release();
- initialized = true;
- }
-
- BrowserCount++;
- int rc = XPCOM.NS_GetComponentManager(result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- nsIComponentManager componentManager = new nsIComponentManager(result[0]);
- result[0] = 0;
- nsID NS_IWEBBROWSER_CID = new nsID("F1EAC761-87E9-11d3-AF80-00A024FFC08C"); //$NON-NLS-1$
- rc = componentManager.CreateInstance(NS_IWEBBROWSER_CID, 0, nsIWebBrowser.NS_IWEBBROWSER_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
- componentManager.Release();
-
- webBrowser = new nsIWebBrowser(result[0]);
-
- createCOMInterfaces();
- AddRef();
-
- rc = webBrowser.SetContainerWindow(webBrowserChrome.getAddress());
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
-
- rc = webBrowser.QueryInterface(nsIBaseWindow.NS_IBASEWINDOW_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_ERROR_NO_INTERFACE);
- }
-
- nsIBaseWindow baseWindow = new nsIBaseWindow(result[0]);
- result[0] = 0;
- Rectangle rect = browser.getClientArea();
- if (rect.isEmpty()) {
- rect.width = 1;
- rect.height = 1;
- }
-
- /*
- * Bug in Mozilla Linux GTK. Embedding Mozilla into a GtkFixed
- * handle causes problems with some Mozilla plug-ins. For some
- * reason, the Flash plug-in causes the child of the GtkFixed
- * handle to be resized to 1 when the Flash document is loaded.
- * That could be due to gtk_container_resize_children being called
- * by Mozilla - or one of its plug-ins - on the GtkFixed handle,
- * causing the child of the GtkFixed handle to be resized to 1.
- * The workaround is to embed Mozilla into a GtkHBox handle.
- */
- embedHandle = OS.gtk_hbox_new (false, 0);
- OS.gtk_container_add (browser.handle, embedHandle);
- OS.gtk_widget_show (embedHandle);
-
- rc = baseWindow.InitWindow(embedHandle, 0, 0, 0, rect.width, rect.height);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(XPCOM.NS_ERROR_FAILURE);
- }
- rc = baseWindow.Create();
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(XPCOM.NS_ERROR_FAILURE);
- }
- rc = baseWindow.SetVisibility(true);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(XPCOM.NS_ERROR_FAILURE);
- }
- baseWindow.Release();
-
- rc = webBrowser.AddWebBrowserListener(weakReference.getAddress(), nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
-
- rc = webBrowser.SetParentURIContentListener(uriContentListener.getAddress());
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
-
- if (eventCallback == null) {
- eventCallback = new Callback(Mozilla.class, "eventProc", 3);
- eventProc = eventCallback.getAddress();
- if (eventProc == 0) {
- browser.dispose();
- error(SWT.ERROR_NO_MORE_CALLBACKS);
- }
- }
-
- rc = XPCOM.NS_GetServiceManager(result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- nsIServiceManager serviceManager = new nsIServiceManager(result[0]);
- result[0] = 0;
- byte[] buffer = Converter.wcsToMbcs(null, XPCOM.NS_DIRECTORYSERVICE_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID(buffer, nsIDirectoryService.NS_IDIRECTORYSERVICE_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
-
- nsIDirectoryService directoryService = new nsIDirectoryService(result[0]);
- result[0] = 0;
- rc = directoryService.RegisterProvider(directoryServiceProviderListener.getAddress());
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- directoryService.Release();
-
- buffer = Converter.wcsToMbcs(null, XPCOM.NS_OBSERVER_CONTRACTID, true);
- rc = serviceManager.GetServiceByContractID(buffer, nsIObserverService.NS_IOBSERVERSERVICE_IID, result);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- if (result[0] == 0) {
- browser.dispose();
- error(XPCOM.NS_NOINTERFACE);
- }
- serviceManager.Release();
-
- nsIObserverService observerService = new nsIObserverService(result[0]);
- result[0] = 0;
- buffer = Converter.wcsToMbcs(null, PROFILE_DO_CHANGE, true);
- int length = STARTUP.length();
- char[] chars = new char [length + 1];
- STARTUP.getChars(0, length, chars, 0);
- rc = observerService.NotifyObservers(0, buffer, chars);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- buffer = Converter.wcsToMbcs(null, PROFILE_AFTER_CHANGE, true);
- rc = observerService.NotifyObservers(0, buffer, chars);
- if (rc != XPCOM.NS_OK) {
- browser.dispose();
- error(rc);
- }
- observerService.Release();
-
- /*
- * Feature in Mozilla. GtkEvents such as key down, key pressed may be consumed
- * by Mozilla and never be received by the parent embedder. The workaround
- * is to find the top Mozilla gtk widget that receives all the Mozilla GtkEvents,
- * i.e. the first child of the parent embedder. Then hook event callbacks and
- * forward the event to the parent embedder before Mozilla received and consumed
- * them.
- */
- int /*long*/ list = OS.gtk_container_get_children(embedHandle);
- if (list != 0) {
- mozillaHandle = OS.g_list_data(list);
- OS.g_list_free(list);
-
- if (mozillaHandle != 0) {
- browser.getDisplay().setData(ADD_WIDGET_KEY, new Object[] {new LONG(mozillaHandle), browser});
-
- /* Note. Callback to get events before Mozilla receives and consumes them. */
- OS.g_signal_connect (mozillaHandle, OS.event, eventProc, 0);
-
- /*
- * Note. Callback to get the events not consumed by Mozilla - and to block
- * them so that they don't get propagated to the parent handle twice.
- * This hook is set after Mozilla and is therefore called after Mozilla's
- * handler because GTK dispatches events in their order of registration.
- */
- OS.g_signal_connect (mozillaHandle, OS.key_press_event, eventProc, STOP_PROPOGATE);
- OS.g_signal_connect (mozillaHandle, OS.key_release_event, eventProc, STOP_PROPOGATE);
- }
- }
-
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Dispose: {
- /* make this handler run after other dispose listeners */
- if (ignoreDispose) {
- ignoreDispose = false;
- break;
- }
- ignoreDispose = true;
- browser.notifyListeners (event.type, event);
- event.type = SWT.NONE;
- onDispose(event.display);
- break;
- }
- case SWT.Resize: onResize(); break;
- case SWT.FocusIn: Activate(); break;
- case SWT.Deactivate: {
- Display display = event.display;
- if (Mozilla.this.browser == display.getFocusControl()) Deactivate();
- break;
- }
- case SWT.Show: {
- /*
- * Feature on GTK Mozilla. Mozilla does not show up when
- * its container (a GTK fixed handle) is made visible
- * after having been hidden. The workaround is to reset
- * its size after the container has been made visible.
- */
- Display display = event.display;
- display.asyncExec(new Runnable() {
- public void run() {
- if (Mozilla.this.browser.isDisposed()) return;
- onResize();
- }
- });
- break;
- }
- }
- }
- };
- int[] folderEvents = new int[]{
- SWT.Dispose,
- SWT.Resize,
- SWT.FocusIn,
- SWT.Deactivate,
- SWT.Show,
- SWT.KeyDown // needed to make browser traversable
- };
- for (int i = 0; i < folderEvents.length; i++) {
- browser.addListener(folderEvents[i], listener);
- }
-}
-
-static int /*long*/ eventProc (int /*long*/ handle, int /*long*/ gdkEvent, int /*long*/ pointer) {
- Widget widget = Display.getCurrent().findWidget(handle);
- if (widget != null && widget instanceof Browser) {
- return ((Mozilla)((Browser)widget).webBrowser).gtk_event(handle, gdkEvent, pointer);
- }
- return 0;
-}
-
-int /*long*/ gtk_event (int /*long*/ handle, int /*long*/ gdkEvent, int /*long*/ pointer) {
- /*
- * Stop the propagation of events that are not consumed by Mozilla, before
- * they reach the parent embedder. These event have already been received.
- */
- if (pointer == STOP_PROPOGATE) return 1;
-
- GdkEvent event = new GdkEvent ();
- OS.memmove (event, gdkEvent, GdkEvent.sizeof);
- switch (event.type) {
- case OS.GDK_KEY_PRESS:
- case OS.GDK_KEY_RELEASE:
- case OS.GDK_BUTTON_PRESS:
- case OS.GDK_BUTTON_RELEASE: {
- /*
- * Forward the event to the parent embedder before Mozilla receives it,
- * as Mozilla may or may not consume it.
- */
- OS.gtk_widget_event (browser.handle, gdkEvent);
- break;
- }
- }
- return 0;
-}
-
-public boolean back() {
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]);
- rc = webNavigation.GoBack();
- webNavigation.Release();
-
- return rc == XPCOM.NS_OK;
-}
-
-void createCOMInterfaces() {
- // Create each of the interfaces that this object implements
- supports = new XPCOMObject(new int[]{2, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- };
-
- weakReference = new XPCOMObject(new int[]{2, 0, 0, 2}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return QueryReferent(args[0], args[1]);}
- };
-
- webProgressListener = new XPCOMObject(new int[]{2, 0, 0, 4, 6, 3, 4, 3}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return OnStateChange(args[0], args[1], args[2],args[3]);}
- public int /*long*/ method4(int /*long*/[] args) {return OnProgressChange(args[0], args[1], args[2],args[3],args[4],args[5]);}
- public int /*long*/ method5(int /*long*/[] args) {return OnLocationChange(args[0], args[1], args[2]);}
- public int /*long*/ method6(int /*long*/[] args) {return OnStatusChange(args[0], args[1], args[2],args[3]);}
- public int /*long*/ method7(int /*long*/[] args) {return OnSecurityChange(args[0], args[1], args[2]);}
- };
-
- webBrowserChrome = new XPCOMObject(new int[]{2, 0, 0, 2, 1, 1, 1, 1, 0, 2, 0, 1, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return SetStatus(args[0], args[1]);}
- public int /*long*/ method4(int /*long*/[] args) {return GetWebBrowser(args[0]);}
- public int /*long*/ method5(int /*long*/[] args) {return SetWebBrowser(args[0]);}
- public int /*long*/ method6(int /*long*/[] args) {return GetChromeFlags(args[0]);}
- public int /*long*/ method7(int /*long*/[] args) {return SetChromeFlags(args[0]);}
- public int /*long*/ method8(int /*long*/[] args) {return DestroyBrowserWindow();}
- public int /*long*/ method9(int /*long*/[] args) {return SizeBrowserTo(args[0], args[1]);}
- public int /*long*/ method10(int /*long*/[] args) {return ShowAsModal();}
- public int /*long*/ method11(int /*long*/[] args) {return IsWindowModal(args[0]);}
- public int /*long*/ method12(int /*long*/[] args) {return ExitModalEventLoop(args[0]);}
- };
-
- webBrowserChromeFocus = new XPCOMObject(new int[]{2, 0, 0, 0, 0}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return FocusNextElement();}
- public int /*long*/ method4(int /*long*/[] args) {return FocusPrevElement();}
- };
-
- embeddingSiteWindow = new XPCOMObject(new int[]{2, 0, 0, 5, 5, 0, 1, 1, 1, 1, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return SetDimensions(args[0], args[1], args[2], args[3], args[4]);}
- public int /*long*/ method4(int /*long*/[] args) {return GetDimensions(args[0], args[1], args[2], args[3], args[4]);}
- public int /*long*/ method5(int /*long*/[] args) {return SetFocus();}
- public int /*long*/ method6(int /*long*/[] args) {return GetVisibility(args[0]);}
- public int /*long*/ method7(int /*long*/[] args) {return SetVisibility(args[0]);}
- public int /*long*/ method8(int /*long*/[] args) {return GetTitle(args[0]);}
- public int /*long*/ method9(int /*long*/[] args) {return SetTitle(args[0]);}
- public int /*long*/ method10(int /*long*/[] args) {return GetSiteWindow(args[0]);}
- };
-
- interfaceRequestor = new XPCOMObject(new int[]{2, 0, 0, 2}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return GetInterface(args[0], args[1]);}
- };
-
- supportsWeakReference = new XPCOMObject(new int[]{2, 0, 0, 1}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return GetWeakReference(args[0]);}
- };
-
- contextMenuListener = new XPCOMObject(new int[]{2, 0, 0, 3}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return OnShowContextMenu(args[0],args[1],args[2]);}
- };
-
- uriContentListener = new XPCOMObject(new int[]{2, 0, 0, 2, 5, 3, 4, 1, 1, 1, 1}) {
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return OnStartURIOpen(args[0], args[1]);}
- public int /*long*/ method4(int /*long*/[] args) {return DoContent(args[0], args[1], args[2], args[3], args[4]);}
- public int /*long*/ method5(int /*long*/[] args) {return IsPreferred(args[0], args[1], args[2]);}
- public int /*long*/ method6(int /*long*/[] args) {return CanHandleContent(args[0], args[1], args[2], args[3]);}
- public int /*long*/ method7(int /*long*/[] args) {return GetLoadCookie(args[0]);}
- public int /*long*/ method8(int /*long*/[] args) {return SetLoadCookie(args[0]);}
- public int /*long*/ method9(int /*long*/[] args) {return GetParentContentListener(args[0]);}
- public int /*long*/ method10(int /*long*/[] args) {return SetParentContentListener(args[0]);}
- };
-
- tooltipListener = new XPCOMObject(new int[]{2, 0, 0, 3, 0}) {
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return OnShowTooltip(args[0], args[1], args[2]);}
- public int /*long*/ method4(int /*long*/[] args) {return OnHideTooltip();}
- };
-
- directoryServiceProviderListener = new XPCOMObject(new int[]{2, 0, 0, 3}){
- public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);}
- public int /*long*/ method1(int /*long*/[] args) {return AddRef();}
- public int /*long*/ method2(int /*long*/[] args) {return Release();}
- public int /*long*/ method3(int /*long*/[] args) {return GetFile(args[0], args[1], args[2]);}
- };
-}
-
-void disposeCOMInterfaces() {
- if (supports != null) {
- supports.dispose();
- supports = null;
- }
- if (weakReference != null) {
- weakReference.dispose();
- weakReference = null;
- }
- if (webProgressListener != null) {
- webProgressListener.dispose();
- webProgressListener = null;
- }
- if (webBrowserChrome != null) {
- webBrowserChrome.dispose();
- webBrowserChrome = null;
- }
- if (webBrowserChromeFocus != null) {
- webBrowserChromeFocus.dispose();
- webBrowserChromeFocus = null;
- }
- if (embeddingSiteWindow != null) {
- embeddingSiteWindow.dispose();
- embeddingSiteWindow = null;
- }
- if (interfaceRequestor != null) {
- interfaceRequestor.dispose();
- interfaceRequestor = null;
- }
- if (supportsWeakReference != null) {
- supportsWeakReference.dispose();
- supportsWeakReference = null;
- }
- if (contextMenuListener != null) {
- contextMenuListener.dispose();
- contextMenuListener = null;
- }
- if (uriContentListener != null) {
- uriContentListener.dispose();
- uriContentListener = null;
- }
- if (tooltipListener != null) {
- tooltipListener.dispose();
- tooltipListener = null;
- }
-}
-
-public boolean execute(String script) {
- String url = "javascript:" + script + ";void(0);"; //$NON-NLS-1$ //$NON-NLS-2$
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]);
- char[] arg = url.toCharArray();
- char[] c = new char[arg.length+1];
- System.arraycopy(arg,0,c,0,arg.length);
- rc = webNavigation.LoadURI(c, nsIWebNavigation.LOAD_FLAGS_NONE, 0, 0, 0);
- webNavigation.Release();
- return rc == XPCOM.NS_OK;
-}
-
-static Browser findBrowser(int /*long*/ handle) {
- /*
- * Note. On GTK, Mozilla is embedded into a GtkHBox handle
- * and not directly into the parent Composite handle.
- */
- int /*long*/ parent = OS.gtk_widget_get_parent(handle);
- Display display = Display.getCurrent();
- return (Browser)display.findWidget(parent);
-}
-
-public boolean forward() {
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]);
- rc = webNavigation.GoForward();
- webNavigation.Release();
-
- return rc == XPCOM.NS_OK;
-}
-
-public String getUrl() {
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]);
- int /*long*/[] aCurrentURI = new int /*long*/[1];
- rc = webNavigation.GetCurrentURI(aCurrentURI);
- if (rc != XPCOM.NS_OK) error(rc);
- webNavigation.Release();
-
- byte[] dest = null;
- if (aCurrentURI[0] != 0) {
- nsIURI uri = new nsIURI(aCurrentURI[0]);
- int /*long*/ aSpec = XPCOM.nsEmbedCString_new();
- rc = uri.GetSpec(aSpec);
- if (rc != XPCOM.NS_OK) error(rc);
- int length = XPCOM.nsEmbedCString_Length(aSpec);
- int /*long*/ buffer = XPCOM.nsEmbedCString_get(aSpec);
- dest = new byte[length];
- XPCOM.memmove(dest, buffer, length);
- XPCOM.nsEmbedCString_delete(aSpec);
- uri.Release();
- }
- if (dest == null) return ""; //$NON-NLS-1$
- /*
- * If the URI indicates that the current page is being rendered from
- * memory (ie.- via setText()) then answer about:blank as the URL
- * to be consistent with win32.
- */
- String location = new String (dest);
- if (location.equals (URI_FROMMEMORY)) location = ABOUT_BLANK;
- return location;
-}
-
-public boolean isBackEnabled() {
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]);
- boolean[] aCanGoBack = new boolean[1];
- rc = webNavigation.GetCanGoBack(aCanGoBack);
- webNavigation.Release();
-
- return aCanGoBack[0];
-}
-
-public boolean isForwardEnabled() {
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]);
- boolean[] aCanGoForward = new boolean[1];
- rc = webNavigation.GetCanGoForward(aCanGoForward);
- webNavigation.Release();
-
- return aCanGoForward[0];
-}
-
-static String error(int code) {
- throw new SWTError("XPCOM error " + code); //$NON-NLS-1$
-}
-
-void onDispose(Display display) {
- display.setData(ADD_WIDGET_KEY, new Object[] {new LONG(mozillaHandle), null});
-
- int rc = webBrowser.RemoveWebBrowserListener(weakReference.getAddress(), nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID);
- if (rc != XPCOM.NS_OK) error(rc);
-
- rc = webBrowser.SetParentURIContentListener(0);
- if (rc != XPCOM.NS_OK) error(rc);
-
- int /*long*/[] result = new int /*long*/[1];
- rc = webBrowser.QueryInterface(nsIBaseWindow.NS_IBASEWINDOW_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIBaseWindow baseWindow = new nsIBaseWindow(result[0]);
- rc = baseWindow.Destroy();
- if (rc != XPCOM.NS_OK) error(rc);
- baseWindow.Release();
-
- Release();
- webBrowser.Release();
-
- if (tip != null && !tip.isDisposed()) tip.dispose();
- tip = null;
-
- BrowserCount--;
-}
-
-void Activate() {
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIWebBrowserFocus.NS_IWEBBROWSERFOCUS_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebBrowserFocus webBrowserFocus = new nsIWebBrowserFocus(result[0]);
- rc = webBrowserFocus.Activate();
- if (rc != XPCOM.NS_OK) error(rc);
- webBrowserFocus.Release();
-}
-
-void Deactivate() {
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIWebBrowserFocus.NS_IWEBBROWSERFOCUS_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebBrowserFocus webBrowserFocus = new nsIWebBrowserFocus(result[0]);
- rc = webBrowserFocus.Deactivate();
- if (rc != XPCOM.NS_OK) error(rc);
- webBrowserFocus.Release();
-}
-
-void onResize() {
- Rectangle rect = browser.getClientArea();
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIBaseWindow.NS_IBASEWINDOW_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- OS.gtk_widget_set_size_request(embedHandle, rect.width, rect.height);
- nsIBaseWindow baseWindow = new nsIBaseWindow(result[0]);
- rc = baseWindow.SetPositionAndSize(rect.x, rect.y, rect.width, rect.height, true);
- if (rc != XPCOM.NS_OK) error(rc);
- baseWindow.Release();
-}
-
-public void refresh() {
- int /*long*/[] result = new int /*long*/[1];
- int rc = webBrowser.QueryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID, result);
- if (rc != XPCOM.NS_OK) error(rc);
- if (result[0] == 0) error(XPCOM.NS_ERROR_NO_INTERFACE);
-
- nsIWebNavigation webNavigation = new nsIWebNavigation(result[0]);
- rc = webNavigation.Reload(nsIWebNavigation.LOAD_FLAGS_NONE);
- webNavigation.Release();
- if (rc == XPCOM.NS_OK) return;
- /*
- * Feature in Mozilla. Reload returns an error code NS_ERROR_INVALID_POINTER
- * when it is called immediately after a request to load a new document using
- * LoadURI. The workaround is to ignore this error code.
- *
- * Feature in Mozilla. Attempting to reload a file that no longer exists
- * returns an error code of NS_ERROR_FILE_NOT_FOUND. This is equivalent to
- * attempting to load a non-existent local url, which is not a Browser error,
- * so this error code should be ignored.
- */
- if (rc != XPCOM.NS_ERROR_INVALID_POINTER && rc != XPCOM.NS_ERROR_FILE_NOT_FOUND) error(rc);
-}
-
-public boolean setText(String html) {
- /*
- * Feature in Mozilla. The focus memory of Mozilla must be
- * properly managed through the nsIWebBrowserFocus interface.
- * In particular, nsIWebBrowserFocus.deactivate must be called
- * when the focus moves from the browser (or one of its children
- * managed by Mozilla to another widget. We currently do not
- * get notified when a widget takes focus away from the Browser.
- * As a result, deactivate is not properly called. This causes
- * Mozilla to retake focus the next time a document is loaded.
- * This breaks the case where the HTML loaded in the Browser
- * varies while the user enters characters in a text widget. The text
- * widget loses focus every time new content is loaded.
- * The current workaround is to call deactivate everytime if
- * the browser currently does not have focus. A better workaround
- * would be to have a way to call deactivate when the Browser
- * or one of its children loses focus.
- */
- if (browser != browser.getDisplay().getFocusControl()) Deactivate();
-
- /*
- * Convert the String containing HTML to an array of
- * bytes with UTF-8 data.
- */
- byte[] data = null;
- try {
- data = html.getBytes("UTF-8"); //$NON-NLS-1$
- } catch (UnsupportedEncodingExceptio