Mercurial > projects > dwt-mac
changeset 125:5583f8eeee6c
Synced mozilla with dwt-linux
line wrap: on
line diff
--- a/dwt/browser/AppFileLocProvider.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/AppFileLocProvider.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,5 +1,5 @@ -/******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. +/******************************************************************************* + * 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 @@ -7,139 +7,103 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Port to the D programming language: + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.AppFileLocProvider; -import dwt.dwthelper.utils; +import tango.sys.Environment; +import tango.text.Util; -import java.util.Vector; +import dwt.dwthelper.utils; +import dwt.browser.Mozilla; +import dwt.browser.SimpleEnumerator; -import dwt.internal.C; import dwt.internal.Compatibility; -import dwt.internal.mozilla.XPCOM; -import dwt.internal.mozilla.XPCOMObject; + +import XPCOM = dwt.internal.mozilla.XPCOM; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsISimpleEnumerator; import dwt.internal.mozilla.nsEmbedString; import dwt.internal.mozilla.nsID; -import dwt.internal.mozilla.nsIDirectoryServiceProvider; -import dwt.internal.mozilla.nsIDirectoryServiceProvider2; +import dwt.internal.mozilla.nsIDirectoryService; import dwt.internal.mozilla.nsIFile; import dwt.internal.mozilla.nsILocalFile; import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsStringAPI; -class AppFileLocProvider { - XPCOMObject supports; - XPCOMObject directoryServiceProvider; - XPCOMObject directoryServiceProvider2; +class AppFileLocProvider : nsIDirectoryServiceProvider2 { int refCount = 0; String mozillaPath, profilePath; String[] pluginDirs; bool isXULRunner; - static final String SEPARATOR_OS = System.getProperty ("file.separator"); //$NON-NLS-1$ + static String SEPARATOR_OS; static final String CHROME_DIR = "chrome"; //$NON-NLS-1$ static final String COMPONENTS_DIR = "components"; //$NON-NLS-1$ static final String HISTORY_FILE = "history.dat"; //$NON-NLS-1$ static final String LOCALSTORE_FILE = "localstore.rdf"; //$NON-NLS-1$ static final String MIMETYPES_FILE = "mimeTypes.rdf"; //$NON-NLS-1$ static final String PLUGINS_DIR = "plugins"; //$NON-NLS-1$ - static final String USER_PLUGINS_DIR = ".mozilla" + SEPARATOR_OS + "plugins"; //$NON-NLS-1$ //$NON-NLS-2$ + static String USER_PLUGINS_DIR; static final String PREFERENCES_FILE = "prefs.js"; //$NON-NLS-1$ - -this (String path) { - mozillaPath = path + SEPARATOR_OS; - createCOMInterfaces (); + +static this () { + SEPARATOR_OS = System.getProperty ("file.separator"); + USER_PLUGINS_DIR = ".mozilla" ~ SEPARATOR_OS ~ "plugins"; } -int AddRef () { +this (String path) { + mozillaPath = path ~ SEPARATOR_OS; +} + +extern(System) +nsrefcnt 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 ();} - }; - - directoryServiceProvider = 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]);} - }; - - directoryServiceProvider2 = new XPCOMObject (new int[] {2, 0, 0, 3, 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 getFile (args[0], args[1], args[2]);} - public int /*long*/ method4 (int /*long*/[] args) {return getFiles (args[0], args[1]);} - }; -} +extern(System) +nsresult QueryInterface (nsID* riid, void** ppvObject) { + if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; -void disposeCOMInterfaces () { - if (supports !is null) { - supports.dispose (); - supports = null; - } - if (directoryServiceProvider !is null) { - directoryServiceProvider.dispose (); - directoryServiceProvider = null; - } - if (directoryServiceProvider2 !is null) { - directoryServiceProvider2.dispose (); - directoryServiceProvider2 = null; - } -} - -int /*long*/ getAddress () { - return directoryServiceProvider.getAddress (); -} - -int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) { - if (riid is 0 || ppvObject is 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); + if (*riid == nsISupports.IID) { + *ppvObject = cast(void*)cast(nsISupports)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIDirectoryServiceProvider.NS_IDIRECTORYSERVICEPROVIDER_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {directoryServiceProvider.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIDirectoryServiceProvider.IID) { + *ppvObject = cast(void*)cast(nsIDirectoryServiceProvider)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIDirectoryServiceProvider2.NS_IDIRECTORYSERVICEPROVIDER2_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {directoryServiceProvider2.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIDirectoryServiceProvider2.IID) { + *ppvObject = cast(void*)cast(nsIDirectoryServiceProvider2)this; AddRef (); return XPCOM.NS_OK; } - XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); + *ppvObject = null; return XPCOM.NS_ERROR_NO_INTERFACE; } -int Release () { +extern(System) +nsrefcnt Release () { refCount--; - if (refCount is 0) disposeCOMInterfaces (); + if (refCount is 0) return 0; return refCount; } void setProfilePath (String path) { profilePath = path; if (!Compatibility.fileExists (path, "")) { //$NON-NLS-1$ - int /*long*/[] result = new int /*long*/[1]; - nsEmbedString pathString = new nsEmbedString (path); - int rc = XPCOM.NS_NewLocalFile (pathString.getAddress (), 1, result); + nsILocalFile file; + scope auto nsEmbedString pathString = new nsEmbedString (toString16(path)); + int rc = XPCOM.NS_NewLocalFile (cast(nsAString*)pathString, 1, &file); if (rc !is XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] is 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); - pathString.dispose (); + if (file is null) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); - nsILocalFile file = new nsILocalFile (result [0]); rc = file.Create (nsILocalFile.DIRECTORY_TYPE, 0700); if (rc !is XPCOM.NS_OK) Mozilla.error (rc); file.Release (); @@ -147,44 +111,21 @@ } /* nsIDirectoryServiceProvider2 */ - -int getFiles (int /*long*/ prop, 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)); +extern(System) +nsresult GetFiles (char* prop, nsISimpleEnumerator* _retval) { + String propertyName = fromStringz(prop); String[] propertyValues = null; - if (propertyName.equals (XPCOM.NS_APP_PLUGINS_DIR_LIST)) { + if (propertyName == XPCOM.NS_APP_PLUGINS_DIR_LIST) { if (pluginDirs is null) { int index = 0; /* set the first value(s) to the MOZ_PLUGIN_PATH environment variable value if it's defined */ - int /*long*/ ptr = C.getenv (MozillaDelegate.wcsToMbcs (null, XPCOM.MOZILLA_PLUGIN_PATH, true)); - if (ptr !is 0) { - int length = C.strlen (ptr); - byte[] buffer = new byte[length]; - C.memmove (buffer, ptr, length); - String value = new String (MozillaDelegate.mbcsToWcs (null, buffer)); - if (value.length () > 0) { - String separator = System.getProperty ("path.separator"); // $NON-NLS-1$ - Vector segments = new Vector (); - int start, end = -1; - do { - start = end + 1; - end = value.indexOf (separator, start); - String segment; - if (end is -1) { - segment = value.substring (start); - } else { - segment = value.substring (start, end); - } - if (segment.length () > 0) segments.addElement (segment); - } while (end !is -1); - int segmentsSize = segments.size (); - pluginDirs = new String [segmentsSize + 2]; - for (index = 0; index < segmentsSize; index++) { - pluginDirs[index] = cast(String)segments.elementAt (index); - } + String value = Environment.get (XPCOM.MOZILLA_PLUGIN_PATH); + if (value !is null) { + if (value.length > 0) { + String separator = System.getProperty ("file.separator"); // $NON-NLS-1$ + foreach (segment; delimiters(value, separator)) + pluginDirs ~= segment; } } if (pluginDirs is null) { @@ -192,51 +133,46 @@ } /* set the next value to the GRE path + "plugins" */ - pluginDirs[index++] = mozillaPath + PLUGINS_DIR; + pluginDirs ~= mozillaPath ~ PLUGINS_DIR; /* set the next value to the home directory + "/.mozilla/plugins" */ - pluginDirs[index++] = System.getProperty("user.home") + SEPARATOR_OS + USER_PLUGINS_DIR; + pluginDirs ~= System.getProperty("user.home") ~ SEPARATOR_OS ~ USER_PLUGINS_DIR; } propertyValues = pluginDirs; } - XPCOM.memmove(_retval, new int /*long*/[] {0}, C.PTR_SIZEOF); + *_retval = null; + //XPCOM.memmove(_retval, new int /*long*/[] {0}, C.PTR_SIZEOF); if (propertyValues !is null) { - int /*long*/[] result = new int /*long*/[1]; + nsILocalFile localFile; + nsIFile file; nsISupports[] files = new nsISupports [propertyValues.length]; int index = 0; for (int i = 0; i < propertyValues.length; i++) { - nsEmbedString pathString = new nsEmbedString (propertyValues[i]); - int rc = XPCOM.NS_NewLocalFile (pathString.getAddress (), 1, result); + scope auto pathString = new nsEmbedString (toString16(propertyValues[i])); + int rc = XPCOM.NS_NewLocalFile (cast(nsAString*)pathString, 1, &localFile); if (rc !is XPCOM.NS_ERROR_FILE_UNRECOGNIZED_PATH) { /* value appears to be a valid pathname */ if (rc !is XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] is 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); + if (localFile is null) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); - nsILocalFile localFile = new nsILocalFile (result[0]); - result[0] = 0; - rc = localFile.QueryInterface (nsIFile.NS_IFILE_IID, result); + rc = localFile.QueryInterface (&nsIFile.IID, cast(void**)&file); if (rc !is XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] is 0) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE); + if (file is null) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE); localFile.Release (); - nsIFile file = new nsIFile (result[0]); - files[index++] = file; + files[index++] = cast(nsISupports)file; } - pathString.dispose (); - result[0] = 0; } if (index < propertyValues.length) { /* there were some invalid values so remove the trailing empty array slots */ - nsISupports[] temp = new nsISupports [index]; - System.arraycopy (files, 0, temp, 0, index); - files = temp; + files = files[0..index]; } - SimpleEnumerator enumerator = new SimpleEnumerator (files); + auto enumerator = new SimpleEnumerator (files); enumerator.AddRef (); - XPCOM.memmove (_retval, new int /*long*/[] {enumerator.getAddress ()}, C.PTR_SIZEOF); + *_retval = cast(nsISimpleEnumerator)enumerator; return XPCOM.NS_OK; } @@ -244,47 +180,44 @@ } /* nsIDirectoryServiceProvider implementation */ - -int 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)); +extern(System) +nsresult GetFile(char* prop, PRBool* persistent, nsIFile* _retval) { + String propertyName = tango.stdc.stringz.fromStringz( prop ); String propertyValue = null; - if (propertyName.equals (XPCOM.NS_APP_HISTORY_50_FILE)) { - propertyValue = profilePath + HISTORY_FILE; - } else if (propertyName.equals (XPCOM.NS_APP_USER_MIMETYPES_50_FILE)) { - propertyValue = profilePath + MIMETYPES_FILE; - } else if (propertyName.equals (XPCOM.NS_APP_PREFS_50_FILE)) { - propertyValue = profilePath + PREFERENCES_FILE; - } else if (propertyName.equals (XPCOM.NS_APP_PREFS_50_DIR)) { + if (propertyName == (XPCOM.NS_APP_HISTORY_50_FILE)) { + propertyValue = profilePath ~ HISTORY_FILE; + } else if (propertyName == (XPCOM.NS_APP_USER_MIMETYPES_50_FILE)) { + propertyValue = profilePath ~ MIMETYPES_FILE; + } else if (propertyName == (XPCOM.NS_APP_PREFS_50_FILE)) { + propertyValue = profilePath ~ PREFERENCES_FILE; + } else if (propertyName == (XPCOM.NS_APP_PREFS_50_DIR)) { propertyValue = profilePath; - } else if (propertyName.equals (XPCOM.NS_APP_USER_CHROME_DIR)) { - propertyValue = profilePath + CHROME_DIR; - } else if (propertyName.equals (XPCOM.NS_APP_USER_PROFILE_50_DIR)) { + } else if (propertyName == (XPCOM.NS_APP_USER_CHROME_DIR)) { + propertyValue = profilePath ~ CHROME_DIR; + } else if (propertyName == (XPCOM.NS_APP_USER_PROFILE_50_DIR)) { propertyValue = profilePath; - } else if (propertyName.equals (XPCOM.NS_APP_LOCALSTORE_50_FILE)) { - propertyValue = profilePath + LOCALSTORE_FILE; - } else if (propertyName.equals (XPCOM.NS_APP_CACHE_PARENT_DIR)) { + } else if (propertyName == (XPCOM.NS_APP_LOCALSTORE_50_FILE)) { + propertyValue = profilePath ~ LOCALSTORE_FILE; + } else if (propertyName == (XPCOM.NS_APP_CACHE_PARENT_DIR)) { propertyValue = profilePath; - } else if (propertyName.equals (XPCOM.NS_OS_HOME_DIR)) { + } else if (propertyName == (XPCOM.NS_OS_HOME_DIR)) { propertyValue = System.getProperty("user.home"); //$NON-NLS-1$ - } else if (propertyName.equals (XPCOM.NS_OS_TEMP_DIR)) { + } else if (propertyName == (XPCOM.NS_OS_TEMP_DIR)) { propertyValue = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$ - } else if (propertyName.equals (XPCOM.NS_GRE_DIR)) { + } else if (propertyName == (XPCOM.NS_GRE_DIR)) { propertyValue = mozillaPath; - } else if (propertyName.equals (XPCOM.NS_GRE_COMPONENT_DIR)) { - propertyValue = mozillaPath + COMPONENTS_DIR; - } else if (propertyName.equals (XPCOM.NS_XPCOM_INIT_CURRENT_PROCESS_DIR)) { + } else if (propertyName == (XPCOM.NS_GRE_COMPONENT_DIR)) { + propertyValue = mozillaPath ~ COMPONENTS_DIR; + } else if (propertyName == (XPCOM.NS_XPCOM_INIT_CURRENT_PROCESS_DIR)) { propertyValue = mozillaPath; - } else if (propertyName.equals (XPCOM.NS_OS_CURRENT_PROCESS_DIR)) { + } else if (propertyName == (XPCOM.NS_OS_CURRENT_PROCESS_DIR)) { propertyValue = mozillaPath; - } else if (propertyName.equals (XPCOM.NS_XPCOM_COMPONENT_DIR)) { - propertyValue = mozillaPath + COMPONENTS_DIR; - } else if (propertyName.equals (XPCOM.NS_XPCOM_CURRENT_PROCESS_DIR)) { + } else if (propertyName == (XPCOM.NS_XPCOM_COMPONENT_DIR)) { + propertyValue = mozillaPath ~ COMPONENTS_DIR; + } else if (propertyName == (XPCOM.NS_XPCOM_CURRENT_PROCESS_DIR)) { propertyValue = mozillaPath; - } else if (propertyName.equals (XPCOM.NS_APP_PREF_DEFAULTS_50_DIR)) { + } else if (propertyName == (XPCOM.NS_APP_PREF_DEFAULTS_50_DIR)) { /* * Answering a value for this property causes problems in Mozilla versions * < 1.7. Unfortunately this property is queried early enough in the @@ -298,23 +231,21 @@ if (isXULRunner) propertyValue = profilePath; } - XPCOM.memmove (persistent, new int[] {1}, 4); /* PRBool */ - XPCOM.memmove (_retval, new int /*long*/[] {0}, C.PTR_SIZEOF); - if (propertyValue !is null && propertyValue.length () > 0) { - int /*long*/[] result = new int /*long*/[1]; - nsEmbedString pathString = new nsEmbedString (propertyValue); - int rc = XPCOM.NS_NewLocalFile (pathString.getAddress (), 1, result); + *persistent = true; /* PRBool */ + *_retval = null; + if (propertyValue !is null && propertyValue.length > 0) { + nsILocalFile localFile; + scope auto pathString = new nsEmbedString (propertyValue.toString16()); + int rc = XPCOM.NS_NewLocalFile (cast(nsAString*)pathString, 1, &localFile); if (rc !is XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] is 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); - pathString.dispose (); + if (localFile is null) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); - nsILocalFile localFile = new nsILocalFile (result [0]); - result[0] = 0; - rc = localFile.QueryInterface (nsIFile.NS_IFILE_IID, result); + nsIFile file; + rc = localFile.QueryInterface (&nsIFile.IID, cast(void**)&file); if (rc !is XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] is 0) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE); + if (file is null) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE); - XPCOM.memmove (_retval, new int /*long*/[] {result[0]}, C.PTR_SIZEOF); + *_retval = file; localFile.Release (); return XPCOM.NS_OK; }
--- a/dwt/browser/Browser.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/Browser.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,5 +1,5 @@ -/******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. +/******************************************************************************* + * 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 @@ -7,13 +7,15 @@ * * Contributors: * IBM Corporation - initial API and implementation - * * Port to the D programming language: - * Jacob Carlborg <doob@me.com> + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.Browser; +import dwt.dwthelper.utils; + import tango.core.Thread; +import tango.io.Stdout; import dwt.DWT; import dwt.DWTError; @@ -22,17 +24,15 @@ import dwt.widgets.Display; import dwt.widgets.Widget; -import dwt.browser.LocationListener; +import dwt.browser.Mozilla; import dwt.browser.WebBrowser; import dwt.browser.CloseWindowListener; +import dwt.browser.LocationListener; import dwt.browser.OpenWindowListener; import dwt.browser.ProgressListener; import dwt.browser.StatusTextListener; import dwt.browser.TitleListener; import dwt.browser.VisibilityWindowListener; - -import dwt.dwthelper.utils; - /** * Instances of this class implement the browser user interface * metaphor. It allows the user to visualize and navigate through @@ -51,10 +51,6 @@ * IMPORTANT: This class is <em>not</em> intended to be subclassed. * </p> * - * @see <a href="http://www.eclipse.org/swt/snippets/#browser">Browser snippets</a> - * @see <a href="http://www.eclipse.org/swt/examples.php">DWT Examples: ControlExample, BrowserExample</a> - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * * @since 3.0 */ @@ -65,779 +61,721 @@ static final String PACKAGE_PREFIX = "dwt.browser."; //$NON-NLS-1$ static final String NO_INPUT_METHOD = "dwt.internal.gtk.noInputMethod"; //$NON-NLS-1$ - /** - * 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>DWT</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>DWT</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 DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li> - * </ul> - * @exception DWTError <ul> - * <li>ERROR_NO_HANDLES if a handle could not be obtained for browser creation</li> - * </ul> - * - * @see Widget#getStyle - * - * @since 3.0 - */ - public this (Composite parent, int style) { - super(checkParent(parent), checkStyle(style)); - userStyle = style; +/** + * 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>DWT</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>DWT</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 DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li> + * </ul> + * @exception DWTError <ul> + * <li>ERROR_NO_HANDLES if a handle could not be obtained for browser creation</li> + * </ul> + * + * @see Widget#getStyle + * + * @since 3.0 + */ +public this (Composite parent, int style) { + super (checkParent (parent), checkStyle (style)); + userStyle = style; - String platform = DWT.getPlatform(); - Display display = parent.getDisplay(); - if ("gtk".opEquals(platform)) - display.setData(NO_INPUT_METHOD, null); //$NON-NLS-1$ - String className = null; - if ((style & DWT.MOZILLA) !is 0) { - className = "dwt.browser.Mozilla"; //$NON-NLS-1$ - } - else { - if ("win32".opEquals(platform) || "wpf".opEquals(platform)) { //$NON-NLS-1$ $NON-NLS-2$ - className = "dwt.browser.IE"; //$NON-NLS-1$ - } - else if ("motif".opEquals(platform)) { //$NON-NLS-1$ - className = "dwt.browser.Mozilla"; //$NON-NLS-1$ - } - else if ("gtk".opEquals(platform)) { //$NON-NLS-1$ - className = "dwt.browser.Mozilla"; //$NON-NLS-1$ - } - else if ("carbon".opEquals(platform) || "cocoa".opEquals(platform)) { //$NON-NLS-1$ - className = "dwt.browser.Safari"; //$NON-NLS-1$ - } - else if ("photon".opEquals(platform)) { //$NON-NLS-1$ - className = "dwt.browser.Voyager"; //$NON-NLS-1$ - } - else { - dispose(); - DWT.error(DWT.ERROR_NO_HANDLES); + String platform = DWT.getPlatform (); + Display display = parent.getDisplay (); + if ("gtk" == platform) display.setData (NO_INPUT_METHOD, null); //$NON-NLS-1$ + /* + String className = null; + if ((style & DWT.MOZILLA) !is 0) { + className = "dwt.browser.Mozilla"; //$NON-NLS-1$ + } else { + dispose(); + DWT.error(DWT.ERROR_NO_HANDLES); + } + */ + webBrowser = new Mozilla; + if (webBrowser is null) { + dispose (); + DWT.error (DWT.ERROR_NO_HANDLES); + } + + webBrowser.setBrowser (this); + webBrowser.create (parent, style); +} + +static Composite checkParent (Composite parent) { + String platform = DWT.getPlatform (); + if (!("gtk" == platform)) return parent; //$NON-NLS-1$ + + /* + * Note. Mozilla provides all IM support needed for text input in web pages. + * If DWT creates another input method context for the widget it will cause + * indeterminate results to happen (hangs and crashes). The fix is to prevent + * DWT from creating an input method context for the Browser widget. + */ + if (parent !is null && !parent.isDisposed ()) { + Display display = parent.getDisplay (); + if (display !is null) { + if (display.getThread () is Thread.getThis ()) { + display.setData (NO_INPUT_METHOD, stringcast("true")); //$NON-NLS-1$ } } - - try { - Class clazz = Class.forName(className); - webBrowser = cast(WebBrowser) clazz.newInstance(); - } - catch (ClassNotFoundException e) { - } catch (IllegalAccessException e) { - } catch (InstantiationException e) { - } - if (webBrowser is null) { - dispose(); - DWT.error(DWT.ERROR_NO_HANDLES); - } - - webBrowser.setBrowser(this); - webBrowser.create(parent, style); } - - static Composite checkParent (Composite parent) { - String platform = DWT.getPlatform(); - if (!"gtk".opEquals(platform)) - return parent; //$NON-NLS-1$ + return parent; +} - /* - * Note. Mozilla provides all IM support needed for text input in web pages. - * If DWT creates another input method context for the widget it will cause - * indeterminate results to happen (hangs and crashes). The fix is to prevent - * DWT from creating an input method context for the Browser widget. - */ - if (parent !is null && !parent.isDisposed()) { - Display display = parent.getDisplay(); - if (display !is null) { - if (display.getThread() is Thread.currentThread()) { - display.setData(NO_INPUT_METHOD, "true"); //$NON-NLS-1$ - } - } - } - return parent; - } - - static int checkStyle (int style) { - String platform = DWT.getPlatform(); - if ((style & DWT.MOZILLA) !is 0) { - if ("carbon".opEquals(platform)) - return style | DWT.EMBEDDED; //$NON-NLS-1$ - if ("motif".opEquals(platform)) - return style | DWT.EMBEDDED; //$NON-NLS-1$ - return style; - } - - if ("win32".opEquals(platform)) { //$NON-NLS-1$ - /* - * For IE on win32 the border is supplied by the embedded browser, so remove - * the style so that the parent Composite will not draw a second border. - */ - return style & ~DWT.BORDER; - } - else if ("motif".opEquals(platform)) { //$NON-NLS-1$ - return style | DWT.EMBEDDED; - } +static int checkStyle(int style) { + String platform = DWT.getPlatform (); + if ((style & DWT.MOZILLA) !is 0) { + if ("carbon" == platform) return style | DWT.EMBEDDED; //$NON-NLS-1$ + if ("motif" == platform) return style | DWT.EMBEDDED; //$NON-NLS-1$ return style; } - /** - * Clears all session cookies from all current Browser instances. - * - * @since 3.2 - */ - public static void clearSessions () { - WebBrowser.clearSessions(); + if ("win32" == platform) { //$NON-NLS-1$ + /* + * For IE on win32 the border is supplied by the embedded browser, so remove + * the style so that the parent Composite will not draw a second border. + */ + return style & ~DWT.BORDER; + } else if ("motif" == platform) { //$NON-NLS-1$ + return style | DWT.EMBEDDED; } + return style; +} + +/** + * Clears all session cookies from all current Browser instances. + * + * @since 3.2 + */ +public static void clearSessions () { + WebBrowser.clearSessions (); +} - /** - * Adds the listener to the collection of listeners who will be - * notified when the window hosting the receiver should be closed. - * <p> - * This notification occurs when a javascript command such as - * <code>window.close</code> gets executed by a <code>Browser</code>. - * </p> - * - * @param listener the listener which should be notified - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> - * </ul> - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @since 3.0 - */ - public void addCloseWindowListener (CloseWindowListener listener) { - checkWidget(); - if (listener is null) - DWT.error(DWT.ERROR_NULL_ARGUMENT); - webBrowser.addCloseWindowListener(listener); - } +/** + * Adds the listener to the collection of listeners who will be + * notified when the window hosting the receiver should be closed. + * <p> + * This notification occurs when a javascript command such as + * <code>window.close</code> gets executed by a <code>Browser</code>. + * </p> + * + * @param listener the listener which should be notified + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> + * </ul> + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @since 3.0 + */ +public void addCloseWindowListener (CloseWindowListener listener) { + checkWidget(); + if (listener is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + webBrowser.addCloseWindowListener (listener); +} - /** - * Adds the listener to the collection of listeners who will be - * notified when the current location has changed or is about to change. - * <p> - * This notification typically occurs when the application navigates - * to a new location with {@link #setUrl(String)} or when the user - * activates a hyperlink. - * </p> - * - * @param listener the listener which should be notified - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> - * </ul> - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @since 3.0 - */ - public void addLocationListener (LocationListener listener) { - checkWidget(); - if (listener is null) - DWT.error(DWT.ERROR_NULL_ARGUMENT); - webBrowser.addLocationListener(listener); - } +/** + * Adds the listener to the collection of listeners who will be + * notified when the current location has changed or is about to change. + * <p> + * This notification typically occurs when the application navigates + * to a new location with {@link #setUrl(String)} or when the user + * activates a hyperlink. + * </p> + * + * @param listener the listener which should be notified + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> + * </ul> + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @since 3.0 + */ +public void addLocationListener (LocationListener listener) { + checkWidget(); + if (listener is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + webBrowser.addLocationListener (listener); +} - /** - * Adds the listener to the collection of listeners who will be - * notified when a new window needs to be created. - * <p> - * This notification occurs when a javascript command such as - * <code>window.open</code> gets executed by a <code>Browser</code>. - * </p> - * - * @param listener the listener which should be notified - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> - * </ul> - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @since 3.0 - */ - public void addOpenWindowListener (OpenWindowListener listener) { - checkWidget(); - if (listener is null) - DWT.error(DWT.ERROR_NULL_ARGUMENT); - webBrowser.addOpenWindowListener(listener); - } +/** + * Adds the listener to the collection of listeners who will be + * notified when a new window needs to be created. + * <p> + * This notification occurs when a javascript command such as + * <code>window.open</code> gets executed by a <code>Browser</code>. + * </p> + * + * @param listener the listener which should be notified + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> + * </ul> + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @since 3.0 + */ +public void addOpenWindowListener (OpenWindowListener listener) { + checkWidget(); + if (listener is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + webBrowser.addOpenWindowListener (listener); +} - /** - * Adds the listener to the collection of listeners who will be - * notified when a progress is made during the loading of the current - * URL or when the loading of the current URL has been completed. - * - * @param listener the listener which should be notified - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> - * </ul> - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @since 3.0 - */ - public void addProgressListener (ProgressListener listener) { - checkWidget(); - if (listener is null) - DWT.error(DWT.ERROR_NULL_ARGUMENT); - webBrowser.addProgressListener(listener); - } +/** + * Adds the listener to the collection of listeners who will be + * notified when a progress is made during the loading of the current + * URL or when the loading of the current URL has been completed. + * + * @param listener the listener which should be notified + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> + * </ul> + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @since 3.0 + */ +public void addProgressListener (ProgressListener listener) { + checkWidget(); + if (listener is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + webBrowser.addProgressListener (listener); +} - /** - * Adds the listener to the collection of listeners who will be - * notified when the status text is changed. - * <p> - * The status text is typically displayed in the status bar of - * a browser application. - * </p> - * - * @param listener the listener which should be notified - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> - * </ul> - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @since 3.0 - */ - public void addStatusTextListener (StatusTextListener listener) { - checkWidget(); - if (listener is null) - DWT.error(DWT.ERROR_NULL_ARGUMENT); - webBrowser.addStatusTextListener(listener); - } +/** + * Adds the listener to the collection of listeners who will be + * notified when the status text is changed. + * <p> + * The status text is typically displayed in the status bar of + * a browser application. + * </p> + * + * @param listener the listener which should be notified + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> + * </ul> + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @since 3.0 + */ +public void addStatusTextListener (StatusTextListener listener) { + checkWidget(); + if (listener is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + webBrowser.addStatusTextListener (listener); +} - /** - * Adds the listener to the collection of listeners who will be - * notified when the title of the current document is available - * or has changed. - * - * @param listener the listener which should be notified - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> - * </ul> - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @since 3.0 - */ - public void addTitleListener (TitleListener listener) { - checkWidget(); - if (listener is null) - DWT.error(DWT.ERROR_NULL_ARGUMENT); - webBrowser.addTitleListener(listener); - } +/** + * Adds the listener to the collection of listeners who will be + * notified when the title of the current document is available + * or has changed. + * + * @param listener the listener which should be notified + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> + * </ul> + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @since 3.0 + */ +public void addTitleListener (TitleListener listener) { + checkWidget(); + if (listener is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + webBrowser.addTitleListener (listener); +} + +/** + * Adds the listener to the collection of listeners who will be + * notified when a window hosting the receiver needs to be displayed + * or hidden. + * + * @param listener the listener which should be notified + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> + * </ul> + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @since 3.0 + */ +public void addVisibilityWindowListener (VisibilityWindowListener listener) { + checkWidget(); + if (listener is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + webBrowser.addVisibilityWindowListener (listener); +} - /** - * Adds the listener to the collection of listeners who will be - * notified when a window hosting the receiver needs to be displayed - * or hidden. - * - * @param listener the listener which should be notified - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> - * </ul> - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @since 3.0 - */ - public void addVisibilityWindowListener (VisibilityWindowListener listener) { - checkWidget(); - if (listener is null) - DWT.error(DWT.ERROR_NULL_ARGUMENT); - webBrowser.addVisibilityWindowListener(listener); +/** + * Navigate to the previous session history item. + * + * @return <code>true</code> if the operation was successful and <code>false</code> otherwise + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @see #forward + * + * @since 3.0 + */ +public bool back () { + checkWidget(); + return webBrowser.back (); +} + +protected void checkSubclass () { + String name = this.classinfo.name; + name = name.substring(0, name.lastIndexOf('.')); + int index = name.lastIndexOf('.'); + if (!name.substring (0, index + 1).equals (PACKAGE_PREFIX)) { + Stdout ("name: ")(name.substring(0, index + 1))(" == " )(PACKAGE_PREFIX).newline; + DWT.error (DWT.ERROR_INVALID_SUBCLASS); } - - /** - * Navigate to the previous session history item. - * - * @return <code>true</code> if the operation was successful and <code>false</code> otherwise - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @see #forward - * - * @since 3.0 - */ - public bool back () { - checkWidget(); - return webBrowser.back(); - } +} - protected void checkSubclass () { - String name = getClass().getName(); - int index = name.lastIndexOf('.'); - if (!name.substring(0, index + 1).opEquals(PACKAGE_PREFIX)) { - DWT.error(DWT.ERROR_INVALID_SUBCLASS); - } - } +/** + * Execute the specified script. + * + * <p> + * Execute a script containing javascript commands in the context of the current document. + * + * @param script the script with javascript commands + * + * @return <code>true</code> if the operation was successful and <code>false</code> otherwise + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the script is null</li> + * </ul> + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @since 3.1 + */ +public bool execute (String script) { + checkWidget(); + if (script is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + return webBrowser.execute (script); +} - /** - * Execute the specified script. - * - * <p> - * Execute a script containing javascript commands in the context of the current document. - * - * @param script the script with javascript commands - * - * @return <code>true</code> if the operation was successful and <code>false</code> otherwise - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the script is null</li> - * </ul> - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @since 3.1 - */ - public bool execute (String script) { - checkWidget(); - if (script is null) - DWT.error(DWT.ERROR_NULL_ARGUMENT); - return webBrowser.execute(script); - } +/** + * Navigate to the next session history item. + * + * @return <code>true</code> if the operation was successful and <code>false</code> otherwise + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @see #back + * + * @since 3.0 + */ +public bool forward () { + checkWidget(); + return webBrowser.forward (); +} - /** - * Navigate to the next session history item. - * - * @return <code>true</code> if the operation was successful and <code>false</code> otherwise - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @see #back - * - * @since 3.0 - */ - public bool forward () { - checkWidget(); - return webBrowser.forward(); +public int getStyle () { + /* + * If DWT.BORDER was specified at creation time then getStyle() should answer + * it even though it is removed for IE on win32 in checkStyle(). + */ + return super.getStyle () | (userStyle & DWT.BORDER); +} + +/** + * Returns a string with HTML that represents the content of the current page. + * + * @return HTML representing the current page or an empty <code>String</code> + * if this is empty + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @since 3.4 + */ +public String getText () { + checkWidget(); + return webBrowser.getText (); } /** - * Returns the type of native browser being used by this instance. - * Examples: "mozilla", "ie", "safari", "voyager" + * Returns the current URL. + * + * @return the current URL or an empty <code>String</code> if there is no current URL * - * @return the type of the native browser + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @see #setUrl * - * @since 3.5 + * @since 3.0 */ -public String getBrowserType () { +public String getUrl () { checkWidget(); - return webBrowser.getBrowserType (); - } + return webBrowser.getUrl (); +} - public int getStyle () { - /* - * If DWT.BORDER was specified at creation time then getStyle() should answer - * it even though it is removed for IE on win32 in checkStyle(). - */ - return super.getStyle() | (userStyle & DWT.BORDER); - } +/** + * Returns the JavaXPCOM <code>nsIWebBrowser</code> for the receiver, or <code>null</code> + * if it is not available. In order for an <code>nsIWebBrowser</code> to be returned all + * of the following must be true: <ul> + * <li>the receiver's style must be <code>DWT.MOZILLA</code></li> + * <li>the classes from JavaXPCOM >= 1.8.1.2 must be resolvable at runtime</li> + * <li>the version of the underlying XULRunner must be >= 1.8.1.2</li> + * </ul> + * + * @return the receiver's JavaXPCOM <code>nsIWebBrowser</code> or <code>null</code> + * + * @since 3.3 + */ +public Object getWebBrowser () { + checkWidget(); + return webBrowser.getWebBrowser (); +} - /** - * Returns a String with HTML that represents the content of the current page. - * - * @return HTML representing the current page or an empty <code>String</code> - * if this is empty - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @since 3.4 - */ - public String getText () { - checkWidget(); - return webBrowser.getText(); - } +/** + * Returns <code>true</code> if the receiver can navigate to the + * previous session history item, and <code>false</code> otherwise. + * + * @return the receiver's back command enabled state + * + * @exception DWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + * + * @see #back + */ +public bool isBackEnabled () { + checkWidget(); + return webBrowser.isBackEnabled (); +} - /** - * Returns the current URL. - * - * @return the current URL or an empty <code>String</code> if there is no current URL - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @see #setUrl - * - * @since 3.0 - */ - public String getUrl () { - checkWidget(); - return webBrowser.getUrl(); - } +public bool isFocusControl () { + checkWidget(); + if (webBrowser.isFocusControl ()) return true; + return super.isFocusControl (); +} - /** - * Returns the JavaXPCOM <code>nsIWebBrowser</code> for the receiver, or <code>null</code> - * if it is not available. In order for an <code>nsIWebBrowser</code> to be returned all - * of the following must be true: <ul> - * <li>the receiver's style must be <code>DWT.MOZILLA</code></li> - * <li>the classes from JavaXPCOM >= 1.8.1.2 must be resolvable at runtime</li> - * <li>the version of the underlying XULRunner must be >= 1.8.1.2</li> - * </ul> - * - * @return the receiver's JavaXPCOM <code>nsIWebBrowser</code> or <code>null</code> - * - * @since 3.3 - */ - public Object getWebBrowser () { - checkWidget(); - return webBrowser.getWebBrowser(); - } +/** + * Returns <code>true</code> if the receiver can navigate to the + * next session history item, and <code>false</code> otherwise. + * + * @return the receiver's forward command enabled state + * + * @exception DWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + * + * @see #forward + */ +public bool isForwardEnabled () { + checkWidget(); + return webBrowser.isForwardEnabled (); +} - /** - * Returns <code>true</code> if the receiver can navigate to the - * previous session history item, and <code>false</code> otherwise. - * - * @return the receiver's back command enabled state - * - * @exception DWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - * - * @see #back - */ - public bool isBackEnabled () { - checkWidget(); - return webBrowser.isBackEnabled(); - } +/** + * Refresh the current page. + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @since 3.0 + */ +public void refresh () { + checkWidget(); + webBrowser.refresh (); +} - public bool isFocusControl () { - checkWidget(); - if (webBrowser.isFocusControl()) - return true; - return super.isFocusControl(); - } - - /** - * Returns <code>true</code> if the receiver can navigate to the - * next session history item, and <code>false</code> otherwise. - * - * @return the receiver's forward command enabled state - * - * @exception DWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - * - * @see #forward - */ - public bool isForwardEnabled () { - checkWidget(); - return webBrowser.isForwardEnabled(); - } +/** + * Removes the listener from the collection of listeners who will + * be notified when the window hosting the receiver should be closed. + * + * @param listener the listener which should no longer be notified + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> + * </ul> + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @since 3.0 + */ +public void removeCloseWindowListener (CloseWindowListener listener) { + checkWidget(); + if (listener is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + webBrowser.removeCloseWindowListener (listener); +} - /** - * Refresh the current page. - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @since 3.0 - */ - public void refresh () { - checkWidget(); - webBrowser.refresh(); - } +/** + * Removes the listener from the collection of listeners who will + * be notified when the current location is changed or about to be changed. + * + * @param listener the listener which should no longer be notified + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> + * </ul> + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @since 3.0 + */ +public void removeLocationListener (LocationListener listener) { + checkWidget(); + if (listener is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + webBrowser.removeLocationListener (listener); +} - /** - * Removes the listener from the collection of listeners who will - * be notified when the window hosting the receiver should be closed. - * - * @param listener the listener which should no longer be notified - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> - * </ul> - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @since 3.0 - */ - public void removeCloseWindowListener (CloseWindowListener listener) { - checkWidget(); - if (listener is null) - DWT.error(DWT.ERROR_NULL_ARGUMENT); - webBrowser.removeCloseWindowListener(listener); - } - - /** - * Removes the listener from the collection of listeners who will - * be notified when the current location is changed or about to be changed. - * - * @param listener the listener which should no longer be notified - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> - * </ul> - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @since 3.0 - */ - public void removeLocationListener (LocationListener listener) { - checkWidget(); - if (listener is null) - DWT.error(DWT.ERROR_NULL_ARGUMENT); - webBrowser.removeLocationListener(listener); - } +/** + * Removes the listener from the collection of listeners who will + * be notified when a new window needs to be created. + * + * @param listener the listener which should no longer be notified + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> + * </ul> + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @since 3.0 + */ +public void removeOpenWindowListener (OpenWindowListener listener) { + checkWidget(); + if (listener is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + webBrowser.removeOpenWindowListener (listener); +} - /** - * Removes the listener from the collection of listeners who will - * be notified when a new window needs to be created. - * - * @param listener the listener which should no longer be notified - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> - * </ul> - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @since 3.0 - */ - public void removeOpenWindowListener (OpenWindowListener listener) { - checkWidget(); - if (listener is null) - DWT.error(DWT.ERROR_NULL_ARGUMENT); - webBrowser.removeOpenWindowListener(listener); - } - - /** - * Removes the listener from the collection of listeners who will - * be notified when a progress is made during the loading of the current - * URL or when the loading of the current URL has been completed. - * - * @param listener the listener which should no longer be notified - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> - * </ul> - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @since 3.0 - */ - public void removeProgressListener (ProgressListener listener) { - checkWidget(); - if (listener is null) - DWT.error(DWT.ERROR_NULL_ARGUMENT); - webBrowser.removeProgressListener(listener); - } +/** + * Removes the listener from the collection of listeners who will + * be notified when a progress is made during the loading of the current + * URL or when the loading of the current URL has been completed. + * + * @param listener the listener which should no longer be notified + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> + * </ul> + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @since 3.0 + */ +public void removeProgressListener (ProgressListener listener) { + checkWidget(); + if (listener is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + webBrowser.removeProgressListener (listener); +} - /** - * Removes the listener from the collection of listeners who will - * be notified when the status text is changed. - * - * @param listener the listener which should no longer be notified - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> - * </ul> - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @since 3.0 - */ - public void removeStatusTextListener (StatusTextListener listener) { - checkWidget(); - if (listener is null) - DWT.error(DWT.ERROR_NULL_ARGUMENT); - webBrowser.removeStatusTextListener(listener); - } +/** + * Removes the listener from the collection of listeners who will + * be notified when the status text is changed. + * + * @param listener the listener which should no longer be notified + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> + * </ul> + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @since 3.0 + */ +public void removeStatusTextListener (StatusTextListener listener) { + checkWidget(); + if (listener is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + webBrowser.removeStatusTextListener (listener); +} - /** - * Removes the listener from the collection of listeners who will - * be notified when the title of the current document is available - * or has changed. - * - * @param listener the listener which should no longer be notified - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> - * </ul> - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @since 3.0 - */ - public void removeTitleListener (TitleListener listener) { - checkWidget(); - if (listener is null) - DWT.error(DWT.ERROR_NULL_ARGUMENT); - webBrowser.removeTitleListener(listener); - } +/** + * Removes the listener from the collection of listeners who will + * be notified when the title of the current document is available + * or has changed. + * + * @param listener the listener which should no longer be notified + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> + * </ul> + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @since 3.0 + */ +public void removeTitleListener (TitleListener listener) { + checkWidget(); + if (listener is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + webBrowser.removeTitleListener (listener); +} - /** - * Removes the listener from the collection of listeners who will - * be notified when a window hosting the receiver needs to be displayed - * or hidden. - * - * @param listener the listener which should no longer be notified - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> - * </ul> - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @since 3.0 - */ - public void removeVisibilityWindowListener (VisibilityWindowListener listener) { - checkWidget(); - if (listener is null) - DWT.error(DWT.ERROR_NULL_ARGUMENT); - webBrowser.removeVisibilityWindowListener(listener); - } +/** + * Removes the listener from the collection of listeners who will + * be notified when a window hosting the receiver needs to be displayed + * or hidden. + * + * @param listener the listener which should no longer be notified + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> + * </ul> + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @since 3.0 + */ +public void removeVisibilityWindowListener (VisibilityWindowListener listener) { + checkWidget(); + if (listener is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + webBrowser.removeVisibilityWindowListener (listener); +} - /** - * Renders HTML. - * - * <p> - * The html parameter is Unicode encoded since it is a java <code>String</code>. - * As a result, the HTML meta tag charset should not be set. The charset is implied - * by the <code>String</code> itself. - * - * @param html the HTML content to be rendered - * - * @return true if the operation was successful and false otherwise. - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the html is null</li> - * </ul> - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @see #setUrl - * - * @since 3.0 - */ - public bool setText (String html) { - checkWidget(); - if (html is null) - DWT.error(DWT.ERROR_NULL_ARGUMENT); - return webBrowser.setText(html); - } +/** + * Renders HTML. + * + * <p> + * The html parameter is Unicode encoded since it is a java <code>String</code>. + * As a result, the HTML meta tag charset should not be set. The charset is implied + * by the <code>String</code> itself. + * + * @param html the HTML content to be rendered + * + * @return true if the operation was successful and false otherwise. + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the html is null</li> + * </ul> + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @see #setUrl + * + * @since 3.0 + */ +public bool setText (String html) { + checkWidget(); + if (html is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + return webBrowser.setText (html); +} - /** - * Loads a URL. - * - * @param url the URL to be loaded - * - * @return true if the operation was successful and false otherwise. - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the url is null</li> - * </ul> - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @see #getUrl - * - * @since 3.0 - */ - public bool setUrl (String url) { - checkWidget(); - if (url is null) - DWT.error(DWT.ERROR_NULL_ARGUMENT); - return webBrowser.setUrl(url); - } +/** + * Loads a URL. + * + * @param url the URL to be loaded + * + * @return true if the operation was successful and false otherwise. + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the url is null</li> + * </ul> + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @see #getUrl + * + * @since 3.0 + */ +public bool setUrl (String url) { + checkWidget(); + if (url is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + return webBrowser.setUrl (url); +} - /** - * Stop any loading and rendering activity. - * - * @exception DWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> - * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> - * </ul> - * - * @since 3.0 - */ - public void stop () { - checkWidget(); - webBrowser.stop(); - } +/** + * Stop any loading and rendering activity. + * + * @exception DWTException <ul> + * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> + * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> + * </ul> + * + * @since 3.0 + */ +public void stop () { + checkWidget(); + webBrowser.stop (); } +}
--- a/dwt/browser/CloseWindowListener.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/CloseWindowListener.d Fri Jan 16 12:49:08 2009 +0100 @@ -7,15 +7,13 @@ * * Contributors: * IBM Corporation - initial API and implementation - * * Port to the D programming language: - * Jacob Carlborg <doob@me.com> + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.CloseWindowListener; +import dwt.internal.DWTEventListener; import dwt.browser.WindowEvent; -import dwt.dwthelper.utils; -import dwt.internal.DWTEventListener; /** * This listener interface may be implemented in order to receive @@ -32,23 +30,23 @@ */ public interface CloseWindowListener : DWTEventListener { - /** - * This method is called when the window hosting a {@link Browser} should be closed. - * Application would typically close the {@link dwt.widgets.Shell} that - * hosts the <code>Browser</code>. The <code>Browser</code> is disposed after this - * notification. - * - * <p>The following fields in the <code>WindowEvent</code> apply: - * <ul> - * <li>(in) widget the <code>Browser</code> that is going to be disposed - * </ul></p> - * - * @param event the <code>WindowEvent</code> that specifies the <code>Browser</code> - * that is going to be disposed - * - * @see dwt.widgets.Shell#close() - * - * @since 3.0 - */ - public void close (WindowEvent event); +/** + * This method is called when the window hosting a {@link Browser} should be closed. + * Application would typically close the {@link dwt.widgets.Shell} that + * hosts the <code>Browser</code>. The <code>Browser</code> is disposed after this + * notification. + * + * <p>The following fields in the <code>WindowEvent</code> apply: + * <ul> + * <li>(in) widget the <code>Browser</code> that is going to be disposed + * </ul></p> + * + * @param event the <code>WindowEvent</code> that specifies the <code>Browser</code> + * that is going to be disposed + * + * @see dwt.widgets.Shell#close() + * + * @since 3.0 + */ +public void close(WindowEvent event); }
--- a/dwt/browser/Download.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/Download.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,5 +1,5 @@ -/******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. +/******************************************************************************* + * 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 @@ -7,16 +7,23 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Port to the D programming language: + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.Download; +import Util = tango.text.Util; +import tango.text.convert.Format; import dwt.dwthelper.utils; import dwt.DWT; -import dwt.internal.C; -import dwt.internal.Compatibility; -import dwt.internal.mozilla.XPCOM; -import dwt.internal.mozilla.XPCOMObject; + +import dwt.browser.Mozilla; + +import XPCOM = dwt.internal.mozilla.XPCOM; + +import dwt.internal.mozilla.prtime; +import dwt.internal.mozilla.Common; import dwt.internal.mozilla.nsID; import dwt.internal.mozilla.nsIDownload; import dwt.internal.mozilla.nsIHelperAppLauncher; @@ -25,6 +32,14 @@ import dwt.internal.mozilla.nsISupports; import dwt.internal.mozilla.nsIURI; import dwt.internal.mozilla.nsIWebProgressListener; +import dwt.internal.mozilla.nsIMIMEInfo; +import dwt.internal.mozilla.nsIObserver; +import dwt.internal.mozilla.nsIDOMWindow; +import dwt.internal.mozilla.nsIWebProgress; +import dwt.internal.mozilla.nsIRequest; +import dwt.internal.mozilla.nsStringAPI; +import dwt.internal.mozilla.nsEmbedString; + import dwt.layout.GridData; import dwt.layout.GridLayout; import dwt.widgets.Button; @@ -33,17 +48,7 @@ import dwt.widgets.Listener; import dwt.widgets.Shell; -/** - * This class implements the nsIDownload interface for mozilla - * versions 1.4 - 1.7.x. For mozilla version 1.8.x this interface - * is implemented by class nsIDownload_1_8. Later versions of - * mozilla do not need to call this interface. - */ -class Download { - XPCOMObject supports; - XPCOMObject download; - XPCOMObject progressDialog; - XPCOMObject webProgressListener; +class Download : nsIProgressDialog { nsIHelperAppLauncher helperAppLauncher; int refCount = 0; @@ -52,149 +57,66 @@ Button cancel; this () { - createCOMInterfaces (); } -int AddRef () { +extern(System) +nsrefcnt 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 (cast(int)/*64*/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], cast(int)/*64*/args[2], cast(int)/*64*/args[3]);} - public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], cast(int)/*64*/args[2], cast(int)/*64*/args[3], cast(int)/*64*/args[4], cast(int)/*64*/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], cast(int)/*64*/args[2], args[3]);} - public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], cast(int)/*64*/args[2]);} - }; -} - -void disposeCOMInterfaces () { - if (supports !is null) { - supports.dispose (); - supports = null; - } - if (download !is null) { - download.dispose (); - download = null; +extern(System) +nsresult QueryInterface (nsID* riid, void** ppvObject) { + if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; + + if (*riid == nsISupports.IID) { + *ppvObject = cast(void*)cast(nsISupports)this; + AddRef(); + return XPCOM.NS_OK; } - if (progressDialog !is null) { - progressDialog.dispose (); - progressDialog = null; - } - if (webProgressListener !is null) { - webProgressListener.dispose (); - webProgressListener = null; - } -} - -int /*long*/ getAddress () { - return progressDialog.getAddress (); -} - -int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) { - if (riid is 0 || ppvObject is 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); + if (*riid == nsIDownload.IID) { + *ppvObject = cast(void*)cast(nsIDownload)this; 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); + if (*riid == nsIProgressDialog.IID) { + *ppvObject = cast(void*)cast(nsIProgressDialog)this; AddRef(); return XPCOM.NS_OK; } - if (guid.Equals (nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {webProgressListener.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIWebProgressListener.IID) { + *ppvObject = cast(void*)cast(nsIWebProgressListener)this; AddRef(); return XPCOM.NS_OK; } - XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); + *ppvObject = null; return XPCOM.NS_ERROR_NO_INTERFACE; } - -int Release () { + +extern(System) +nsrefcnt Release () { refCount--; - if (refCount is 0) disposeCOMInterfaces (); + if (refCount is 0) return 0; // nonsensical condition: will fix later -JJR return refCount; } /* nsIDownload */ /* Note. The argument startTime is defined as a PRInt64. This translates into two java ints. */ -int 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); +/* EXCEPTION: not for D */ + +extern(System) +nsresult Init (nsIURI aSource, nsIURI aTarget, nsAString* aDisplayName, nsIMIMEInfo aMIMEInfo, PRTime startTime, PRBool aPersist) { + //nsIURI source = new nsIURI (aSource); + scope auto aSpec = new nsEmbedCString; + int rc = aSource.GetHost (cast(nsACString*)aSpec); if (rc !is 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); + //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 = aSpec.toString; /* * As of mozilla 1.7 the second argument of the nsIDownload interface's @@ -202,38 +124,38 @@ * 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 is XPCOM.NS_OK) { /* >= 1.7 */ - nsIURI target = new nsIURI (result[0]); - result[0] = 0; - int /*long*/ aPath = XPCOM.nsEmbedCString_new (); - rc = target.GetPath (aPath); - if (rc !is 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); + nsISupports supports = cast(nsISupports)aTarget; + nsIURI target; + rc = supports.QueryInterface (&nsIURI.IID, cast(void**)&target); + if (rc is 0) { /* >= 1.7 */ + //result[0] = 0; + //int /*long*/ aPath = XPCOM.nsEmbedCString_new (); + scope auto aPath = new nsEmbedCString; + rc = target.GetPath (cast(nsACString*)aPath); + if (rc !is XPCOM.NS_OK) Mozilla.error (rc,__FILE__,__LINE__); + //length = XPCOM.nsEmbedCString_Length (aPath); + //buffer = XPCOM.nsEmbedCString_get (aPath); + //dest = new byte[length]; + //XPCOM.memmove (dest, buffer, length); + //XPCOM.nsEmbedCString_delete (aPath); + filename = aPath.toString; 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 !is 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); + nsILocalFile target2 = cast(nsILocalFile) aTarget; + scope auto aNativeTarget = new nsEmbedCString; + rc = target2.GetNativeLeafName (cast(nsACString*)aNativeTarget); + if (rc !is XPCOM.NS_OK) Mozilla.error (rc,__FILE__,__LINE__); + //length = XPCOM.nsEmbedCString_Length (aNativeTarget); + //buffer = XPCOM.nsEmbedCString_get (aNativeTarget); + //dest = new byte[length]; + //XPCOM.memmove (dest, buffer, length); + //XPCOM.nsEmbedCString_delete (aNativeTarget); + filename = aNativeTarget.toString; } - Listener listener = new Listener () { + Listener listener = new class() Listener { public void handleEvent (Event event) { if (event.widget is cancel) { shell.close (); @@ -247,25 +169,26 @@ } }; shell = new Shell (DWT.DIALOG_TRIM); - String msg = Compatibility.getMessage ("DWT_Download_File", new Object[] {filename}); //$NON-NLS-1$ - shell.setText (msg); + //String msg = Compatibility.getMessage ("SWT_Download_File", new Object[] {filename}); //$NON-NLS-1$ + shell.setText ("Download: " ~ filename); GridLayout gridLayout = new GridLayout (); gridLayout.marginHeight = 15; gridLayout.marginWidth = 15; gridLayout.verticalSpacing = 20; shell.setLayout(gridLayout); - msg = Compatibility.getMessage ("DWT_Download_Location", new Object[] {filename, url}); //$NON-NLS-1$ - new Label (shell, DWT.SIMPLE).setText (msg); + //msg = Compatibility.getMessage ("SWT_Download_Location", new Object[] {filename, url}); //$NON-NLS-1$ + auto lbl = new Label (shell, DWT.SIMPLE); + lbl.setText ("Saving " ~ filename ~ " from " ~ url); status = new Label (shell, DWT.SIMPLE); - msg = Compatibility.getMessage ("DWT_Download_Started"); //$NON-NLS-1$ - status.setText (msg); + //msg = Compatibility.getMessage ("SWT_Download_Started"); //$NON-NLS-1$ + status.setText ("Downloading..."); GridData data = new GridData (); data.grabExcessHorizontalSpace = true; data.grabExcessVerticalSpace = true; status.setLayoutData (data); cancel = new Button (shell, DWT.PUSH); - cancel.setText (DWT.getMessage ("DWT_Cancel")); //$NON-NLS-1$ + cancel.setText ("Cancel"); //$NON-NLS-1$ data = new GridData (); data.horizontalAlignment = GridData.CENTER; cancel.setLayoutData (data); @@ -276,86 +199,105 @@ return XPCOM.NS_OK; } -int GetSource (int /*long*/ aSource) { +extern(System) +nsresult GetSource (nsIURI* aSource) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetTarget (int /*long*/ aTarget) { +extern(System) +nsresult GetTarget (nsIURI* aTarget) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetPersist (int /*long*/ aPersist) { +extern(System) +nsresult GetPersist (PRBool* aPersist) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetPercentComplete (int /*long*/ aPercentComplete) { +extern(System) +nsresult GetPercentComplete (PRInt32* aPercentComplete) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetDisplayName (int /*long*/ aDisplayName) { +extern(System) +nsresult GetDisplayName (PRUnichar** aDisplayName) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int SetDisplayName (int /*long*/ aDisplayName) { +extern(System) +nsresult SetDisplayName (PRUnichar* aDisplayName) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetStartTime (int /*long*/ aStartTime) { +extern(System) +nsresult GetStartTime (PRInt64* aStartTime) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetMIMEInfo (int /*long*/ aMIMEInfo) { +extern(System) +nsresult GetMIMEInfo (nsIMIMEInfo* aMIMEInfo) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetListener (int /*long*/ aListener) { +extern(System) +nsresult GetListener (nsIWebProgressListener* aListener) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int SetListener (int /*long*/ aListener) { +extern(System) +nsresult SetListener (nsIWebProgressListener aListener) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetObserver (int /*long*/ aObserver) { +extern(System) +nsresult GetObserver (nsIObserver* aObserver) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int SetObserver (int /*long*/ aObserver) { - if (aObserver !is 0) { - nsISupports supports = new nsISupports (aObserver); - int /*long*/[] result = new int /*long*/[1]; - int rc = supports.QueryInterface (nsIHelperAppLauncher.NS_IHELPERAPPLAUNCHER_IID, result); +extern(System) +nsresult SetObserver (nsIObserver aObserver) { + if (aObserver !is null) { + // nsISupports supports = new nsISupports (aObserver); + nsIHelperAppLauncher result; + int rc = aObserver.QueryInterface (&nsIHelperAppLauncher.IID, cast(void**)&result); if (rc !is XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] is 0) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE); - helperAppLauncher = new nsIHelperAppLauncher (result[0]); + if (result is null) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE); + helperAppLauncher = result; } return XPCOM.NS_OK; } /* nsIProgressDialog */ -int Open (int /*long*/ aParent) { + +extern(System) +nsresult Open (nsIDOMWindow aParent) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetCancelDownloadOnClose (int /*long*/ aCancelDownloadOnClose) { +extern(System) +nsresult GetCancelDownloadOnClose (PRBool* aCancelDownloadOnClose) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int SetCancelDownloadOnClose (int aCancelDownloadOnClose) { +extern(System) +nsresult SetCancelDownloadOnClose (PRBool aCancelDownloadOnClose) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetDialog (int /*long*/ aDialog) { +extern(System) +nsresult GetDialog (nsIDOMWindow* aDialog) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int SetDialog (int /*long*/ aDialog) { +extern(System) +nsresult SetDialog (nsIDOMWindow aDialog) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } /* nsIWebProgressListener */ -int OnStateChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aStateFlags, int aStatus) { +extern(System) +nsresult OnStateChange (nsIWebProgress aWebProgress, nsIRequest aRequest, PRUint32 aStateFlags, nsresult aStatus) { if ((aStateFlags & nsIWebProgressListener.STATE_STOP) !is 0) { if (helperAppLauncher !is null) helperAppLauncher.Release (); helperAppLauncher = null; @@ -365,28 +307,32 @@ return XPCOM.NS_OK; } -int OnProgressChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aCurSelfProgress, int aMaxSelfProgress, int aCurTotalProgress, int aMaxTotalProgress) { +extern(System) +nsresult OnProgressChange (nsIWebProgress aWebProgress, nsIRequest aRequest, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) { int currentKBytes = aCurTotalProgress / 1024; int totalKBytes = aMaxTotalProgress / 1024; if (shell !is null && !shell.isDisposed ()) { - Object[] arguments = {new Integer (currentKBytes), new Integer (totalKBytes)}; - String statusMsg = Compatibility.getMessage ("DWT_Download_Status", arguments); //$NON-NLS-1$ - status.setText (statusMsg); + //Object[] arguments = {new Integer (currentKBytes), new Integer (totalKBytes)}; + //String statusMsg = Compatibility.getMessage ("SWT_Download_Status", arguments); //$NON-NLS-1$ + status.setText (Format("Download: {0} KB of {1} KB", currentKBytes, totalKBytes)); shell.layout (true); shell.getDisplay ().update (); } return XPCOM.NS_OK; } -int OnLocationChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aLocation) { +extern(System) +nsresult OnLocationChange (nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation) { return XPCOM.NS_OK; } -int OnStatusChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aStatus, int /*long*/ aMessage) { +extern(System) +nsresult OnStatusChange (nsIWebProgress aWebProgress, nsIRequest aRequest, nsresult aStatus, PRUnichar* aMessage) { return XPCOM.NS_OK; } -int OnSecurityChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int state) { +extern(System) +nsresult OnSecurityChange (nsIWebProgress aWebProgress, nsIRequest aRequest, PRUint32 state) { return XPCOM.NS_OK; } }
--- a/dwt/browser/DownloadFactory.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/DownloadFactory.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * 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 @@ -12,95 +12,70 @@ import dwt.dwthelper.utils; -import dwt.internal.C; -import dwt.internal.mozilla.XPCOM; -import dwt.internal.mozilla.XPCOMObject; +//import dwt.internal.C; +import XPCOM = dwt.internal.mozilla.XPCOM; +import dwt.internal.mozilla.Common; +//import dwt.internal.mozilla.XPCOMObject; import dwt.internal.mozilla.nsID; import dwt.internal.mozilla.nsIFactory; import dwt.internal.mozilla.nsISupports; -class DownloadFactory { - XPCOMObject supports; - XPCOMObject factory; +import dwt.browser.Download; + +class DownloadFactory : nsIFactory { int refCount = 0; -this () { - createCOMInterfaces (); -} +this () {} -int AddRef () { +extern(System) +nsrefcnt 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 ();} - }; +extern(System) +nsresult QueryInterface (nsID* riid, void** ppvObject) { + if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; - 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 (cast(int)/*64*/args[0]);} - }; -} - -void disposeCOMInterfaces () { - if (supports !is null) { - supports.dispose (); - supports = null; - } - if (factory !is null) { - factory.dispose (); - factory = null; - } -} - -int /*long*/ getAddress () { - return factory.getAddress (); -} - -int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) { - if (riid is 0 || ppvObject is 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); + if (*riid == nsISupports.IID) { + *ppvObject = cast(void*)cast(nsISupports)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIFactory.NS_IFACTORY_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {factory.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIFactory.IID) { + *ppvObject = cast(void*)cast(nsIFactory)this; AddRef (); return XPCOM.NS_OK; } - XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); + *ppvObject = null; return XPCOM.NS_ERROR_NO_INTERFACE; } - -int Release () { + +extern(System) +nsrefcnt Release () { refCount--; - if (refCount is 0) disposeCOMInterfaces (); + //if (refCount is 0) disposeCOMInterfaces (); return refCount; } /* nsIFactory */ -int 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; +extern(System) +nsresult CreateInstance (nsISupports aOuter, nsID* iid, void** result) { + if (result is null) + return XPCOM.NS_ERROR_INVALID_ARG; + auto download = new Download(); + nsresult rv = download.QueryInterface( iid, result ); + if (XPCOM.NS_FAILED(rv)) { + *result = null; + delete download; + } + return rv; } -int LockFactory (int lock) { +extern(System) +nsresult LockFactory (int lock) { return XPCOM.NS_OK; } }
--- a/dwt/browser/DownloadFactory_1_8.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/DownloadFactory_1_8.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * 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 @@ -7,100 +7,82 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Port to the D programming language: + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.DownloadFactory_1_8; import dwt.dwthelper.utils; -import dwt.internal.C; -import dwt.internal.mozilla.XPCOM; -import dwt.internal.mozilla.XPCOMObject; +//import dwt.internal.C; +import XPCOM = dwt.internal.mozilla.XPCOM; +import dwt.internal.mozilla.Common; +//import dwt.internal.mozilla.XPCOMObject; import dwt.internal.mozilla.nsID; import dwt.internal.mozilla.nsIFactory; import dwt.internal.mozilla.nsISupports; +import dwt.browser.Download_1_8; -class DownloadFactory_1_8 { - XPCOMObject supports; - XPCOMObject factory; +class DownloadFactory_1_8 : nsIFactory { + //XPCOMObject supports; + //XPCOMObject factory; int refCount = 0; this () { - createCOMInterfaces (); + //createCOMInterfaces (); } -int AddRef () { +extern(System) +nsrefcnt 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 ();} - }; +extern(System) +nsresult QueryInterface (nsIID* riid, void** ppvObject) { + if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; + //nsID guid = new nsID (); + //XPCOM.memmove (guid, riid, nsID.sizeof); - 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 (cast(int)/*64*/args[0]);} - }; -} - -void disposeCOMInterfaces () { - if (supports !is null) { - supports.dispose (); - supports = null; - } - if (factory !is null) { - factory.dispose (); - factory = null; - } -} - -int /*long*/ getAddress () { - return factory.getAddress (); -} - -int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) { - if (riid is 0 || ppvObject is 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); + if (*riid == nsISupports.IID) { + *ppvObject = cast(void*)cast(nsISupports)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIFactory.NS_IFACTORY_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {factory.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIFactory.IID) { + *ppvObject = cast(void*)cast(nsIFactory)this; AddRef (); return XPCOM.NS_OK; } - XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); + *ppvObject = null; return XPCOM.NS_ERROR_NO_INTERFACE; } - -int Release () { + +extern(System) +nsrefcnt Release () { refCount--; - if (refCount is 0) disposeCOMInterfaces (); + //if (refCount is 0) disposeCOMInterfaces (); return refCount; } /* nsIFactory */ -int 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; +extern(System) +nsresult CreateInstance (nsISupports aOuter, nsIID* iid, void** result) { + if (result is null) + return XPCOM.NS_ERROR_INVALID_ARG; + auto download = new Download_1_8; + nsresult rv = download.QueryInterface( iid, result ); + if (XPCOM.NS_FAILED(rv)) { + *result = null; + delete download; + } + return rv; } -int LockFactory (int lock) { +extern(System) +nsresult LockFactory (PRBool lock) { return XPCOM.NS_OK; } }
--- a/dwt/browser/Download_1_8.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/Download_1_8.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,5 +1,5 @@ -/******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. +/******************************************************************************* + * 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 @@ -7,16 +7,20 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Port to the D programming language: + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.Download_1_8; import dwt.dwthelper.utils; +import tango.text.convert.Format; import dwt.DWT; -import dwt.internal.C; -import dwt.internal.Compatibility; -import dwt.internal.mozilla.XPCOM; -import dwt.internal.mozilla.XPCOMObject; + +import XPCOM = dwt.internal.mozilla.XPCOM; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.prtime; import dwt.internal.mozilla.nsICancelable; import dwt.internal.mozilla.nsID; import dwt.internal.mozilla.nsIDownload_1_8; @@ -24,6 +28,17 @@ import dwt.internal.mozilla.nsISupports; import dwt.internal.mozilla.nsIURI; import dwt.internal.mozilla.nsIWebProgressListener; +import dwt.internal.mozilla.nsIMIMEInfo; +import dwt.internal.mozilla.nsIObserver; +import dwt.internal.mozilla.nsIDOMWindow; +import dwt.internal.mozilla.nsIWebProgress; +import dwt.internal.mozilla.nsIRequest; +import dwt.internal.mozilla.nsILocalFile; +import dwt.internal.mozilla.nsStringAPI; +import dwt.internal.mozilla.nsEmbedString; + +import dwt.browser.Mozilla; + import dwt.layout.GridData; import dwt.layout.GridLayout; import dwt.widgets.Button; @@ -32,17 +47,7 @@ import dwt.widgets.Listener; import dwt.widgets.Shell; -/** - * This class implements the nsIDownload interface for mozilla - * version 1.8.x. For mozilla versions 1.4 - 1.7.x this interface - * is implemented by class nsIDownload. Mozilla versions later - * than 1.8.x do not need to call this interface. - */ -class Download_1_8 { - XPCOMObject supports; - XPCOMObject download; - XPCOMObject progressDialog; - XPCOMObject webProgressListener; +class Download_1_8 : nsIProgressDialog_1_8 { nsICancelable cancelable; int refCount = 0; @@ -50,239 +55,129 @@ Label status; Button cancel; - static final bool is32 = C.PTR_SIZEOF is 4; + //static final bool is32 = C.PTR_SIZEOF is 4; //determine if 32 or 64 bit platform? this () { - createCOMInterfaces (); } -int AddRef () { +extern(System) +nsrefcnt 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], cast(int)/*64*/args[2], cast(int)/*64*/args[3]);} - public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], cast(int)/*64*/args[2], cast(int)/*64*/args[3], cast(int)/*64*/args[4], cast(int)/*64*/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], cast(int)/*64*/args[2], args[3]);} - public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], cast(int)/*64*/args[2]);} - public int /*long*/ method8 (int /*long*/[] args) { - if (args.length is 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 is 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], cast(int)/*64*/args[2], cast(int)/*64*/args[3]);} - public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], cast(int)/*64*/args[2], cast(int)/*64*/args[3], cast(int)/*64*/args[4], cast(int)/*64*/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], cast(int)/*64*/args[2], args[3]);} - public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], cast(int)/*64*/args[2]);} - public int /*long*/ method8 (int /*long*/[] args) { - if (args.length is 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 is 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 (cast(int)/*64*/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], cast(int)/*64*/args[2], cast(int)/*64*/args[3]);} - public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], cast(int)/*64*/args[2], cast(int)/*64*/args[3], cast(int)/*64*/args[4], cast(int)/*64*/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], cast(int)/*64*/args[2], args[3]);} - public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], cast(int)/*64*/args[2]);} - }; -} - -void disposeCOMInterfaces() { - if (supports !is null) { - supports.dispose (); - supports = null; - } - if (download !is null) { - download.dispose (); - download = null; +extern(System) +nsresult QueryInterface ( nsID* riid, void** ppvObject) { + if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; + + if (*riid == nsISupports.IID) { + *ppvObject = cast(void*)cast(nsISupports)this; + AddRef(); + return XPCOM.NS_OK; } - if (progressDialog !is null) { - progressDialog.dispose (); - progressDialog = null; - } - if (webProgressListener !is null) { - webProgressListener.dispose (); - webProgressListener = null; - } -} - -int /*long*/ getAddress () { - return progressDialog.getAddress (); -} - -int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) { - if (riid is 0 || ppvObject is 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); + if (*riid == nsIDownload_1_8.IID) { + *ppvObject = cast(void*)cast(nsIDownload_1_8)this; 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); + if (*riid == nsIProgressDialog_1_8.IID) { + *ppvObject = cast(void*)cast(nsIProgressDialog_1_8)this; AddRef(); return XPCOM.NS_OK; } - if (guid.Equals (nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {webProgressListener.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIWebProgressListener.IID) { + *ppvObject = cast(void*)cast(nsIWebProgressListener)this; AddRef(); return XPCOM.NS_OK; } - XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); + *ppvObject = null; return XPCOM.NS_ERROR_NO_INTERFACE; } -int Release () { +extern(System) +nsrefcnt Release () { refCount--; - if (refCount is 0) disposeCOMInterfaces (); + if (refCount is 0) return 0; return refCount; } /* nsIDownload */ /* Note. The argument startTime is defined as a PRInt64. This translates into two java ints. */ -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) { +extern(System) +nsresult Init_32 (nsIURI aSource, nsIURI aTarget, nsAString* aDisplayName, nsIMIMEInfo aMIMEInfo, PRInt32 startTime1, PRInt32 startTime2, nsILocalFile aTempFile, nsICancelable aCancelable) { long startTime = (startTime2 << 32) + startTime1; return Init (aSource, aTarget, aDisplayName, aMIMEInfo, startTime, aTempFile, aCancelable); } -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 !is 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); +// FIXME: I've hardcoded the string values in place of Compatibility.getMessage calls in +// the Init method; this will need fixing in future releases. -JJR +extern(System) +nsresult Init (nsIURI aSource, nsIURI aTarget, nsAString* aDisplayName, nsIMIMEInfo aMIMEInfo, PRTime startTime, nsILocalFile aTempFile, nsICancelable aCancelable) { + cancelable = aCancelable; + // nsIURI source = new nsIURI (aSource); + scope auto aSpec = new nsEmbedCString; + int rc = aSource.GetHost (cast(nsACString*)aSpec); + if (rc !is XPCOM.NS_OK) Mozilla.error(rc,__FILE__,__LINE__); + //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 = aSpec.toString; - nsIURI target = new nsIURI (aTarget); - int /*long*/ aPath = XPCOM.nsEmbedCString_new (); - rc = target.GetPath (aPath); + //nsIURI target = new nsIURI (aTarget); + scope auto aPath = new nsEmbedCString; + rc = aTarget.GetPath (cast(nsACString*)aPath); if (rc !is 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); + //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 = aPath.toString; + //int separator = locatePrior(filename, System.getProperty ("file.separator")); int separator = filename.lastIndexOf (System.getProperty ("file.separator")); //$NON-NLS-1$ + // NOTE: Not sure if this is correct; watch out for bugs here. -JJR filename = filename.substring (separator + 1); - Listener listener = new Listener() { + Listener listener = new class() Listener { public void handleEvent (Event event) { if (event.widget is cancel) { shell.close (); } if (cancelable !is null) { int rc = cancelable.Cancel (XPCOM.NS_BINDING_ABORTED); - if (rc !is XPCOM.NS_OK) Mozilla.error (rc); + if (rc !is XPCOM.NS_OK) Mozilla.error (rc,__FILE__,__LINE__); } shell = null; cancelable = null; } }; shell = new Shell (DWT.DIALOG_TRIM); - String msg = Compatibility.getMessage ("DWT_Download_File", new Object[] {filename}); //$NON-NLS-1$ - shell.setText (msg); +// FIXME: A working Compatibility.getMessage has not been ported yet +// Strings hardcoded for now. + //String msg = Compatibility.getMessage ("SWT_Download_File", new Object[] {filename}); //$NON-NLS-1$ + shell.setText ("Download: " ~ filename); GridLayout gridLayout = new GridLayout (); gridLayout.marginHeight = 15; gridLayout.marginWidth = 15; gridLayout.verticalSpacing = 20; shell.setLayout (gridLayout); - msg = Compatibility.getMessage ("DWT_Download_Location", new Object[] {filename, url}); //$NON-NLS-1$ - new Label (shell, DWT.SIMPLE).setText (msg); + //msg = Compatibility.getMessage ("SWT_Download_Location", new Object[] {filename, url}); //$NON-NLS-1$ + auto lbl = new Label (shell, DWT.SIMPLE); + lbl.setText ("Saving " ~ filename ~ " from " ~ url ); status = new Label (shell, DWT.SIMPLE); - msg = Compatibility.getMessage ("DWT_Download_Started"); //$NON-NLS-1$ - status.setText (msg); + //msg = Compatibility.getMessage ("SWT_Download_Started"); //$NON-NLS-1$ + status.setText ("Downloading..."); GridData data = new GridData (); data.grabExcessHorizontalSpace = true; data.grabExcessVerticalSpace = true; status.setLayoutData (data); cancel = new Button (shell, DWT.PUSH); - cancel.setText (DWT.getMessage ("DWT_Cancel")); //$NON-NLS-1$ + cancel.setText( "Cancel" ); + //cancel.setText (DWT.getMessage ("SWT_Cancel")); //$NON-NLS-1$ data = new GridData (); data.horizontalAlignment = GridData.CENTER; cancel.setLayoutData (data); @@ -293,100 +188,122 @@ return XPCOM.NS_OK; } -int GetAmountTransferred (int /*long*/ arg0) { +extern(System) +nsresult GetAmountTransferred (PRUint64* arg0) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetCancelable (int /*long*/ arg0) { +extern(System) +nsresult GetCancelable (nsICancelable* arg0) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetDisplayName (int /*long*/ aDisplayName) { +extern(System) +nsresult GetDisplayName (PRUnichar** aDisplayName) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetMIMEInfo (int /*long*/ aMIMEInfo) { +extern(System) +nsresult GetMIMEInfo (nsIMIMEInfo* aMIMEInfo) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetPercentComplete (int /*long*/ aPercentComplete) { +extern(System) +nsresult GetPercentComplete (PRInt32* aPercentComplete) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetSize (int /*long*/ arg0) { +extern(System) +nsresult GetSize (PRUint64* arg0) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetSource (int /*long*/ aSource) { +extern(System) +nsresult GetSource (nsIURI* aSource) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetStartTime (int /*long*/ aStartTime) { +extern(System) +nsresult GetStartTime (PRInt64* aStartTime) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetTarget (int /*long*/ aTarget) { +extern(System) +nsresult GetTarget (nsIURI* aTarget) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetTargetFile (int /*long*/ arg0) { +extern(System) +nsresult GetTargetFile (nsILocalFile* arg0) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } /* nsIProgressDialog */ -int GetCancelDownloadOnClose (int /*long*/ aCancelDownloadOnClose) { + +extern(System) +nsresult GetCancelDownloadOnClose (PRBool* aCancelDownloadOnClose) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetDialog (int /*long*/ aDialog) { +extern(System) +nsresult GetDialog (nsIDOMWindow* aDialog) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetObserver (int /*long*/ aObserver) { +extern(System) +nsresult GetObserver (nsIObserver* aObserver) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int Open (int /*long*/ aParent) { +extern(System) +nsresult Open (nsIDOMWindow aParent) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int SetCancelDownloadOnClose (int aCancelDownloadOnClose) { +extern(System) +nsresult SetCancelDownloadOnClose (PRBool aCancelDownloadOnClose) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int SetDialog (int /*long*/ aDialog) { +extern(System) +nsresult SetDialog (nsIDOMWindow aDialog) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int SetObserver (int /*long*/ aObserver) { +extern(System) +nsresult SetObserver (nsIObserver aObserver) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } /* nsIWebProgressListener */ -int OnLocationChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aLocation) { +extern(System) +nsresult OnLocationChange (nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation) { return XPCOM.NS_OK; } -int OnProgressChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aCurSelfProgress, int aMaxSelfProgress, int aCurTotalProgress, int aMaxTotalProgress) { +extern(System) +nsresult OnProgressChange (nsIWebProgress aWebProgress, nsIRequest aRequest, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, PRInt32 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 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) { +nsresult 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 OnProgressChange64 (int /*long*/ aWebProgress, int /*long*/ aRequest, long aCurSelfProgress, long aMaxSelfProgress, long aCurTotalProgress, long aMaxTotalProgress) { +++/ +extern(System) +nsresult OnProgressChange64 (nsIWebProgress aWebProgress, nsIRequest aRequest, PRInt64 aCurSelfProgress, PRInt64 aMaxSelfProgress, PRInt64 aCurTotalProgress, PRInt64 aMaxTotalProgress) { long currentKBytes = aCurTotalProgress / 1024; long totalKBytes = aMaxTotalProgress / 1024; if (shell !is null && !shell.isDisposed ()) { - Object[] arguments = {new Long (currentKBytes), new Long (totalKBytes)}; - String statusMsg = Compatibility.getMessage ("DWT_Download_Status", arguments); //$NON-NLS-1$ + //Object[] arguments = {new Long (currentKBytes), new Long (totalKBytes)}; + //String statusMsg = Compatibility.getMessage ("SWT_Download_Status", arguments); //$NON-NLS-1$ + String statusMsg = Format("Download: {0} KB of {1} KB", currentKBytes, totalKBytes); status.setText (statusMsg); shell.layout (true); shell.getDisplay ().update (); @@ -394,11 +311,13 @@ return XPCOM.NS_OK; } -int OnSecurityChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int state) { +extern(System) +nsresult OnSecurityChange (nsIWebProgress aWebProgress, nsIRequest aRequest, PRUint32 state) { return XPCOM.NS_OK; } -int OnStateChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aStateFlags, int aStatus) { +extern(System) +nsresult OnStateChange (nsIWebProgress aWebProgress, nsIRequest aRequest, PRUint32 aStateFlags, nsresult aStatus) { if ((aStateFlags & nsIWebProgressListener.STATE_STOP) !is 0) { cancelable = null; if (shell !is null && !shell.isDisposed ()) shell.dispose (); @@ -407,7 +326,8 @@ return XPCOM.NS_OK; } -int OnStatusChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aStatus, int /*long*/ aMessage) { +extern(System) +nsresult OnStatusChange (nsIWebProgress aWebProgress, nsIRequest aRequest, nsresult aStatus, PRUnichar* aMessage) { return XPCOM.NS_OK; } }
--- a/dwt/browser/FilePicker.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/FilePicker.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,5 +1,5 @@ -/******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. +/******************************************************************************* + * 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 @@ -7,164 +7,121 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Port to the D programming language: + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.FilePicker; import dwt.dwthelper.utils; import dwt.DWT; -import dwt.internal.C; -import dwt.internal.mozilla.XPCOM; -import dwt.internal.mozilla.XPCOMObject; + +import XPCOM = dwt.internal.mozilla.XPCOM; + +import dwt.internal.mozilla.Common; import dwt.internal.mozilla.nsEmbedString; +import dwt.internal.mozilla.nsISupports; import dwt.internal.mozilla.nsID; -import dwt.internal.mozilla.nsIDOMWindow; import dwt.internal.mozilla.nsIFilePicker; import dwt.internal.mozilla.nsIFilePicker_1_8; import dwt.internal.mozilla.nsILocalFile; -import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIFileURL; +import dwt.internal.mozilla.nsIDOMWindow; +import dwt.internal.mozilla.nsISimpleEnumerator; +import dwt.internal.mozilla.nsStringAPI; + +import dwt.browser.Mozilla; + import dwt.widgets.DirectoryDialog; +import dwt.widgets.Display; import dwt.widgets.FileDialog; import dwt.widgets.Shell; -class FilePicker { - XPCOMObject supports; - XPCOMObject filePicker; +class FilePicker : nsIFilePicker { int refCount = 0; short mode; - int /*long*/ parentHandle; + nsIDOMWindow parentHandle; String[] files, masks; String defaultFilename, directory, title; static final String SEPARATOR = System.getProperty ("file.separator"); //$NON-NLS-1$ this () { - createCOMInterfaces (); } -int AddRef () { +extern(System) +nsrefcnt 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], cast(short)args[2]);} - public int /*long*/ method4 (int /*long*/[] args) {return AppendFilters (cast(int)/*64*/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 (cast(int)/*64*/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 !is null) { - supports.dispose (); - supports = null; - } - if (filePicker !is null) { - filePicker.dispose (); - filePicker = null; - } -} - -int /*long*/ getAddress () { - return filePicker.getAddress (); -} - -int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) { - if (riid is 0 || ppvObject is 0) return XPCOM.NS_ERROR_NO_INTERFACE; - nsID guid = new nsID (); - XPCOM.memmove (guid, riid, nsID.sizeof); +extern(System) +nsresult QueryInterface (nsID* riid, void** ppvObject) { + if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; - if (guid.Equals (nsISupports.NS_ISUPPORTS_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {supports.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsISupports.IID) { + *ppvObject = cast(void*)cast(nsISupports) this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIFilePicker.NS_IFILEPICKER_IID)) { - XPCOM.memmove(ppvObject, new int /*long*/[] {filePicker.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIFilePicker.IID) { + *ppvObject = cast(void*)cast(nsIFilePicker) this; AddRef (); return XPCOM.NS_OK; - } - if (guid.Equals (nsIFilePicker_1_8.NS_IFILEPICKER_IID)) { - XPCOM.memmove(ppvObject, new int /*long*/[] {filePicker.getAddress ()}, C.PTR_SIZEOF); + } + if (*riid == nsIFilePicker_1_8.IID) { + *ppvObject = cast(void*)cast(nsIFilePicker_1_8) this; AddRef (); return XPCOM.NS_OK; } - - XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); + *ppvObject = null; return XPCOM.NS_ERROR_NO_INTERFACE; } - -int Release () { + +extern(System) +nsrefcnt Release () { refCount--; - if (refCount is 0) disposeCOMInterfaces (); + if (refCount is 0) return 0; return refCount; } -Browser getBrowser (int /*long*/ aDOMWindow) { - if (aDOMWindow is 0) return null; - nsIDOMWindow window = new nsIDOMWindow (aDOMWindow); - return Mozilla.findBrowser (window); -} - /* * As of Mozilla 1.8 some of nsIFilePicker's string arguments changed type. This method * answers a java string based on the type of string that is appropriate for the Mozilla * version being used. */ -String parseAString (int /*long*/ string) { +extern(D) +String parseAString (nsAString* string) { return null; } /* nsIFilePicker */ -int Init (int /*long*/ parent, int /*long*/ title, short mode) { +extern(System) +nsresult Init (nsIDOMWindow parent, nsAString* title, PRInt16 mode) { parentHandle = parent; this.mode = mode; this.title = parseAString (title); return XPCOM.NS_OK; } -int Show (int /*long*/ _retval) { +extern(System) +nsresult Show (PRInt16* _retval) { if (mode is nsIFilePicker.modeGetFolder) { /* picking a directory */ int result = showDirectoryPicker (); - XPCOM.memmove (_retval, new short[] {cast(short)result}, 2); /* PRInt16 */ + *_retval = cast(int)cast(PRInt16)result; /* PRInt16 */ return XPCOM.NS_OK; } /* picking a file */ int style = mode is nsIFilePicker.modeSave ? DWT.SAVE : DWT.OPEN; if (mode is nsIFilePicker.modeOpenMultiple) style |= DWT.MULTI; - Browser browser = getBrowser (parentHandle); - Shell parent = null; - if (browser !is null) { - parent = browser.getShell (); - } else { - parent = new Shell (); + Display display = Display.getCurrent (); + Shell parent = null; // TODO compute parent + if (parent is null) { + parent = new Shell (display); } FileDialog dialog = new FileDialog (parent, style); if (title !is null) dialog.setText (title); @@ -177,17 +134,15 @@ title = defaultFilename = null; masks = null; int result = filename is null ? nsIFilePicker.returnCancel : nsIFilePicker.returnOK; - XPCOM.memmove (_retval, new short[] {cast(short)result}, 2); /* PRInt16 */ + *_retval = cast(int)cast(short)result;; /* PRInt16 */ return XPCOM.NS_OK; } int showDirectoryPicker () { - Browser browser = getBrowser (parentHandle); - Shell parent = null; - if (browser !is null) { - parent = browser.getShell (); - } else { - parent = new Shell (); + Display display = Display.getCurrent (); + Shell parent = null; // TODO compute parent + if (parent is null) { + parent = new Shell (display); } DirectoryDialog dialog = new DirectoryDialog (parent, DWT.NONE); if (title !is null) dialog.setText (title); @@ -198,89 +153,90 @@ return directory is null ? nsIFilePicker.returnCancel : nsIFilePicker.returnOK; } -int GetFiles (int /*long*/ aFiles) { +extern(System) +nsresult GetFiles (nsISimpleEnumerator* aFiles) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetFileURL (int /*long*/ aFileURL) { +extern(System) +nsresult GetFileURL ( nsIFileURL* aFileURL ) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetFile (int /*long*/ aFile) { +extern(System) +nsresult GetFile (nsILocalFile* aFile) { String filename = ""; //$NON-NLS-1$ - if (directory !is null) filename += directory + SEPARATOR; - if (files !is 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 (), 1, file); - path.dispose (); + if (directory !is null) filename ~= directory ~ SEPARATOR; + if (files !is null && files.length > 0) filename ~= files[0]; + scope auto path = new nsEmbedString (toString16(filename)); + int rc = XPCOM.NS_NewLocalFile (cast(nsAString*)path, 1, aFile); if (rc !is XPCOM.NS_OK) Mozilla.error (rc); - if (file[0] is 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); - XPCOM.memmove (aFile, file, C.PTR_SIZEOF); + if (aFile is null) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); return XPCOM.NS_OK; } -int SetDisplayDirectory (int /*long*/ aDisplayDirectory) { - if (aDisplayDirectory is 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 = MozillaDelegate.mbcsToWcs (null, bytes); - directory = new String (chars); +extern(System) +nsresult SetDisplayDirectory (nsILocalFile aDisplayDirectory) { + if (aDisplayDirectory is null) return XPCOM.NS_OK; + scope auto pathname = new nsEmbedCString(); + aDisplayDirectory.GetNativePath (cast(nsACString*)pathname); + // wchar[] chars = MozillaDelegate.mbcsToWcs (null, bytes); + directory = pathname.toString; return XPCOM.NS_OK; } -int GetDisplayDirectory (int /*long*/ aDisplayDirectory) { +extern(System) +nsresult GetDisplayDirectory (nsILocalFile* aDisplayDirectory) { String directoryName = directory !is null ? directory : ""; //$NON-NLS-1$ - nsEmbedString path = new nsEmbedString (directoryName); - int /*long*/[] file = new int /*long*/[1]; - int rc = XPCOM.NS_NewLocalFile (path.getAddress (), 1, file); - path.dispose (); + scope auto path = new nsEmbedString (Utf.toString16(directoryName)); + int rc = XPCOM.NS_NewLocalFile (cast(nsAString*)path, 1, aDisplayDirectory); if (rc !is XPCOM.NS_OK) Mozilla.error (rc); - if (file[0] is 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); - XPCOM.memmove (aDisplayDirectory, file, C.PTR_SIZEOF); + if (aDisplayDirectory is null) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); return XPCOM.NS_OK; } -int SetFilterIndex (int aFilterIndex) { +extern(System) +nsresult SetFilterIndex (PRInt32 aFilterIndex) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetFilterIndex (int /*long*/ aFilterIndex) { +extern(System) +nsresult GetFilterIndex (PRInt32* aFilterIndex) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int SetDefaultExtension (int /*long*/ aDefaultExtension) { +extern(System) +nsresult SetDefaultExtension (nsAString* aDefaultExtension) { /* note that the type of argument 1 changed as of Mozilla 1.8 */ return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetDefaultExtension (int /*long*/ aDefaultExtension) { +extern(System) +nsresult GetDefaultExtension (nsAString* aDefaultExtension) { /* note that the type of argument 1 changed as of Mozilla 1.8 */ return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int SetDefaultString (int /*long*/ aDefaultString) { +extern(System) +nsresult SetDefaultString (nsAString* aDefaultString) { defaultFilename = parseAString (aDefaultString); return XPCOM.NS_OK; } -int GetDefaultString (int /*long*/ aDefaultString) { +extern(System) +nsresult GetDefaultString (nsAString* aDefaultString) { /* note that the type of argument 1 changed as of Mozilla 1.8 */ return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int AppendFilter (int /*long*/ title, int /*long*/ filter) { +extern(System) +nsresult AppendFilter (nsAString* title, nsAString* filter) { /* note that the type of arguments 1 and 2 changed as of Mozilla 1.8 */ return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int AppendFilters (int filterMask) { +extern(System) +nsresult AppendFilters (PRInt32 filterMask) { String[] addFilters = null; switch (filterMask) { case nsIFilePicker.filterAll: @@ -288,29 +244,26 @@ masks = null; /* this is equivalent to no filter */ break; case nsIFilePicker.filterHTML: - addFilters = new String[] {"*.htm;*.html"}; //$NON-NLS-1$ + addFilters[0] = "*.htm;*.html"; //$NON-NLS-1$ break; case nsIFilePicker.filterImages: - addFilters = new String[] {"*.gif;*.jpeg;*.jpg;*.png"}; //$NON-NLS-1$ + addFilters[0] = "*.gif;*.jpeg;*.jpg;*.png"; //$NON-NLS-1$ break; case nsIFilePicker.filterText: - addFilters = new String[] {"*.txt"}; //$NON-NLS-1$ + addFilters[0] = "*.txt"; //$NON-NLS-1$ break; case nsIFilePicker.filterXML: - addFilters = new String[] {"*.xml"}; //$NON-NLS-1$ + addFilters[0] = "*.xml"; //$NON-NLS-1$ break; case nsIFilePicker.filterXUL: - addFilters = new String[] {"*.xul"}; //$NON-NLS-1$ + addFilters[0] = "*.xul"; //$NON-NLS-1$ break; } if (masks is null) { masks = addFilters; } else { if (addFilters !is 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; + masks ~= addFilters; } } return XPCOM.NS_OK;
--- a/dwt/browser/FilePickerFactory.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/FilePickerFactory.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * 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 @@ -7,100 +7,81 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Port to the D programming language: + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.FilePickerFactory; import dwt.dwthelper.utils; -import dwt.internal.C; -import dwt.internal.mozilla.XPCOM; -import dwt.internal.mozilla.XPCOMObject; +//import dwt.internal.C; +import XPCOM = dwt.internal.mozilla.XPCOM; +//import dwt.internal.mozilla.XPCOMObject; +import dwt.internal.mozilla.Common; import dwt.internal.mozilla.nsID; import dwt.internal.mozilla.nsIFactory; import dwt.internal.mozilla.nsISupports; -class FilePickerFactory { - XPCOMObject supports; - XPCOMObject factory; +import dwt.browser.FilePicker; + +class FilePickerFactory : nsIFactory { + //XPCOMObject supports; + //XPCOMObject factory; int refCount = 0; -this () { - createCOMInterfaces (); -} +this () { } -int AddRef () { +extern(System) +nsrefcnt 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 ();} - }; +extern(System) +nsresult QueryInterface (nsID* riid, void** ppvObject) { + if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; + //nsID guid = new nsID (); + //XPCOM.memmove (guid, riid, nsID.sizeof); - 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 (cast(int)/*64*/args[0]);} - }; -} - -void disposeCOMInterfaces () { - if (supports !is null) { - supports.dispose (); - supports = null; - } - if (factory !is null) { - factory.dispose (); - factory = null; - } -} - -int /*long*/ getAddress () { - return factory.getAddress (); -} - -int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) { - if (riid is 0 || ppvObject is 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); + if (*riid == nsISupports.IID) { + *ppvObject = cast(void*)cast(nsISupports)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIFactory.NS_IFACTORY_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {factory.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIFactory.IID) { + *ppvObject = cast(void*)cast(nsIFactory)this; AddRef (); return XPCOM.NS_OK; } - XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); + *ppvObject = null; return XPCOM.NS_ERROR_NO_INTERFACE; } -int Release () { +extern(System) +nsrefcnt Release () { refCount--; - if (refCount is 0) disposeCOMInterfaces (); + //if (refCount is 0) disposeCOMInterfaces (); return refCount; } /* nsIFactory */ -int 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; +extern(System) +nsresult CreateInstance (nsISupports aOuter, nsID* iid, void** result) { + if (result is null) + return XPCOM.NS_ERROR_INVALID_ARG; + auto picker = new FilePicker; + nsresult rv = picker.QueryInterface( iid, result ); + if (XPCOM.NS_FAILED(rv)) { + *result = null; + delete picker; + } + return rv; } -int LockFactory (int lock) { +extern(System) +nsresult LockFactory (PRBool lock) { return XPCOM.NS_OK; } }
--- a/dwt/browser/FilePickerFactory_1_8.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/FilePickerFactory_1_8.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * 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 @@ -7,41 +7,35 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Port to the D programming language: + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.FilePickerFactory_1_8; import dwt.dwthelper.utils; -import dwt.internal.C; -import dwt.internal.mozilla.XPCOM; -import dwt.internal.mozilla.XPCOMObject; +import XPCOM = dwt.internal.mozilla.XPCOM; +import dwt.browser.FilePickerFactory; +import dwt.browser.FilePicker_1_8; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + class FilePickerFactory_1_8 : FilePickerFactory { -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 (cast(int)/*64*/args[0]);} - }; -} - -/* nsIFactory */ - -int CreateInstance (int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) { - FilePicker_1_8 picker = new FilePicker_1_8 (); - picker.AddRef (); - XPCOM.memmove (result, new int /*long*/[] {picker.getAddress ()}, C.PTR_SIZEOF); - return XPCOM.NS_OK; +extern(System) +nsresult CreateInstance (nsISupports aOuter, nsID* iid, void** result) { + if (result is null) + return XPCOM.NS_ERROR_INVALID_ARG; + auto picker = new FilePicker_1_8; + nsresult rv = picker.QueryInterface( iid, result ); + if (XPCOM.NS_FAILED(rv)) { + *result = null; + delete picker; + } + return rv; } }
--- a/dwt/browser/FilePicker_1_8.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/FilePicker_1_8.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * 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 @@ -7,57 +7,22 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Port to the D programming language: + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.FilePicker_1_8; import dwt.dwthelper.utils; -import dwt.internal.mozilla.XPCOM; -import dwt.internal.mozilla.XPCOMObject; +import dwt.browser.FilePicker; +import XPCOM = dwt.internal.mozilla.XPCOM; +import dwt.internal.mozilla.nsStringAPI; class FilePicker_1_8 : FilePicker { -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], cast(short)args[2]);} - public int /*long*/ method4 (int /*long*/[] args) {return AppendFilters (cast(int)/*64*/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 (cast(int)/*64*/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]);} - }; -} - -/* - * As of Mozilla 1.8 some of nsIFilePicker's string arguments changed type. This method - * answers a java string based on the type of string that is appropriate for the Mozilla - * version being used. - */ -String parseAString (int /*long*/ string) { - if (string is 0) return null; - int length = XPCOM.nsEmbedString_Length (string); - int /*long*/ buffer = XPCOM.nsEmbedString_get (string); - char[] chars = new char[length]; - XPCOM.memmove (chars, buffer, length * 2); - return new String (chars); +extern(D) +String parseAString (nsAString* string) { + if (string is null) return null; + return nsAString.toString(string); } }
--- a/dwt/browser/HelperAppLauncherDialog.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/HelperAppLauncherDialog.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,5 +1,5 @@ -/******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. +/******************************************************************************* + * 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 @@ -7,97 +7,74 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Port to the D programming language: + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.HelperAppLauncherDialog; import dwt.dwthelper.utils; +import Utf = tango.text.convert.Utf; + import dwt.DWT; -import dwt.internal.C; -import dwt.internal.mozilla.XPCOM; -import dwt.internal.mozilla.XPCOMObject; + +import XPCOM = dwt.internal.mozilla.XPCOM; + +import dwt.internal.mozilla.Common; import dwt.internal.mozilla.nsEmbedString; import dwt.internal.mozilla.nsID; import dwt.internal.mozilla.nsIHelperAppLauncher; import dwt.internal.mozilla.nsIHelperAppLauncherDialog; import dwt.internal.mozilla.nsIHelperAppLauncher_1_8; import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsILocalFile; +import dwt.internal.mozilla.nsStringAPI; + +import dwt.browser.Mozilla; + import dwt.widgets.FileDialog; import dwt.widgets.Shell; /** - * This class implements the nsIHelperAppLauncherDialog interface for mozilla + * This class implements the HelperAppLauncherDialog interface for mozilla * versions 1.4 - 1.8.x. For mozilla versions >= 1.9 this interface is * implemented by class HelperAppLauncherDialog_1_9. HelperAppLauncherDialogFactory * determines at runtime which of these classes to instantiate. */ -class HelperAppLauncherDialog { - XPCOMObject supports; - XPCOMObject helperAppLauncherDialog; + +class HelperAppLauncherDialog : nsIHelperAppLauncherDialog { int refCount = 0; -this () { - createCOMInterfaces (); +this() { } -int AddRef () { +extern(System) +nsrefcnt 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 ();} - }; +extern(System) +nsresult QueryInterface (nsID* riid, void** ppvObject) { + if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; - 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], cast(int)/*64*/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 !is null) { - supports.dispose (); - supports = null; - } - if (helperAppLauncherDialog !is null) { - helperAppLauncherDialog.dispose (); - helperAppLauncherDialog = null; - } -} - -int /*long*/ getAddress () { - return helperAppLauncherDialog.getAddress (); -} - -int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) { - if (riid is 0 || ppvObject is 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); + if (*riid == nsISupports.IID) { + *ppvObject = cast(void*)cast(nsISupports)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIHelperAppLauncherDialog.NS_IHELPERAPPLAUNCHERDIALOG_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {helperAppLauncherDialog.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIHelperAppLauncherDialog.IID) { + *ppvObject = cast(void*)cast(nsIHelperAppLauncherDialog)this; AddRef (); return XPCOM.NS_OK; } - XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); + *ppvObject = null; return XPCOM.NS_ERROR_NO_INTERFACE; } - -int Release () { + +extern(System) +nsrefcnt Release () { refCount--; /* * Note. This instance lives as long as the download it is binded to. @@ -106,33 +83,36 @@ * cancels the File Dialog, cancels or closes the Download Dialog * and when the Download Dialog goes away after the download is completed. */ - if (refCount is 0) disposeCOMInterfaces (); + if (refCount is 0) return 0; return refCount; } /* nsIHelperAppLauncherDialog */ -int Show (int /*long*/ aLauncher, int /*long*/ aContext, int aReason) { - /* +extern(System) +nsresult Show(nsIHelperAppLauncher aLauncher, nsISupports aContext, PRUint32 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 is XPCOM.NS_OK) { /* >= 1.8 */ - nsIHelperAppLauncher_1_8 helperAppLauncher = new nsIHelperAppLauncher_1_8 (aLauncher); - rc = helperAppLauncher.SaveToDisk (0, 0); + + nsISupports supports = cast(nsISupports)aLauncher; + nsIHelperAppLauncher_1_8 helperAppLauncher; + nsresult rc = supports.QueryInterface (&nsIHelperAppLauncher_1_8.IID, cast(void**)&helperAppLauncher); + if (rc is 0) { + rc = helperAppLauncher.SaveToDisk (null, 0); helperAppLauncher.Release (); return rc; } - nsIHelperAppLauncher helperAppLauncher = new nsIHelperAppLauncher (aLauncher); /* < 1.8 */ - return helperAppLauncher.SaveToDisk (0, 0); + + /* < 1.8 */ + return aLauncher.SaveToDisk (null, 0); + // no Release for this? -JJR } -int PromptForSaveToFile (int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ arg3, int /*long*/ arg4) { - int /*long*/ aDefaultFile, aSuggestedFileExtension, _retval; +extern(System) +nsresult PromptForSaveToFile (nsIHelperAppLauncher aLauncher, nsISupports aWindowContext, PRUnichar* aDefaultFile, PRUnichar* aSuggestedFileExtension, nsILocalFile* _retval) { bool hasLauncher = false; /* @@ -149,70 +129,78 @@ * argument must be queried for both the old and new nsIHelperAppLauncher interfaces. */ bool using_1_8 = false; - nsISupports support = new nsISupports (arg0); - int /*long*/[] result = new int /*long*/[1]; - int rc = support.QueryInterface (nsIHelperAppLauncher_1_8.NS_IHELPERAPPLAUNCHER_IID, result); + nsISupports support = cast(nsISupports)aLauncher; + + if (aLauncher is null) + assert(0); + + nsIHelperAppLauncher_1_8 helperAppLauncher1; + int rc = support.QueryInterface (&nsIHelperAppLauncher_1_8.IID, cast(void**)&helperAppLauncher1); if (rc is XPCOM.NS_OK) { using_1_8 = true; hasLauncher = true; - new nsISupports (result[0]).Release (); + helperAppLauncher1.Release (); } else { - result[0] = 0; - rc = support.QueryInterface (nsIHelperAppLauncher.NS_IHELPERAPPLAUNCHER_IID, result); + nsIHelperAppLauncher helperAppLauncher; + rc = support.QueryInterface (&nsIHelperAppLauncher.IID, cast(void**)&helperAppLauncher); if (rc is XPCOM.NS_OK) { hasLauncher = true; - new nsISupports (result[0]).Release (); + helperAppLauncher.Release; } } - result[0] = 0; +/+ + // In D port, no suppport for version >1.4 yet if (hasLauncher) { /* >= 1.5 */ aDefaultFile = arg2; aSuggestedFileExtension = arg3; _retval = arg4; - } else { /* 1.4 */ + } else { /* 1.4 */ + // This call conversion probablywon't work for non-Java + // and shouldn't get called; fix it later. -JJR aDefaultFile = arg1; aSuggestedFileExtension = arg2; _retval = arg3; } ++/ + //int span = XPCOM.strlen_PRUnichar (aDefaultFile); + // XPCOM.memmove (dest, aDefaultFile, length * 2); + String defaultFile = Utf.toString(fromString16z(aDefaultFile)); - 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); + //span = XPCOM.strlen_PRUnichar (aSuggestedFileExtension); + //dest = new char[length]; + //XPCOM.memmove (dest, aSuggestedFileExtension, length * 2); + String suggestedFileExtension = Utf.toString(fromString16z(aSuggestedFileExtension)); Shell shell = new Shell (); FileDialog fileDialog = new FileDialog (shell, DWT.SAVE); fileDialog.setFileName (defaultFile); - fileDialog.setFilterExtensions (new String[] {suggestedFileExtension}); + String[] tmp; + tmp ~= suggestedFileExtension; + fileDialog.setFilterExtensions (tmp); String name = fileDialog.open (); shell.close (); if (name is null) { if (hasLauncher) { if (using_1_8) { - nsIHelperAppLauncher_1_8 launcher = new nsIHelperAppLauncher_1_8 (arg0); - rc = launcher.Cancel (XPCOM.NS_BINDING_ABORTED); + rc = (cast(nsIHelperAppLauncher_1_8)aLauncher).Cancel (XPCOM.NS_BINDING_ABORTED); } else { - nsIHelperAppLauncher launcher = new nsIHelperAppLauncher (arg0); - rc = launcher.Cancel (); + rc = aLauncher.Cancel (); } - if (rc !is XPCOM.NS_OK) Mozilla.error (rc); + if (rc !is XPCOM.NS_OK) Mozilla.error (rc,__FILE__,__LINE__); return XPCOM.NS_OK; } return XPCOM.NS_ERROR_FAILURE; } - nsEmbedString path = new nsEmbedString (name); - rc = XPCOM.NS_NewLocalFile (path.getAddress (), 1, result); - path.dispose (); - if (rc !is XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] is 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); + scope auto path = new nsEmbedString (name.toString16()); + nsILocalFile localFile; + rc = XPCOM.NS_NewLocalFile (cast(nsAString*)path, 1, &localFile); + //path.dispose (); + if (rc !is XPCOM.NS_OK) Mozilla.error (rc,__FILE__,__LINE__); + if (localFile is null) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER,__FILE__,__LINE__); /* Our own nsIDownload has been registered during the Browser initialization. It will be invoked by Mozilla. */ - XPCOM.memmove (_retval, result, C.PTR_SIZEOF); + *_retval = localFile; + //XPCOM.memmove (_retval, result, C.PTR_SIZEOF); return XPCOM.NS_OK; } }
--- a/dwt/browser/HelperAppLauncherDialogFactory.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/HelperAppLauncherDialogFactory.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * 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 @@ -7,107 +7,91 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Port to the D programming language: + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.HelperAppLauncherDialogFactory; import dwt.dwthelper.utils; -import dwt.internal.C; -import dwt.internal.mozilla.XPCOM; -import dwt.internal.mozilla.XPCOMObject; +import XPCOM = dwt.internal.mozilla.XPCOM; + +import dwt.internal.mozilla.Common; import dwt.internal.mozilla.nsID; import dwt.internal.mozilla.nsIFactory; import dwt.internal.mozilla.nsISupports; -class HelperAppLauncherDialogFactory { - XPCOMObject supports; - XPCOMObject factory; +import dwt.browser.HelperAppLauncherDialog; +import dwt.browser.HelperAppLauncherDialog_1_9; + +class HelperAppLauncherDialogFactory : nsIFactory { int refCount = 0; bool isPre_1_9 = true; + this () { - createCOMInterfaces (); } -int AddRef () { +extern(System) +nsrefcnt 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 ();} - }; +extern(System) +nsresult QueryInterface (nsID* riid, void** ppvObject) { + if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; - 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 (cast(int)/*64*/args[0]);} - }; -} - -void disposeCOMInterfaces () { - if (supports !is null) { - supports.dispose (); - supports = null; - } - if (factory !is null) { - factory.dispose (); - factory = null; - } -} - -int /*long*/ getAddress () { - return factory.getAddress (); -} - -int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) { - if (riid is 0 || ppvObject is 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); + if (*riid == nsISupports.IID) { + *ppvObject = cast(void*)cast(nsISupports)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIFactory.NS_IFACTORY_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {factory.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIFactory.IID) { + *ppvObject = cast(void*)cast(nsIFactory)this; AddRef (); return XPCOM.NS_OK; } - XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); + *ppvObject = null; return XPCOM.NS_ERROR_NO_INTERFACE; } - -int Release () { + +extern(System) +nsrefcnt Release () { refCount--; - if (refCount is 0) disposeCOMInterfaces (); + if (refCount is 0) return 0; return refCount; } - + /* nsIFactory */ -int CreateInstance (int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) { +extern(System) +nsresult CreateInstance (nsISupports aOuter, nsID* iid, void** result) { if (isPre_1_9) { - HelperAppLauncherDialog helperAppLauncherDialog = new HelperAppLauncherDialog (); - helperAppLauncherDialog.AddRef (); - XPCOM.memmove (result, new int /*long*/[] {helperAppLauncherDialog.getAddress ()}, C.PTR_SIZEOF); - } else { - HelperAppLauncherDialog_1_9 helperAppLauncherDialog = new HelperAppLauncherDialog_1_9 (); - helperAppLauncherDialog.AddRef (); - XPCOM.memmove (result, new int /*long*/[] {helperAppLauncherDialog.getAddress ()}, C.PTR_SIZEOF); + if (result is null) + return XPCOM.NS_ERROR_INVALID_ARG; + auto helperAppLauncherDialog = new HelperAppLauncherDialog; + nsresult rv = helperAppLauncherDialog.QueryInterface( iid, result ); + if (XPCOM.NS_FAILED(rv)) { + *result = null; + delete helperAppLauncherDialog; + } else { + if (result is null) + return XPCOM.NS_ERROR_INVALID_ARG; + auto helperAppLauncherDialog19 = new HelperAppLauncherDialog_1_9; + rv = helperAppLauncherDialog19.QueryInterface( iid, result ); + if (XPCOM.NS_FAILED(rv)) { + *result = null; + delete helperAppLauncherDialog19; + } + return rv; + } } - return XPCOM.NS_OK; } -int LockFactory (int lock) { +extern(System) +nsresult LockFactory (PRBool lock) { return XPCOM.NS_OK; } }
--- a/dwt/browser/HelperAppLauncherDialog_1_9.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/HelperAppLauncherDialog_1_9.d Fri Jan 16 12:49:08 2009 +0100 @@ -7,96 +7,68 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Ported to the D Programming Language: + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.HelperAppLauncherDialog_1_9; +import tango.text.convert.Utf; import dwt.dwthelper.utils; import dwt.DWT; -import dwt.internal.C; -import dwt.internal.mozilla.XPCOM; -import dwt.internal.mozilla.XPCOMObject; + +import dwt.internal.mozilla.Common; + +import XPCOM = dwt.internal.mozilla.XPCOM; + import dwt.internal.mozilla.nsEmbedString; import dwt.internal.mozilla.nsID; import dwt.internal.mozilla.nsIHelperAppLauncherDialog_1_9; import dwt.internal.mozilla.nsIHelperAppLauncher_1_9; +import dwt.internal.mozilla.nsILocalFile; import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsStringAPI; +import dwt.internal.mozilla.nsEmbedString; + import dwt.widgets.FileDialog; import dwt.widgets.Shell; -/** - * This class implements the nsIHelperAppLauncherDialog interface for mozilla - * versions >= 1.9. For mozilla versions 1.4 - 1.8.x this interface is - * implemented by class HelperAppLauncherDialog. HelperAppLauncherDialogFactory - * determines at runtime which of these classes to instantiate. - */ -class HelperAppLauncherDialog_1_9 { - XPCOMObject supports; - XPCOMObject helperAppLauncherDialog; +import dwt.browser.Mozilla; + +class HelperAppLauncherDialog_1_9 : nsIHelperAppLauncherDialog_1_9 { + int refCount = 0; -HelperAppLauncherDialog_1_9 () { - createCOMInterfaces (); +this () { } -int AddRef () { +extern(System) +nsrefcnt 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, 6}) { - 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], (int)/*64*/args[2]);} - public int /*long*/ method4 (int /*long*/[] args) {return PromptForSaveToFile (args[0], args[1], args[2], args[3], (int)/*64*/args[4], args[5]);} - }; -} +extern(System) +nsresult QueryInterface (nsID* riid, void** ppvObject) { + if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; -void disposeCOMInterfaces () { - if (supports !is null) { - supports.dispose (); - supports = null; - } - if (helperAppLauncherDialog !is null) { - helperAppLauncherDialog.dispose (); - helperAppLauncherDialog = null; - } -} - -int /*long*/ getAddress () { - return helperAppLauncherDialog.getAddress (); -} - -int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) { - if (riid is 0 || ppvObject is 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); + if (*riid is nsISupports.IID) { + *ppvObject = cast(void*)cast(nsIHelperAppLauncherDialog_1_9)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIHelperAppLauncherDialog_1_9.NS_IHELPERAPPLAUNCHERDIALOG_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {helperAppLauncherDialog.getAddress ()}, C.PTR_SIZEOF); + if (*riid is nsIHelperAppLauncherDialog_1_9.IID) { + *ppvObject = cast(void*)cast(nsIHelperAppLauncherDialog_1_9)this; AddRef (); return XPCOM.NS_OK; } - XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); + *ppvObject = null; return XPCOM.NS_ERROR_NO_INTERFACE; } - -int Release () { + +extern(System) +nsresult Release () { refCount--; /* * Note. This instance lives as long as the download it is bound to. @@ -105,48 +77,54 @@ * cancels the File Dialog, cancels or closes the Download Dialog * and when the Download Dialog goes away after the download is completed. */ - if (refCount is 0) disposeCOMInterfaces (); + if (refCount is 0) return 0; return refCount; } /* nsIHelperAppLauncherDialog */ - -int Show (int /*long*/ aLauncher, int /*long*/ aContext, int aReason) { - nsIHelperAppLauncher_1_9 helperAppLauncher = new nsIHelperAppLauncher_1_9 (aLauncher); - return helperAppLauncher.SaveToDisk (0, 0); +extern(System) +nsresult Show (nsIHelperAppLauncher_1_9 aLauncher, nsISupports aContext, PRUint32 aReason) { + return aLauncher.SaveToDisk (null, 0); } -int PromptForSaveToFile (int /*long*/ aLauncher, int /*long*/ aWindowContext, int /*long*/ aDefaultFileName, int /*long*/ aSuggestedFileExtension, int aForcePrompt, int /*long*/ _retval) { - int length = XPCOM.strlen_PRUnichar (aDefaultFileName); - char[] dest = new char[length]; - XPCOM.memmove (dest, aDefaultFileName, length * 2); - String defaultFile = new String (dest); +extern(System) +nsresult PromptForSaveToFile (nsIHelperAppLauncher_1_9 aLauncher, nsISupports aWindowContext, PRUnichar* aDefaultFileName, PRUnichar* aSuggestedFileExtension, PRBool aForcePrompt, nsILocalFile* _retval) { + //int length = XPCOM.strlen_PRUnichar (aDefaultFileName); + //char[] dest = new char[length]; + //XPCOM.memmove (dest, aDefaultFileName, length * 2); + String defaultFile = Utf.toString(fromString16z(aDefaultFileName)); - length = XPCOM.strlen_PRUnichar (aSuggestedFileExtension); - dest = new char[length]; - XPCOM.memmove (dest, aSuggestedFileExtension, length * 2); - String suggestedFileExtension = new String (dest); + //length = XPCOM.strlen_PRUnichar (aSuggestedFileExtension); + //dest = new char[length]; + //XPCOM.memmove (dest, aSuggestedFileExtension, length * 2); + String suggestedFileExtension = Utf.toString(fromString16z(aSuggestedFileExtension)); Shell shell = new Shell (); FileDialog fileDialog = new FileDialog (shell, DWT.SAVE); fileDialog.setFileName (defaultFile); - fileDialog.setFilterExtensions (new String[] {suggestedFileExtension}); + String[] tmp; + tmp ~= suggestedFileExtension; + fileDialog.setFilterExtensions (tmp); String name = fileDialog.open (); shell.close (); if (name is null) { - nsIHelperAppLauncher_1_9 launcher = new nsIHelperAppLauncher_1_9 (aLauncher); - int rc = launcher.Cancel (XPCOM.NS_BINDING_ABORTED); - if (rc !is XPCOM.NS_OK) Mozilla.error (rc); + //nsIHelperAppLauncher_1_9 launcher = new nsIHelperAppLauncher_1_9 (aLauncher); + int rc = aLauncher.Cancel (XPCOM.NS_BINDING_ABORTED); + if (rc !is XPCOM.NS_OK) Mozilla.error (rc,__FILE__,__LINE__); return XPCOM.NS_ERROR_FAILURE; } - nsEmbedString path = new nsEmbedString (name); - int /*long*/[] result = new int /*long*/[1]; - int rc = XPCOM.NS_NewLocalFile (path.getAddress (), 1, result); - path.dispose (); - if (rc !is XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] is 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); + scope auto path = new nsEmbedString (name.toString16()); + + nsILocalFile localFile; + int rc = XPCOM.NS_NewLocalFile (cast(nsAString*)path, 1, &localFile); + //path.dispose (); + if (rc !is XPCOM.NS_OK) Mozilla.error (rc,__FILE__,__LINE__); + if (localFile is null) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER,__FILE__,__LINE__); /* Our own nsIDownload has been registered during the Browser initialization. It will be invoked by Mozilla. */ - XPCOM.memmove (_retval, result, C.PTR_SIZEOF); + *_retval = localFile; + //XPCOM.memmove (_retval, result, C.PTR_SIZEOF); return XPCOM.NS_OK; } } + +
--- a/dwt/browser/InputStream.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/InputStream.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * 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 @@ -7,20 +7,23 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Port to the D programming language: + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.InputStream; +import Math = tango.math.Math; import dwt.dwthelper.utils; -import dwt.internal.C; -import dwt.internal.mozilla.XPCOM; -import dwt.internal.mozilla.XPCOMObject; +import XPCOM = dwt.internal.mozilla.XPCOM; + import dwt.internal.mozilla.nsID; import dwt.internal.mozilla.nsIInputStream; import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.Common; -class InputStream { - XPCOMObject inputStream; +class InputStream : nsIInputStream { + //XPCOMObject inputStream; int refCount = 0; byte[] buffer; @@ -29,107 +32,94 @@ this (byte[] buffer) { this.buffer = buffer; index = 0; - createCOMInterfaces (); } -int AddRef () { +extern(System) +nsrefcnt 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], cast(int)/*64*/args[1], args[2]);} - public int /*long*/ method6 (int /*long*/[] args) {return ReadSegments (args[0], args[1], cast(int)/*64*/args[2], args[3]);} - public int /*long*/ method7 (int /*long*/[] args) {return IsNonBlocking (args[0]);} - }; -} - -void disposeCOMInterfaces () { - if (inputStream !is null) { - inputStream.dispose (); - inputStream = null; - } -} - -int /*long*/ getAddress () { - return inputStream.getAddress (); -} - -int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) { - if (riid is 0 || ppvObject is 0) return XPCOM.NS_ERROR_NO_INTERFACE; - nsID guid = new nsID (); - XPCOM.memmove (guid, riid, nsID.sizeof); +extern(System) +nsresult QueryInterface (nsID* riid, void** ppvObject) { + if (riid is null || ppvObject is null) 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); + if (*riid == nsISupports.IID) { + *ppvObject = cast(void*)cast(nsISupports)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIInputStream.NS_IINPUTSTREAM_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {inputStream.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIInputStream.IID) { + *ppvObject = cast(void*)cast(nsIInputStream)this; AddRef (); return XPCOM.NS_OK; } - XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); + *ppvObject = null; return XPCOM.NS_ERROR_NO_INTERFACE; } - -int Release () { + +extern(System) +nsrefcnt Release () { refCount--; - if (refCount is 0) disposeCOMInterfaces (); + //if (refCount is 0) disposeCOMInterfaces (); return refCount; } - + /* nsIInputStream implementation */ -int Close () { +extern(System) +nsresult Close () { buffer = null; index = 0; return XPCOM.NS_OK; } -int Available (int /*long*/ _retval) { - int available = buffer is null ? 0 : buffer.length - index; - XPCOM.memmove (_retval, new int[] {available}, 4); +extern(System) +nsresult Available (PRUint32* _retval) { + PRUint32 available = buffer is null ? 0 : buffer.length - index; + *_retval = available; + //XPCOM.memmove (_retval, new int[] {available}, 4); return XPCOM.NS_OK; } -int Read(int /*long*/ aBuf, int aCount, int /*long*/ _retval) { +extern(System) +nsresult Read(byte* aBuf, PRUint32 aCount, PRUint32* _retval) { int max = Math.min (aCount, buffer is null ? 0 : buffer.length - index); + if (aBuf is null) + assert(0); if (max > 0) { - byte[] src = new byte[max]; - System.arraycopy (buffer, index, src, 0, max); - XPCOM.memmove (aBuf, src, max); + //byte[] src = new byte[max]; + //System.arraycopy (buffer, index, src, 0, max); + //XPCOM.memmove (aBuf, src, max); + aBuf[0..max] = buffer[index..$]; index += max; } - XPCOM.memmove(_retval, new int[] {max}, 4); + *_retval = max; return XPCOM.NS_OK; } -int ReadSegments (int /*long*/ aWriter, int /*long*/ aClosure, int aCount, int /*long*/ _retval) { +extern(System) +nsresult ReadSegments (nsWriteSegmentFun aWriter, void* aClosure, PRUint32 aCount, PRUint32* _retval) { int max = Math.min (aCount, buffer is null ? 0 : buffer.length - index); - int cnt = max; + PRUint32 cnt = max; while (cnt > 0) { - int[] aWriteCount = new int[1]; - int /*long*/ rc = XPCOM.Call (aWriter, getAddress (), aClosure, buffer, index, cnt, aWriteCount); + PRUint32 aWriteCount; + nsresult rc = aWriter (cast(nsIInputStream)this, aClosure, buffer.ptr, index, cnt, &aWriteCount); if (rc !is XPCOM.NS_OK) break; - index += aWriteCount[0]; - cnt -= aWriteCount[0]; + index += aWriteCount; + cnt -= aWriteCount; } - XPCOM.memmove (_retval, new int[] {max - cnt}, 4); + //XPCOM.memmove (_retval, new int[] {max - cnt}, 4); + *_retval = (max - cnt); return XPCOM.NS_OK; } -int IsNonBlocking (int /*long*/ _retval) { +extern(System) +nsresult IsNonBlocking (PRBool* _retval) { /* blocking */ - XPCOM.memmove (_retval, new int[] {0}, 4); + *_retval = 0; return XPCOM.NS_OK; } }
--- a/dwt/browser/LocationAdapter.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/LocationAdapter.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,5 +1,5 @@ -/******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. +/******************************************************************************* + * Copyright (c) 2003, 2004 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 @@ -7,15 +7,13 @@ * * Contributors: * IBM Corporation - initial API and implementation - * * Port to the D programming language: - * Jacob Carlborg <doob@me.com> + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.LocationAdapter; import dwt.browser.LocationListener; import dwt.browser.LocationEvent; -import dwt.dwthelper.utils; /** * This adapter class provides default implementations for the @@ -26,8 +24,6 @@ * interested in. * </p> * - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * * @since 3.0 */ public abstract class LocationAdapter : LocationListener {
--- a/dwt/browser/LocationEvent.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/LocationEvent.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,5 +1,5 @@ -/******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. +/******************************************************************************* + * Copyright (c) 2003, 2004 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 @@ -7,16 +7,16 @@ * * Contributors: * IBM Corporation - initial API and implementation - * * Port to the D programming language: - * Jacob Carlborg <doob@me.com> + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.LocationEvent; +import tango.text.convert.Format; + import dwt.events.TypedEvent; import dwt.widgets.Widget; - -import dwt.dwthelper.string; +import dwt.dwthelper.utils; /** * A <code>LocationEvent</code> is sent by a {@link Browser} to @@ -26,20 +26,18 @@ * {@link Browser#setUrl(String)} or when the user activates a * hyperlink. * - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * * @since 3.0 */ public class LocationEvent : TypedEvent { /** current location */ public String location; - + /** * A flag indicating whether the location opens in the top frame * or not. */ public bool top; - + /** * A flag indicating whether the location loading should be allowed. * Setting this field to <code>false</code> will cancel the operation. @@ -47,20 +45,19 @@ public bool doit; static final long serialVersionUID = 3906644198244299574L; - -this (Widget w) { + +this(Widget w) { super(w); } /** - * Returns a String containing a concise, human-readable + * Returns a string containing a concise, human-readable * description of the receiver. * - * @return a String representation of the event + * @return a string representation of the event */ -public String toString () { - String str = super.toString(); - return str.substring(0, str.length() - 1) // remove trailing '}' - + " location=" + location + " top=" + top + " doit=" + doit + "}"; +public override String toString() { + return Format( "{} {location = {}, top = {}, doit = {}}", + super.toString[1 .. $-2], location, top, doit ); } }
--- a/dwt/browser/LocationListener.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/LocationListener.d Fri Jan 16 12:49:08 2009 +0100 @@ -7,14 +7,13 @@ * * Contributors: * IBM Corporation - initial API and implementation - * * Port to the D programming language: - * Jacob Carlborg <doob@me.com> + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.LocationListener; +import dwt.internal.DWTEventListener; import dwt.browser.LocationEvent; -import dwt.internal.DWTEventListener; /** * This listener interface may be implemented in order to receive @@ -28,42 +27,42 @@ */ public interface LocationListener : DWTEventListener { - /** - * This method is called when the current location is about to be changed. - * <p> - * - * <p>The following fields in the <code>LocationEvent</code> apply: - * <ul> - * <li>(in) location the location to be loaded - * <li>(in) widget the <code>Browser</code> whose location is changing - * <li>(in/out) doit can be set to <code>false</code> to prevent the location - * from being loaded - * </ul> - * - * @param event the <code>LocationEvent</code> that specifies the location - * to be loaded by a <code>Browser</code> - * - * @since 3.0 - */ - public void changing (LocationEvent event); +/** + * This method is called when the current location is about to be changed. + * <p> + * + * <p>The following fields in the <code>LocationEvent</code> apply: + * <ul> + * <li>(in) location the location to be loaded + * <li>(in) widget the <code>Browser</code> whose location is changing + * <li>(in/out) doit can be set to <code>false</code> to prevent the location + * from being loaded + * </ul> + * + * @param event the <code>LocationEvent</code> that specifies the location + * to be loaded by a <code>Browser</code> + * + * @since 3.0 + */ +public void changing(LocationEvent event); - /** - * This method is called when the current location is changed. - * <p> - * - * <p>The following fields in the <code>LocationEvent</code> apply: - * <ul> - * <li>(in) location the current location - * <li>(in) top <code>true</code> if the location opens in the top frame or - * <code>false</code> otherwise - * <li>(in) widget the <code>Browser</code> whose location has changed - * </ul> - * - * @param event the <code>LocationEvent</code> that specifies the new - * location of a <code>Browser</code> - * - * @since 3.0 - */ - public void changed (LocationEvent event); +/** + * This method is called when the current location is changed. + * <p> + * + * <p>The following fields in the <code>LocationEvent</code> apply: + * <ul> + * <li>(in) location the current location + * <li>(in) top <code>true</code> if the location opens in the top frame or + * <code>false</code> otherwise + * <li>(in) widget the <code>Browser</code> whose location has changed + * </ul> + * + * @param event the <code>LocationEvent</code> that specifies the new + * location of a <code>Browser</code> + * + * @since 3.0 + */ +public void changed(LocationEvent event); }
--- a/dwt/browser/Mozilla.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/Mozilla.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,5 +1,5 @@ -/******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. +/******************************************************************************* + * 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 @@ -7,30 +7,54 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Port to the D programming language: + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.Mozilla; import dwt.dwthelper.utils; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Enumeration; -import java.util.Locale; -import java.util.Vector; +import tango.text.locale.Core; +import tango.io.Stdout; +import tango.text.convert.Format; +import tango.io.Console; +import tango.sys.Environment; +import tango.stdc.string; + +import dwt.internal.c.gtk; import dwt.DWT; import dwt.DWTError; import dwt.graphics.Device; import dwt.graphics.Point; import dwt.graphics.Rectangle; -import dwt.internal.C; + +import dwt.browser.Browser; +import dwt.browser.WebBrowser; +import dwt.browser.MozillaDelegate; +import dwt.browser.AppFileLocProvider; +import dwt.browser.WindowCreator2; +import dwt.browser.PromptService2Factory; +import dwt.browser.HelperAppLauncherDialogFactory; +import dwt.browser.DownloadFactory; +import dwt.browser.DownloadFactory_1_8; +import dwt.browser.FilePickerFactory; +import dwt.browser.FilePickerFactory_1_8; +import dwt.browser.InputStream; +import dwt.browser.StatusTextEvent; +import dwt.browser.ProgressEvent; +import dwt.browser.LocationEvent; +import dwt.browser.WindowEvent; +import dwt.browser.TitleEvent; + import dwt.internal.Compatibility; import dwt.internal.LONG; import dwt.internal.Library; -import dwt.internal.mozilla.XPCOM; -import dwt.internal.mozilla.XPCOMObject; + +import XPCOM = dwt.internal.mozilla.XPCOM; +import XPCOMInit = dwt.internal.mozilla.XPCOMInit; + +import dwt.internal.mozilla.Common; import dwt.internal.mozilla.nsEmbedString; import dwt.internal.mozilla.nsIAppShell; import dwt.internal.mozilla.nsIBaseWindow; @@ -41,7 +65,9 @@ import dwt.internal.mozilla.nsICookie; import dwt.internal.mozilla.nsICookieManager; import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsIDOMNode; import dwt.internal.mozilla.nsIDOMEvent; +import dwt.internal.mozilla.nsIDOMEventListener; import dwt.internal.mozilla.nsIDOMEventTarget; import dwt.internal.mozilla.nsIDOMKeyEvent; import dwt.internal.mozilla.nsIDOMMouseEvent; @@ -49,12 +75,12 @@ import dwt.internal.mozilla.nsIDOMSerializer_1_7; import dwt.internal.mozilla.nsIDOMWindow; import dwt.internal.mozilla.nsIDOMWindowCollection; +import dwt.internal.mozilla.nsIDOMDocument; import dwt.internal.mozilla.nsIDirectoryService; import dwt.internal.mozilla.nsIDocShell; -import dwt.internal.mozilla.nsIDocShell_1_8; -import dwt.internal.mozilla.nsIDocShell_1_9; import dwt.internal.mozilla.nsIEmbeddingSiteWindow; import dwt.internal.mozilla.nsIFile; +import dwt.internal.mozilla.nsIFactory; import dwt.internal.mozilla.nsIIOService; import dwt.internal.mozilla.nsIInterfaceRequestor; import dwt.internal.mozilla.nsIJSContextStack; @@ -64,10 +90,11 @@ import dwt.internal.mozilla.nsIPrefLocalizedString; import dwt.internal.mozilla.nsIPrefService; import dwt.internal.mozilla.nsIProperties; +import dwt.internal.mozilla.nsIRequest; import dwt.internal.mozilla.nsIServiceManager; import dwt.internal.mozilla.nsISimpleEnumerator; +import dwt.internal.mozilla.nsIStreamListener; import dwt.internal.mozilla.nsISupports; -import dwt.internal.mozilla.nsISupportsWeakReference; import dwt.internal.mozilla.nsITooltipListener; import dwt.internal.mozilla.nsIURI; import dwt.internal.mozilla.nsIURIContentListener; @@ -81,8 +108,9 @@ import dwt.internal.mozilla.nsIWebProgress; import dwt.internal.mozilla.nsIWebProgressListener; import dwt.internal.mozilla.nsIWindowWatcher; -import dwt.internal.mozilla.init.GREVersionRange; -import dwt.internal.mozilla.init.XPCOMInit; +import dwt.internal.mozilla.nsIWindowCreator; +import dwt.internal.mozilla.nsStringAPI; + import dwt.layout.FillLayout; import dwt.widgets.Composite; import dwt.widgets.Display; @@ -91,34 +119,34 @@ import dwt.widgets.Listener; import dwt.widgets.Menu; import dwt.widgets.Shell; +import dwt.widgets.Control; -class Mozilla : WebBrowser { - int /*long*/ embedHandle; +class Mozilla : WebBrowser, + nsIWeakReference, + nsIWebProgressListener, + nsIWebBrowserChrome, + nsIWebBrowserChromeFocus, + nsIEmbeddingSiteWindow, + nsIInterfaceRequestor, + nsISupportsWeakReference, + nsIContextMenuListener, + nsIURIContentListener, + nsITooltipListener, + nsIDOMEventListener { + + GtkWidget* embedHandle; nsIWebBrowser webBrowser; Object webBrowserObject; - MozillaDelegate delegate; + MozillaDelegate mozDelegate; - /* 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 domEventListener; int chromeFlags = nsIWebBrowserChrome.CHROME_DEFAULT; int refCount, lastKeyCode, lastCharCode; - int /*long*/ request; + nsIRequest request; Point location, size; bool visible, isChild, ignoreDispose, awaitingNavigate; Shell tip = null; Listener listener; - Vector unhookedDOMWindows = new Vector (); + nsIDOMWindow[] unhookedDOMWindows; static nsIAppShell AppShell; static AppFileLocProvider LocationProvider; @@ -151,7 +179,7 @@ static final String PREFERENCE_PROXYTYPE = "network.proxy.type"; //$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_DIR = SEPARATOR_OS + "eclipse" + SEPARATOR_OS; //$NON-NLS-1$ + static String PROFILE_DIR; //= SEPARATOR_OS ~ "eclipse" ~ SEPARATOR_OS; //$NON-NLS-1$ static final String PROFILE_DO_CHANGE = "profile-do-change"; //$NON-NLS-1$ static final String PROPERTY_PROXYPORT = "network.proxy_port"; //$NON-NLS-1$ static final String PROPERTY_PROXYHOST = "network.proxy_host"; //$NON-NLS-1$ @@ -165,160 +193,110 @@ // TEMPORARY CODE static final String GRE_INITIALIZED = "dwt.browser.XULRunnerInitialized"; //$NON-NLS-1$ - static { - MozillaClearSessions = new Runnable () { + this () { + PROFILE_DIR = SEPARATOR_OS ~ "eclipse" ~ SEPARATOR_OS; + MozillaClearSessions = new class() Runnable { public void run () { if (!Initialized) return; - int /*long*/[] result = new int /*long*/[1]; - int rc = XPCOM.NS_GetServiceManager (result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 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 !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); + nsIServiceManager serviceManager; + int rc = XPCOM.NS_GetServiceManager (&serviceManager); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (serviceManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); + + nsICookieManager manager; + rc = serviceManager.GetServiceByContractID (XPCOM.NS_COOKIEMANAGER_CONTRACTID.ptr, &nsICookieManager.IID, cast(void**)&manager); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (manager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); serviceManager.Release (); - nsICookieManager manager = new nsICookieManager (result[0]); - result[0] = 0; - rc = manager.GetEnumerator (result); - if (rc !is XPCOM.NS_OK) error (rc); + nsISimpleEnumerator enumerator; + rc = manager.GetEnumerator (&enumerator); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); manager.Release (); - nsISimpleEnumerator enumerator = new nsISimpleEnumerator (result[0]); - int[] moreElements = new int[1]; /* PRBool */ - rc = enumerator.HasMoreElements (moreElements); - if (rc !is XPCOM.NS_OK) error (rc); - while (moreElements[0] !is 0) { - result[0] = 0; - rc = enumerator.GetNext (result); - if (rc !is XPCOM.NS_OK) error (rc); - nsICookie cookie = new nsICookie (result[0]); - long[] expires = new long[1]; - rc = cookie.GetExpires (expires); - if (expires[0] is 0) { + PRBool moreElements; + rc = enumerator.HasMoreElements (&moreElements); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + while (moreElements !is 0) { + nsICookie cookie; + rc = enumerator.GetNext (cast(nsISupports*)&cookie); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + PRUint64 expires; + rc = cookie.GetExpires (&expires); + if (expires is 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, 0); - XPCOM.nsEmbedCString_delete (domain); - XPCOM.nsEmbedCString_delete (name); - XPCOM.nsEmbedCString_delete (path); - if (rc !is XPCOM.NS_OK) error (rc); + scope auto domain = new nsEmbedCString; + scope auto name = new nsEmbedCString; + scope auto path = new nsEmbedCString; + cookie.GetHost (cast(nsACString*)domain); + cookie.GetName (cast(nsACString*)name); + cookie.GetPath (cast(nsACString*)path); + rc = manager.Remove (cast(nsACString*)domain, cast(nsACString*)name, cast(nsACString*)path, 0); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); } cookie.Release (); - rc = enumerator.HasMoreElements (moreElements); - if (rc !is XPCOM.NS_OK) error (rc); + rc = enumerator.HasMoreElements (&moreElements); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); } enumerator.Release (); } }; } +extern(D) public void create (Composite parent, int style) { - delegate = new MozillaDelegate (browser); - final Display display = parent.getDisplay (); + mozDelegate = new MozillaDelegate (super.browser); + Display display = parent.getDisplay (); - int /*long*/[] result = new int /*long*/[1]; if (!Initialized) { bool initLoaded = false; bool IsXULRunner = false; - String greInitialized = System.getProperty cast(GRE_INITIALIZED); - if ("true".equals (greInitialized)) { //$NON-NLS-1$ + String greInitialized = System.getProperty (GRE_INITIALIZED); + if ("true" == greInitialized) { //$NON-NLS-1$ /* * Another browser has already initialized xulrunner in this process, * so just bind to it instead of trying to initialize a new one. */ Initialized = true; } - - String mozillaPath = System.getProperty cast(XULRUNNER_PATH); - /* - * Browser clients that ship XULRunner in a plug-in must have an opportunity - * to set the dwt.browser.XULRunnerPath system property to point - * at their XULRunner before the first Mozilla-based Browser is created. To - * facilitate this, reflection is used to reference non-existent class - * dwt.browser.XULRunnerInitializer the first time a Mozilla- - * based Browser is created. A client wishing to use this hook can do so - * by creating a fragment of dwt that implements this class and - * sets the system property in its static initializer. - */ + String mozillaPath = System.getProperty (XULRUNNER_PATH); if (mozillaPath is null) { - try { - Class.forName ("dwt.browser.XULRunnerInitializer"); //$NON-NLS-1$ - mozillaPath = System.getProperty cast(XULRUNNER_PATH); - } catch (ClassNotFoundException e) { - /* no fragment is providing this class, which is the typical case */ - } - } - - if (mozillaPath is null) { - try { - String libName = delegate.getSWTInitLibraryName (); - Library.loadLibrary (libName); - initLoaded = true; - } catch (UnsatisfiedLinkError e) { - /* - * If this library 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. - */ - } + // we don't need to load an initial library in D, so set to "true" + initLoaded = true; } else { - mozillaPath += SEPARATOR_OS + delegate.getLibraryName (); + mozillaPath ~= SEPARATOR_OS ~ mozDelegate.getLibraryName (); IsXULRunner = true; } - + 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; + XPCOMInit.GREVersionRange range; + + range.lower = GRERANGE_LOWER.ptr; 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.upper = GRERANGE_UPPER.ptr; 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); + char[] greBuffer = new char[XPCOMInit.PATH_MAX]; + + int rc = XPCOMInit.GRE_GetGREPathWithProperties (&range, 1, null, 0, greBuffer.ptr, greBuffer.length); /* * A XULRunner was not found that supports wrapping of XPCOM handles as JavaXPCOM objects. * Drop the lower version bound and try to detect an earlier XULRunner installation. */ + if (rc !is XPCOM.NS_OK) { - C.free (lower); - bytes = MozillaDelegate.wcsToMbcs (null, GRERANGE_LOWER_FALLBACK, true); - lower = C.malloc (bytes.length); - C.memmove (lower, bytes, bytes.length); - range.lower = lower; - rc = XPCOMInit.GRE_GetGREPathWithProperties (range, 1, propertiesPtr, 0, greBuffer, length); + range.lower = GRERANGE_LOWER_FALLBACK.ptr; + rc = XPCOMInit.GRE_GetGREPathWithProperties (&range, 1, null, 0, greBuffer.ptr, greBuffer.length); } - C.free (lower); - C.free (upper); - C.free (propertiesPtr); if (rc is 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)); - IsXULRunner = mozillaPath.length () > 0; + mozillaPath = greBuffer; + IsXULRunner = mozillaPath.length > 0; /* * Test whether the detected XULRunner can be used as the GRE before loading swt's @@ -328,36 +306,34 @@ * One case where this will fail is attempting to use a 64-bit xulrunner while swt * is running in 32-bit mode, or vice versa. */ + if (IsXULRunner) { - byte[] path = MozillaDelegate.wcsToMbcs (null, mozillaPath, true); - rc = XPCOMInit.XPCOMGlueStartup (path); + rc = XPCOMInit.XPCOMGlueStartup (mozillaPath.ptr); if (rc !is XPCOM.NS_OK) { - mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf cast(SEPARATOR_OS)); - if (Device.DEBUG) System.out.println ("cannot use detected XULRunner: " + mozillaPath); //$NON-NLS-1$ + mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf (SEPARATOR_OS)); + if (Device.DEBUG) Cerr ("cannot use detected XULRunner: ") (mozillaPath).newline; //$NON-NLS-1$ + + /* attempt to XPCOMGlueStartup the GRE pointed at by MOZILLA_FIVE_HOME */ + auto ptr = Environment.get(XPCOM.MOZILLA_FIVE_HOME); - /* attempt to XPCOMGlueStartup the GRE pointed at by MOZILLA_FIVE_HOME */ - int /*long*/ ptr = C.getenv (MozillaDelegate.wcsToMbcs (null, XPCOM.MOZILLA_FIVE_HOME, true)); - if (ptr is 0) { + if (ptr is null) { IsXULRunner = false; } else { - length = C.strlen (ptr); - byte[] buffer = new byte[length]; - C.memmove (buffer, ptr, length); - mozillaPath = new String (MozillaDelegate.mbcsToWcs (null, buffer)); + mozillaPath = ptr; /* * Attempting to XPCOMGlueStartup a mozilla-based GRE !is xulrunner can * crash, so don't attempt unless the GRE appears to be xulrunner. */ if (mozillaPath.indexOf("xulrunner") is -1) { //$NON-NLS-1$ IsXULRunner = false; + } else { - mozillaPath += SEPARATOR_OS + delegate.getLibraryName (); - path = MozillaDelegate.wcsToMbcs (null, mozillaPath, true); - rc = XPCOMInit.XPCOMGlueStartup (path); + mozillaPath ~= SEPARATOR_OS ~ mozDelegate.getLibraryName (); + rc = XPCOMInit.XPCOMGlueStartup (toStringz(mozillaPath)); if (rc !is XPCOM.NS_OK) { IsXULRunner = false; mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf (SEPARATOR_OS)); - if (Device.DEBUG) System.out.println ("failed to start as XULRunner: " + mozillaPath); //$NON-NLS-1$ + if (Device.DEBUG) Cerr ("failed to start as XULRunner: " )(mozillaPath).newline; //$NON-NLS-1$ } } } @@ -367,50 +343,36 @@ } } } - C.free (greBuffer); } if (IsXULRunner) { - if (Device.DEBUG) System.out.println ("XULRunner path: " + mozillaPath); //$NON-NLS-1$ - try { - Library.loadLibrary ("swt-xulrunner"); //$NON-NLS-1$ - } catch (UnsatisfiedLinkError e) { - DWT.error (DWT.ERROR_NO_HANDLES, e); - } - byte[] path = MozillaDelegate.wcsToMbcs (null, mozillaPath, true); - int rc = XPCOM.XPCOMGlueStartup (path); - if (rc !is XPCOM.NS_OK) { - browser.dispose (); - error (rc); - } + if (Device.DEBUG) Cerr ("XULRunner path: ") (mozillaPath).newline; //$NON-NLS-1$ + XPCOMWasGlued = true; /* * Remove the trailing xpcom lib name from mozillaPath because the * Mozilla.initialize and NS_InitXPCOM2 invocations require a directory name only. - */ - mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf cast(SEPARATOR_OS)); + */ + mozillaPath = mozillaPath.substring (0, mozillaPath.lastIndexOf (SEPARATOR_OS)); } else { if ((style & DWT.MOZILLA) !is 0) { browser.dispose (); - String errorString = (mozillaPath !is null && mozillaPath.length () > 0) ? - " [Failed to use detected XULRunner: " + mozillaPath + "]" : + String errorString = (mozillaPath !is null && mozillaPath.length > 0) ? + " [Failed to use detected XULRunner: " ~ mozillaPath ~ "]" : " [Could not detect registered XULRunner to use]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ DWT.error (DWT.ERROR_NO_HANDLES, null, errorString); } /* 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 !is 0) { - int length = C.strlen (ptr); - byte[] buffer = new byte[length]; - C.memmove (buffer, ptr, length); - mozillaPath = new String (MozillaDelegate.mbcsToWcs (null, buffer)); + auto mozFiveHome = Environment.get(XPCOM.MOZILLA_FIVE_HOME); + if (mozFiveHome !is null) { + mozillaPath = mozFiveHome; } else { browser.dispose (); DWT.error (DWT.ERROR_NO_HANDLES, null, " [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)]"); //$NON-NLS-1$ } - if (Device.DEBUG) System.out.println ("Mozilla path: " + mozillaPath); //$NON-NLS-1$ + if (Device.DEBUG) Cerr ("Mozilla path: ") (mozillaPath).newline; //$NON-NLS-1$ /* * Note. Embedding a Mozilla GTK1.2 causes a crash. The workaround @@ -422,38 +384,17 @@ browser.dispose (); DWT.error (DWT.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. - */ - DWT.error (DWT.ERROR_NO_HANDLES, e, " [MOZILLA_FIVE_HOME='" + mozillaPath + "']"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } } if (!Initialized) { - int /*long*/[] retVal = new int /*long*/[1]; - nsEmbedString pathString = new nsEmbedString (mozillaPath); - int rc = XPCOM.NS_NewLocalFile (pathString.getAddress (), 1, retVal); - pathString.dispose (); + nsILocalFile localFile; + scope auto pathString = new nsEmbedString (mozillaPath.toString16()); + nsresult rc = XPCOM.NS_NewLocalFile (cast(nsAString*)pathString, 1, &localFile); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } - if (retVal[0] is 0) { + if (localFile is null) { browser.dispose (); error (XPCOM.NS_ERROR_NULL_POINTER); } @@ -461,12 +402,18 @@ LocationProvider = new AppFileLocProvider (mozillaPath); LocationProvider.AddRef (); - nsIFile localFile = new nsILocalFile (retVal[0]); - rc = XPCOM.NS_InitXPCOM2 (0, localFile.getAddress(), LocationProvider.getAddress ()); + nsIDirectoryServiceProvider directoryServiceProvider; + rc = LocationProvider.QueryInterface( &nsIDirectoryServiceProvider.IID, cast(void**)&directoryServiceProvider); + if (rc !is XPCOM.NS_OK) { + browser.dispose(); + error(rc); + } + rc = XPCOM.NS_InitXPCOM2 (null, cast(nsIFile)localFile, directoryServiceProvider); localFile.Release (); + LocationProvider.Release(); if (rc !is XPCOM.NS_OK) { browser.dispose (); - DWT.error (DWT.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$ + DWT.error (DWT.ERROR_NO_HANDLES, null, Format(" [MOZILLA_FIVE_HOME may not point at an embeddable GRE] [NS_InitEmbedding {0} error {1} ] ", mozillaPath, rc ) ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } System.setProperty (GRE_INITIALIZED, "true"); //$NON-NLS-1$ if (IsXULRunner) { @@ -474,195 +421,147 @@ } } - /* If JavaXPCOM is detected then attempt to initialize it with the XULRunner being used */ - if (IsXULRunner) { - try { - Class clazz = Class.forName ("org.mozilla.xpcom.Mozilla"); //$NON-NLS-1$ - Method method = clazz.getMethod ("getInstance", new Class[0]); //$NON-NLS-1$ - Object mozilla = method.invoke (null, new Object[0]); - method = clazz.getMethod ("getComponentManager", new Class[0]); //$NON-NLS-1$ - try { - method.invoke (mozilla, new Object[0]); - } catch (InvocationTargetException e) { - /* indicates that JavaXPCOM has not been initialized yet */ - Class fileClass = Class.forName ("java.io.File"); //$NON-NLS-1$ - method = clazz.getMethod ("initialize", new Class[] {fileClass}); //$NON-NLS-1$ - Constructor constructor = fileClass.getDeclaredConstructor (new Class[] {String.class}); - Object argument = constructor.newInstance (new Object[] {mozillaPath}); - method.invoke (mozilla, new Object[] {argument}); - } - } catch (ClassNotFoundException e) { - /* JavaXPCOM is not on the classpath */ - } catch (NoSuchMethodException e) { - /* the JavaXPCOM on the classpath does not implement initialize() */ - } catch (IllegalArgumentException e) { - } catch (IllegalAccessException e) { - } catch (InvocationTargetException e) { - } catch (InstantiationException e) { - } - } - - int rc = XPCOM.NS_GetComponentManager (result); + nsIComponentManager componentManager; + int rc = XPCOM.NS_GetComponentManager (&componentManager); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } - if (result[0] is 0) { + if (componentManager is null) { browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); } - nsIComponentManager componentManager = new nsIComponentManager (result[0]); - result[0] = 0; - if (delegate.needsSpinup ()) { + if (mozDelegate.needsSpinup ()) { /* nsIAppShell is discontinued as of xulrunner 1.9, so do not fail if it is not found */ - rc = componentManager.CreateInstance (XPCOM.NS_APPSHELL_CID, 0, nsIAppShell.NS_IAPPSHELL_IID, result); + rc = componentManager.CreateInstance (&XPCOM.NS_APPSHELL_CID, null, &nsIAppShell.IID, cast(void**)&AppShell); if (rc !is XPCOM.NS_ERROR_NO_INTERFACE) { if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } - if (result[0] is 0) { + if (AppShell is null) { browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); } - AppShell = new nsIAppShell (result[0]); - rc = AppShell.Create (0, null); + rc = AppShell.Create (null, null); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } rc = AppShell.Spinup (); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } } - result[0] = 0; } - WindowCreator = new WindowCreator2 (); + WindowCreator = new WindowCreator2; WindowCreator.AddRef (); - rc = XPCOM.NS_GetServiceManager (result); + nsIServiceManager serviceManager; + rc = XPCOM.NS_GetServiceManager (&serviceManager); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } - if (result[0] is 0) { + if (serviceManager is null) { browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); } - 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); + nsIWindowWatcher windowWatcher; + rc = serviceManager.GetServiceByContractID (XPCOM.NS_WINDOWWATCHER_CONTRACTID.ptr, &nsIWindowWatcher.IID, cast(void**)&windowWatcher); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } - if (result[0] is 0) { + if (windowWatcher is null) { browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); } - nsIWindowWatcher windowWatcher = new nsIWindowWatcher (result[0]); - result[0] = 0; - rc = windowWatcher.SetWindowCreator (WindowCreator.getAddress()); + rc = windowWatcher.SetWindowCreator (cast(nsIWindowCreator)WindowCreator); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } windowWatcher.Release (); - /* compute the profile directory and set it on the AppFileLocProvider */ if (LocationProvider !is null) { - byte[] buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_DIRECTORYSERVICE_CONTRACTID, true); - rc = serviceManager.GetServiceByContractID (buffer, nsIDirectoryService.NS_IDIRECTORYSERVICE_IID, result); + nsIDirectoryService directoryService; + rc = serviceManager.GetServiceByContractID (XPCOM.NS_DIRECTORYSERVICE_CONTRACTID.ptr, &nsIDirectoryService.IID, cast(void**)&directoryService); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } - if (result[0] is 0) { + if (directoryService is null) { browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); } - nsIDirectoryService directoryService = new nsIDirectoryService (result[0]); - result[0] = 0; - rc = directoryService.QueryInterface (nsIProperties.NS_IPROPERTIES_IID, result); + nsIProperties properties; + rc = directoryService.QueryInterface (&nsIProperties.IID, cast(void**)&properties); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } - if (result[0] is 0) { + if (properties is null) { browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); } 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); + nsIFile profileDir; + rc = properties.Get (XPCOM.NS_APP_APPLICATION_REGISTRY_DIR.ptr, &nsIFile.IID, cast(void**)&profileDir); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } - if (result[0] is 0) { + if (profileDir is null) { browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); } properties.Release (); - nsIFile profileDir = new nsIFile (result[0]); - result[0] = 0; - int /*long*/ path = XPCOM.nsEmbedCString_new (); - rc = profileDir.GetNativePath (path); + scope auto path = new nsEmbedCString; + rc = profileDir.GetNativePath (cast(nsACString*)path); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } - int length = XPCOM.nsEmbedCString_Length (path); - int /*long*/ ptr = XPCOM.nsEmbedCString_get (path); - buffer = new byte [length]; - XPCOM.memmove (buffer, ptr, length); - String profilePath = new String (MozillaDelegate.mbcsToWcs (null, buffer)) + PROFILE_DIR; + + String profilePath = path.toString() ~ PROFILE_DIR; LocationProvider.setProfilePath (profilePath); LocationProvider.isXULRunner = IsXULRunner; - XPCOM.nsEmbedCString_delete (path); + profileDir.Release (); /* notify observers of a new profile directory being used */ - buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_OBSERVER_CONTRACTID, true); - rc = serviceManager.GetServiceByContractID (buffer, nsIObserverService.NS_IOBSERVERSERVICE_IID, result); + nsIObserverService observerService; + rc = serviceManager.GetServiceByContractID (XPCOM.NS_OBSERVER_CONTRACTID.ptr, &nsIObserverService.IID, cast(void**)&observerService); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } - if (result[0] is 0) { + if (observerService is null) { browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); } - nsIObserverService observerService = new nsIObserverService (result[0]); - result[0] = 0; - buffer = MozillaDelegate.wcsToMbcs (null, PROFILE_DO_CHANGE, true); - length = STARTUP.length (); - char[] chars = new char [length + 1]; - STARTUP.getChars (0, length, chars, 0); - rc = observerService.NotifyObservers (0, buffer, chars); + wchar* chars = STARTUP.toString16().toString16z(); + rc = observerService.NotifyObservers (null, PROFILE_DO_CHANGE.ptr, chars); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } - buffer = MozillaDelegate.wcsToMbcs (null, PROFILE_AFTER_CHANGE, true); - rc = observerService.NotifyObservers (0, buffer, chars); + + rc = observerService.NotifyObservers (null, PROFILE_AFTER_CHANGE.ptr, chars); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } observerService.Release (); } @@ -672,40 +571,37 @@ * 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); + + nsIPrefService prefService; + rc = serviceManager.GetServiceByContractID (XPCOM.NS_PREFSERVICE_CONTRACTID.ptr, &nsIPrefService.IID, cast(void**)&prefService); serviceManager.Release (); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } - if (result[0] is 0) { + if (serviceManager is null) { browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); } - nsIPrefService prefService = new nsIPrefService (result[0]); - result[0] = 0; - byte[] buffer = new byte[1]; - rc = prefService.GetBranch (buffer, result); /* empty buffer denotes root preference level */ + char[1] buffer = new char[1]; + nsIPrefBranch prefBranch; + rc = prefService.GetBranch (buffer.ptr, &prefBranch); /* empty buffer denotes root preference level */ prefService.Release (); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } - if (result[0] is 0) { + if (prefBranch is null) { browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); } - 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); + //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_LANGUAGES, true); + rc = prefBranch.GetComplexValue (PREFERENCE_LANGUAGES.ptr, &nsIPrefLocalizedString.IID, cast(void**)&localizedString); /* * 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 @@ -713,44 +609,41 @@ * a profile. */ if (rc !is XPCOM.NS_OK) { - prefLocales = "en-us,en" + TOKENIZER_LOCALE; //$NON-NLS-1$ + prefLocales = "en-us,en" ~ TOKENIZER_LOCALE; //$NON-NLS-1$ } else { - if (result[0] is 0) { + if (localizedString is null) { browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); } - localizedString = new nsIPrefLocalizedString (result[0]); - result[0] = 0; - rc = localizedString.ToString (result); + PRUnichar* tmpChars; + rc = localizedString.ToString (&tmpChars); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); - } - if (result[0] is 0) { - browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (rc, __FILE__, __LINE__); } - int length = XPCOM.strlen_PRUnichar (result[0]); - char[] dest = new char[length]; - XPCOM.memmove (dest, result[0], length * 2); - prefLocales = new String (dest) + TOKENIZER_LOCALE; + if (tmpChars is null) { + browser.dispose (); + error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); + } + int span = XPCOM.strlen_PRUnichar (tmpChars); + prefLocales = Utf.toString(tmpChars[0 .. span]) ~ 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 cast(SEPARATOR_LOCALE); - stringBuffer.append (country.toLowerCase ()); - stringBuffer.append cast(TOKENIZER_LOCALE); - stringBuffer.append (language); - stringBuffer.append cast(TOKENIZER_LOCALE); - String newLocales = stringBuffer.toString (); + + String language = Culture.current.twoLetterLanguageName (); + String country = Region.current.twoLetterRegionName (); + String stringBuffer = language.dup; + + stringBuffer ~= SEPARATOR_LOCALE; + stringBuffer ~= country.toLowerCase (); + stringBuffer ~= TOKENIZER_LOCALE; + stringBuffer ~= language; + stringBuffer ~= TOKENIZER_LOCALE; + String newLocales = stringBuffer.dup; int start, end = -1; do { @@ -763,36 +656,30 @@ token = prefLocales.substring (start, end); } if (token.length () > 0) { - token = (token + TOKENIZER_LOCALE).trim (); + token = (token ~ TOKENIZER_LOCALE).trim (); /* ensure that duplicate locale values are not added */ if (newLocales.indexOf (token) is -1) { - stringBuffer.append (token); + stringBuffer ~= token; } } } while (end !is -1); - newLocales = stringBuffer.toString (); + newLocales[] = stringBuffer[]; if (!newLocales.equals (prefLocales)) { /* write the new locale value */ newLocales = newLocales.substring (0, newLocales.length () - TOKENIZER_LOCALE.length ()); /* remove trailing tokenizer */ - int length = newLocales.length (); - char[] charBuffer = new char[length + 1]; - newLocales.getChars (0, length, charBuffer, 0); if (localizedString is null) { - byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID, true); - rc = componentManager.CreateInstanceByContractID (contractID, 0, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, result); + rc = componentManager.CreateInstanceByContractID (XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID.ptr, null, &nsIPrefLocalizedString.IID, cast(void**)&localizedString); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); - } - if (result[0] is 0) { - browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (rc, __FILE__, __LINE__); } - localizedString = new nsIPrefLocalizedString (result[0]); - result[0] = 0; + if (localizedString is null) { + browser.dispose (); + error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); + } } - localizedString.SetDataWithLength (length, charBuffer); - rc = prefBranch.SetComplexValue (buffer, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, localizedString.getAddress()); + localizedString.SetDataWithLength (newLocales.length, newLocales.toString16().toString16z()); + rc = prefBranch.SetComplexValue (PREFERENCE_LANGUAGES.ptr, &nsIPrefLocalizedString.IID, cast(nsISupports)localizedString); } if (localizedString !is null) { localizedString.Release (); @@ -801,8 +688,7 @@ /* 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); + rc = prefBranch.GetComplexValue (PREFERENCE_CHARSET.ptr, &nsIPrefLocalizedString.IID, cast(void**)&localizedString); /* * 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 @@ -812,50 +698,40 @@ if (rc !is XPCOM.NS_OK) { prefCharset = "ISO-8859-1"; //$NON_NLS-1$ } else { - if (result[0] is 0) { + if (localizedString is null) { browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); } - localizedString = new nsIPrefLocalizedString (result[0]); - result[0] = 0; - rc = localizedString.ToString (result); + PRUnichar* tmpChar; + rc = localizedString.ToString (&tmpChar); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); - } - if (result[0] is 0) { - browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (rc, __FILE__, __LINE__); } - int length = XPCOM.strlen_PRUnichar (result[0]); - char[] dest = new char[length]; - XPCOM.memmove (dest, result[0], length * 2); - prefCharset = new String (dest); + if (tmpChar is null) { + browser.dispose (); + error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); + } + int span = XPCOM.strlen_PRUnichar (tmpChar); + prefCharset = Utf.toString(tmpChar[0 .. span]); } - result[0] = 0; String newCharset = System.getProperty ("file.encoding"); // $NON-NLS-1$ if (!newCharset.equals (prefCharset)) { /* write the new charset value */ - int length = newCharset.length (); - char[] charBuffer = new char[length + 1]; - newCharset.getChars (0, length, charBuffer, 0); if (localizedString is null) { - byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID, true); - rc = componentManager.CreateInstanceByContractID (contractID, 0, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, result); + rc = componentManager.CreateInstanceByContractID (XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID.ptr, null, &nsIPrefLocalizedString.IID, cast(void**)&localizedString); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); - } - if (result[0] is 0) { - browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (rc, __FILE__, __LINE__); } - localizedString = new nsIPrefLocalizedString (result[0]); - result[0] = 0; + if (localizedString is null) { + browser.dispose (); + error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); + } } - localizedString.SetDataWithLength (length, charBuffer); - rc = prefBranch.SetComplexValue (buffer, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, localizedString.getAddress ()); + localizedString.SetDataWithLength (newCharset.length, newCharset.toString16().toString16z()); + rc = prefBranch.SetComplexValue (PREFERENCE_CHARSET.ptr, &nsIPrefLocalizedString.IID, cast(nsISupports)localizedString); } if (localizedString !is null) localizedString.Release (); @@ -863,8 +739,11 @@ * Check for proxy values set as documented java properties and update mozilla's * preferences with these values if needed. */ - String proxyHost = System.getProperty cast(PROPERTY_PROXYHOST); - String proxyPortString = System.getProperty cast(PROPERTY_PROXYPORT); + + // NOTE: in dwt, these properties don't exist so both keys will return null + // (which appears to be ok in this situaion) + String proxyHost = System.getProperty (PROPERTY_PROXYHOST); + String proxyPortString = System.getProperty (PROPERTY_PROXYPORT); int port = -1; if (proxyPortString !is null) { @@ -877,46 +756,33 @@ } if (proxyHost !is null) { - byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID, true); - rc = componentManager.CreateInstanceByContractID (contractID, 0, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); + rc = componentManager.CreateInstanceByContractID (XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID.ptr, null, &nsIPrefLocalizedString.IID, cast(void**)&localizedString); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (localizedString is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); - localizedString = new nsIPrefLocalizedString (result[0]); - result[0] = 0; - int length = proxyHost.length (); - char[] charBuffer = new char[length + 1]; - proxyHost.getChars (0, length, charBuffer, 0); - rc = localizedString.SetDataWithLength (length, charBuffer); - if (rc !is XPCOM.NS_OK) error (rc); - buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYHOST_FTP, true); - rc = prefBranch.SetComplexValue (buffer, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, localizedString.getAddress ()); - if (rc !is XPCOM.NS_OK) error (rc); - buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYHOST_HTTP, true); - rc = prefBranch.SetComplexValue (buffer, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, localizedString.getAddress ()); - if (rc !is XPCOM.NS_OK) error (rc); - buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYHOST_SSL, true); - rc = prefBranch.SetComplexValue (buffer, nsIPrefLocalizedString.NS_IPREFLOCALIZEDSTRING_IID, localizedString.getAddress ()); - if (rc !is XPCOM.NS_OK) error (rc); + rc = localizedString.SetDataWithLength (proxyHost.length, proxyHost.toString16().toString16z()); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = prefBranch.SetComplexValue (PREFERENCE_PROXYHOST_FTP.ptr, &nsIPrefLocalizedString.IID, cast(nsISupports)localizedString); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = prefBranch.SetComplexValue (PREFERENCE_PROXYHOST_HTTP.ptr, &nsIPrefLocalizedString.IID, cast(nsISupports)localizedString); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = prefBranch.SetComplexValue (PREFERENCE_PROXYHOST_SSL.ptr, &nsIPrefLocalizedString.IID, cast(nsISupports)localizedString); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); localizedString.Release (); } if (port !is -1) { - buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYPORT_FTP, true); - rc = prefBranch.SetIntPref (buffer, port); - if (rc !is XPCOM.NS_OK) error (rc); - buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYPORT_HTTP, true); - rc = prefBranch.SetIntPref (buffer, port); - if (rc !is XPCOM.NS_OK) error (rc); - buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYPORT_SSL, true); - rc = prefBranch.SetIntPref (buffer, port); - if (rc !is XPCOM.NS_OK) error (rc); + rc = prefBranch.SetIntPref (PREFERENCE_PROXYPORT_FTP.ptr, port); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = prefBranch.SetIntPref (PREFERENCE_PROXYPORT_HTTP.ptr, port); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = prefBranch.SetIntPref (PREFERENCE_PROXYPORT_SSL.ptr, port); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); } if (proxyHost !is null || port !is -1) { - buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYTYPE, true); - rc = prefBranch.SetIntPref (buffer, 1); - if (rc !is XPCOM.NS_OK) error (rc); + rc = prefBranch.SetIntPref (PREFERENCE_PROXYTYPE.ptr, 1); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); } /* @@ -926,19 +792,17 @@ * is responsible for creating the new Browser and Shell in an OpenWindowListener, * they should decide whether the new window is unwelcome or not and act accordingly. */ - buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_DISABLEOPENDURINGLOAD, true); - rc = prefBranch.SetBoolPref (buffer, 0); + rc = prefBranch.SetBoolPref (PREFERENCE_DISABLEOPENDURINGLOAD.ptr, 0); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } /* Ensure that the status text can be set through means like javascript */ - buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_DISABLEWINDOWSTATUSCHANGE, true); - rc = prefBranch.SetBoolPref (buffer, 0); + rc = prefBranch.SetBoolPref (PREFERENCE_DISABLEWINDOWSTATUSCHANGE.ptr, 0); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } prefBranch.Release (); @@ -946,27 +810,27 @@ PromptService2Factory factory = new PromptService2Factory (); factory.AddRef (); - rc = componentManager.QueryInterface (nsIComponentRegistrar.NS_ICOMPONENTREGISTRAR_IID, result); + nsIComponentRegistrar componentRegistrar; + rc = componentManager.QueryInterface (&nsIComponentRegistrar.IID, cast(void**)&componentRegistrar); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } - if (result[0] is 0) { + if (componentRegistrar is null) { browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); } - 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 ()); + String aClassName = "Prompt Service"; + + rc = componentRegistrar.RegisterFactory (&XPCOM.NS_PROMPTSERVICE_CID, aClassName.ptr, XPCOM.NS_PROMPTSERVICE_CONTRACTID.ptr, cast(nsIFactory)factory); + if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } factory.Release (); - + /* * This Download factory will be used if the GRE version is < 1.8. * If the GRE version is 1.8.x then the Download factory that is registered later for @@ -976,23 +840,21 @@ */ 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 ()); + aClassName = "Download"; + rc = componentRegistrar.RegisterFactory (&XPCOM.NS_DOWNLOAD_CID, aClassName.ptr, XPCOM.NS_DOWNLOAD_CONTRACTID.ptr, cast(nsIFactory)downloadFactory); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } downloadFactory.Release (); FilePickerFactory pickerFactory = IsXULRunner ? new FilePickerFactory_1_8 () : 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 ()); + aClassName = "FilePicker"; + rc = componentRegistrar.RegisterFactory (&XPCOM.NS_FILEPICKER_CID, aClassName.ptr, XPCOM.NS_FILEPICKER_CONTRACTID.ptr, cast(nsIFactory)pickerFactory); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } pickerFactory.Release (); @@ -1002,145 +864,62 @@ Initialized = true; } - if (display.getData cast(DISPOSE_LISTENER_HOOKED) is null) { - display.setData (DISPOSE_LISTENER_HOOKED, DISPOSE_LISTENER_HOOKED); - display.addListener (DWT.Dispose, new Listener () { - public void handleEvent (Event event) { - if (BrowserCount > 0) return; /* another display is still active */ - - int /*long*/[] result = new int /*long*/[1]; - int rc = XPCOM.NS_GetServiceManager (result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 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 !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); - - 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 !is XPCOM.NS_OK) error (rc); - observerService.Release (); - - if (LocationProvider !is null) { - String prefsLocation = LocationProvider.profilePath + AppFileLocProvider.PREFERENCES_FILE; - nsEmbedString pathString = new nsEmbedString (prefsLocation); - rc = XPCOM.NS_NewLocalFile (pathString.getAddress (), 1, result); - if (rc !is XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] is 0) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); - pathString.dispose (); - - nsILocalFile localFile = new nsILocalFile (result [0]); - result[0] = 0; - rc = localFile.QueryInterface (nsIFile.NS_IFILE_IID, result); - if (rc !is XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] is 0) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE); - localFile.Release (); - - nsIFile prefFile = new nsIFile (result[0]); - result[0] = 0; - - buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFSERVICE_CONTRACTID, true); - rc = serviceManager.GetServiceByContractID (buffer, nsIPrefService.NS_IPREFSERVICE_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); - - nsIPrefService prefService = new nsIPrefService (result[0]); - result[0] = 0; - rc = prefService.SavePrefFile(prefFile.getAddress ()); - prefService.Release (); - prefFile.Release (); - } - serviceManager.Release (); - - if (XPCOMWasGlued) { - /* - * XULRunner 1.9 can crash on Windows if XPCOMGlueShutdown is invoked here, - * presumably because one or more of its unloaded symbols are referenced when - * this callback returns. The workaround is to delay invoking XPCOMGlueShutdown - * so that its symbols are still available once this callback returns. - */ - display.asyncExec (new Runnable () { - public void run () { - XPCOM.XPCOMGlueShutdown (); - } - }); - XPCOMWasGlued = false; - } - if (XPCOMInitWasGlued) { - XPCOMInit.XPCOMGlueShutdown (); - XPCOMInitWasGlued = false; - } - Initialized = false; - } - }); + if (display.getData (DISPOSE_LISTENER_HOOKED) is null) { + display.setData (DISPOSE_LISTENER_HOOKED, stringcast(DISPOSE_LISTENER_HOOKED)); + display.addListener (DWT.Dispose, dgListener( &handleDisposeEvent, display ) ); } BrowserCount++; - int rc = XPCOM.NS_GetComponentManager (result); + nsIComponentManager componentManager; + int rc = XPCOM.NS_GetComponentManager (&componentManager); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); - } - if (result[0] is 0) { - browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (rc, __FILE__, __LINE__); } - - 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 !is XPCOM.NS_OK) { + if (componentManager is null) { browser.dispose (); - error (rc); - } - if (result[0] is 0) { - browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); } - webBrowser = new nsIWebBrowser (result[0]); - result[0] = 0; - - createCOMInterfaces (); - AddRef (); - - rc = webBrowser.SetContainerWindow (webBrowserChrome.getAddress()); + nsID NS_IWEBBROWSER_CID = { 0xF1EAC761, 0x87E9, 0x11d3, [0xAF, 0x80, 0x00, 0xA0, 0x24, 0xFF, 0xC0, 0x8C] }; //$NON-NLS-1$ + rc = componentManager.CreateInstance (&NS_IWEBBROWSER_CID, null, &nsIWebBrowser.IID, cast(void**)&webBrowser); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); + } + if (webBrowser is null) { + browser.dispose (); + error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); + } + + this.AddRef (); + + rc = webBrowser.SetContainerWindow ( cast(nsIWebBrowserChrome)this ); + if (rc !is XPCOM.NS_OK) { + browser.dispose (); + error (rc, __FILE__, __LINE__); } - rc = webBrowser.QueryInterface (nsIBaseWindow.NS_IBASEWINDOW_IID, result); + nsIBaseWindow baseWindow; + rc = webBrowser.QueryInterface (&nsIBaseWindow.IID, cast(void**)&baseWindow); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } - if (result[0] is 0) { + if (baseWindow is null) { browser.dispose (); - error (XPCOM.NS_ERROR_NO_INTERFACE); + error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); } - 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 (); + embedHandle = mozDelegate.getHandle (); - rc = baseWindow.InitWindow (embedHandle, 0, 0, 0, rect.width, rect.height); + rc = baseWindow.InitWindow (cast(void*)embedHandle, null, 0, 0, rect.width, rect.height); if (rc !is XPCOM.NS_OK) { browser.dispose (); error (XPCOM.NS_ERROR_FAILURE); @@ -1159,27 +938,25 @@ if (!PerformedVersionCheck) { PerformedVersionCheck = true; - - rc = componentManager.QueryInterface (nsIComponentRegistrar.NS_ICOMPONENTREGISTRAR_IID, result); + + nsIComponentRegistrar componentRegistrar; + rc = componentManager.QueryInterface (&nsIComponentRegistrar.IID, cast(void**)&componentRegistrar); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__,__LINE__); } - if (result[0] is 0) { + if (componentRegistrar is null) { browser.dispose (); - error (XPCOM.NS_NOINTERFACE); + error (XPCOM.NS_NOINTERFACE,__FILE__,__LINE__); } - nsIComponentRegistrar componentRegistrar = new nsIComponentRegistrar (result[0]); - result[0] = 0; HelperAppLauncherDialogFactory dialogFactory = new HelperAppLauncherDialogFactory (); dialogFactory.AddRef (); - byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID, true); - byte[] aClassName = MozillaDelegate.wcsToMbcs (null, "Helper App Launcher Dialog", true); //$NON-NLS-1$ - rc = componentRegistrar.RegisterFactory (XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CID, aClassName, aContractID, dialogFactory.getAddress ()); + String aClassName = "Helper App Launcher Dialog"; //$NON-NLS-1$ + rc = componentRegistrar.RegisterFactory (&XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CID, aClassName.ptr, XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID.ptr, cast(nsIFactory)dialogFactory); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc,__FILE__,__LINE__); } dialogFactory.Release (); @@ -1187,24 +964,23 @@ * Check for the availability of the pre-1.8 implementation of nsIDocShell * to determine if the GRE's version is < 1.8. */ - rc = webBrowser.QueryInterface (nsIInterfaceRequestor.NS_IINTERFACEREQUESTOR_IID, result); + nsIInterfaceRequestor interfaceRequestor; + rc = webBrowser.QueryInterface (&nsIInterfaceRequestor.IID, cast(void**)&interfaceRequestor); if (rc !is XPCOM.NS_OK) { browser.dispose (); error (XPCOM.NS_ERROR_FAILURE); } - if (result[0] is 0) { + if (interfaceRequestor is null) { browser.dispose (); - error (XPCOM.NS_ERROR_NO_INTERFACE); + error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); } - nsIInterfaceRequestor interfaceRequestor = new nsIInterfaceRequestor (result[0]); - result[0] = 0; - rc = interfaceRequestor.GetInterface (nsIDocShell.NS_IDOCSHELL_IID, result); - if (rc is XPCOM.NS_OK && result[0] !is 0) { + nsIDocShell docShell; + rc = interfaceRequestor.GetInterface (&nsIDocShell.IID, cast(void**)&docShell); + if (rc is XPCOM.NS_OK && docShell !is null) { IsPre_1_8 = true; - new nsISupports (result[0]).Release (); + docShell.Release (); } - result[0] = 0; /* * A Download factory for contract "Transfer" must be registered iff the GRE's version is 1.8.x. @@ -1216,22 +992,22 @@ * functionality is provided by the GRE. */ if (!IsPre_1_8) { - rc = interfaceRequestor.GetInterface (nsIDocShell_1_8.NS_IDOCSHELL_IID, result); - if (rc is XPCOM.NS_OK && result[0] !is 0) { /* 1.8 */ - new nsISupports (result[0]).Release (); - result[0] = 0; - + nsIDocShell_1_8 docShell_1_8; + rc = interfaceRequestor.GetInterface (&nsIDocShell_1_8.IID, cast(void**)&docShell_1_8); + if (rc is XPCOM.NS_OK && docShell_1_8 !is null) { /* 1.8 */ + docShell_1_8.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 ()); + + aClassName = "Transfer"; //$NON-NLS-1$ + rc = componentRegistrar.RegisterFactory (&XPCOM.NS_DOWNLOAD_CID, aClassName.ptr, XPCOM.NS_TRANSFER_CONTRACTID.ptr, cast(nsIFactory)downloadFactory_1_8); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); } downloadFactory_1_8.Release (); - } else { /* >= 1.9 */ + } else { /* >= 1.9 */ /* * Bug in XULRunner 1.9. Mozilla no longer clears its background before initial content has * been set. As a result embedders appear broken if they do not immediately navigate to a url. @@ -1241,46 +1017,149 @@ * normal. The Mozilla bug for this is https://bugzilla.mozilla.org/show_bug.cgi?id=415789. */ awaitingNavigate = true; - rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result); + nsIWebNavigation webNavigation; + rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); - } - if (result[0] is 0) { - browser.dispose (); - error (XPCOM.NS_ERROR_NO_INTERFACE); + error (rc, __FILE__, __LINE__); } - nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); - char[] uri = new char[ABOUT_BLANK.length () + 1]; - ABOUT_BLANK.getChars (0, ABOUT_BLANK.length (), uri, 0); - rc = webNavigation.LoadURI (uri, nsIWebNavigation.LOAD_FLAGS_NONE, 0, 0, 0); + if (webNavigation is null) { + browser.dispose (); + error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); + } + rc = webNavigation.LoadURI (ABOUT_BLANK.toString16().toString16z(), nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null); webNavigation.Release (); - dialogFactory.isPre_1_9 = false; } } - result[0] = 0; interfaceRequestor.Release (); componentRegistrar.Release (); } componentManager.Release (); - rc = webBrowser.AddWebBrowserListener (weakReference.getAddress (), nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID); + rc = webBrowser.AddWebBrowserListener (cast(nsIWeakReference)this, &nsIWebProgressListener.IID); if (rc !is XPCOM.NS_OK) { browser.dispose (); - error (rc); + error (rc, __FILE__, __LINE__); + } + + // TODO: Find appropriate place to "Release" uriContentListener -JJR + nsIURIContentListener uriContentListener; + this.QueryInterface(&nsIURIContentListener.IID, cast(void**)&uriContentListener); + if (rc !is XPCOM.NS_OK) { + browser.dispose(); + error(rc); + } + if (uriContentListener is null) { + browser.dispose(); + error(XPCOM.NS_ERROR_NO_INTERFACE); + } + + rc = webBrowser.SetParentURIContentListener (uriContentListener); + if (rc !is XPCOM.NS_OK) { + browser.dispose (); + error (rc, __FILE__, __LINE__); } - rc = webBrowser.SetParentURIContentListener (uriContentListener.getAddress ()); - if (rc !is XPCOM.NS_OK) { - browser.dispose (); - error (rc); + mozDelegate.init (); + + int[] folderEvents = [ + DWT.Dispose, + DWT.Resize, + DWT.FocusIn, + DWT.Activate, + DWT.Deactivate, + DWT.Show, + DWT.KeyDown // needed to make browser traversable + ]; + + for (int i = 0; i < folderEvents.length; i++) { + browser.addListener (folderEvents[i], dgListener( &handleFolderEvent )); } +} - delegate_.init_ (); +/******************************************************************************* + + Event Handlers for the Mozilla Class: + + These represent replacements for SWT's anonymous classes as used within + the Mozilla class. Since D 1.0x anonymous classes do not work equivalently + to Java's, we replace the anonymous classes with D delegates and templates + (ie dgListener which wrap the delegate in a class). This circumvents some + nasty, evasive bugs. + + extern(D) becomes a necessary override on these methods because this class + implements a XPCOM/COM interface resulting in all class methods defaulting + to extern(System). -JJR + + ******************************************************************************/ + +extern(D) +private void handleDisposeEvent (Event event, Display display) { + if (BrowserCount > 0) return; /* another display is still active */ + + nsIServiceManager serviceManager; + + int rc = XPCOM.NS_GetServiceManager (&serviceManager); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (serviceManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); + + nsIObserverService observerService; + rc = serviceManager.GetServiceByContractID (XPCOM.NS_OBSERVER_CONTRACTID.ptr, &nsIObserverService.IID, cast(void**)&observerService); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (observerService is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); + + rc = observerService.NotifyObservers (null, PROFILE_BEFORE_CHANGE.ptr, SHUTDOWN_PERSIST.toString16().toString16z()); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + observerService.Release (); - listener = new Listener () { - public void handleEvent (Event event) { + if (LocationProvider !is null) { + String prefsLocation = LocationProvider.profilePath ~ AppFileLocProvider.PREFERENCES_FILE; + scope auto pathString = new nsEmbedString (prefsLocation.toString16()); + nsILocalFile localFile; + rc = XPCOM.NS_NewLocalFile (cast(nsAString*)pathString, 1, &localFile); + if (rc !is XPCOM.NS_OK) Mozilla.error (rc, __FILE__, __LINE__); + if (localFile is null) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); + + nsIFile prefFile; + rc = localFile.QueryInterface (&nsIFile.IID, cast(void**)&prefFile); + if (rc !is XPCOM.NS_OK) Mozilla.error (rc, __FILE__, __LINE__); + if (prefFile is null) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); + localFile.Release (); + + nsIPrefService prefService; + rc = serviceManager.GetServiceByContractID (XPCOM.NS_PREFSERVICE_CONTRACTID.ptr, &nsIPrefService.IID, cast(void**)&prefService); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (prefService is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); + + rc = prefService.SavePrefFile(prefFile); + prefService.Release (); + prefFile.Release (); + } + serviceManager.Release (); + + if (XPCOMWasGlued) { + /* + * XULRunner 1.9 can crash on Windows if XPCOMGlueShutdown is invoked here, + * presumably because one or more of its unloaded symbols are referenced when + * this callback returns. The workaround is to delay invoking XPCOMGlueShutdown + * so that its symbols are still available once this callback returns. + */ + display.asyncExec (new class() Runnable { + public void run () { + XPCOMInit.XPCOMGlueShutdown (); + } + }); + XPCOMWasGlued = XPCOMInitWasGlued = false; + } + + Initialized = false; +} + + +extern(D) +private void handleFolderEvent (Event event) { + Control control = cast(Control)browser; switch (event.type) { case DWT.Dispose: { /* make this handler run after other dispose listeners */ @@ -1299,7 +1178,7 @@ case DWT.Activate: Activate (); break; case DWT.Deactivate: { Display display = event.display; - if (Mozilla.this.browser is display.getFocusControl ()) Deactivate (); + if (control is display.getFocusControl ()) Deactivate (); break; } case DWT.Show: { @@ -1310,7 +1189,7 @@ * its size after the container has been made visible. */ Display display = event.display; - display.asyncExec(new Runnable () { + display.asyncExec(new class () Runnable { public void run() { if (browser.isDisposed ()) return; onResize (); @@ -1318,457 +1197,266 @@ }); break; } + default: break; } } - }; - int[] folderEvents = new int[] { - DWT.Dispose, - DWT.Resize, - DWT.FocusIn, - DWT.Activate, - DWT.Deactivate, - DWT.Show, - DWT.KeyDown // needed to make browser traversable - }; - for (int i = 0; i < folderEvents.length; i++) { - browser.addListener (folderEvents[i], listener); - } -} + +/******************************************************************************* +*******************************************************************************/ + +extern(D) public bool back () { if (awaitingNavigate) return false; - int /*long*/[] result = new int /*long*/[1]; - int rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + //int /*long*/[] result = new int /*long*/[1]; + nsIWebNavigation webNavigation; + int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); - nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); + //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); rc = webNavigation.GoBack (); webNavigation.Release (); return rc is 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], cast(int)/*64*/args[2], cast(int)/*64*/args[3]);} - public int /*long*/ method4 (int /*long*/[] args) {return OnProgressChange (args[0], args[1], cast(int)/*64*/args[2], cast(int)/*64*/args[3], cast(int)/*64*/args[4], cast(int)/*64*/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], cast(int)/*64*/args[2], args[3]);} - public int /*long*/ method7 (int /*long*/[] args) {return OnSecurityChange (args[0], args[1], cast(int)/*64*/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 (cast(int)/*64*/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 (cast(int)/*64*/args[0]);} - public int /*long*/ method8 (int /*long*/[] args) {return DestroyBrowserWindow ();} - public int /*long*/ method9 (int /*long*/[] args) {return SizeBrowserTo (cast(int)/*64*/args[0], cast(int)/*64*/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 (cast(int)/*64*/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 (cast(int)/*64*/args[0], cast(int)/*64*/args[1], cast(int)/*64*/args[2], cast(int)/*64*/args[3], cast(int)/*64*/args[4]);} - public int /*long*/ method4 (int /*long*/[] args) {return GetDimensions (cast(int)/*64*/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 (cast(int)/*64*/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 (cast(int)/*64*/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], cast(int)/*64*/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], cast(int)/*64*/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 (cast(int)/*64*/args[0], cast(int)/*64*/args[1], args[2]);} - public int /*long*/ method4 (int /*long*/[] args) {return OnHideTooltip ();} - }; - - domEventListener = 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 HandleEvent (args[0]);} - }; -} - -void disposeCOMInterfaces () { - if (supports !is null) { - supports.dispose (); - supports = null; - } - if (weakReference !is null) { - weakReference.dispose (); - weakReference = null; - } - if (webProgressListener !is null) { - webProgressListener.dispose (); - webProgressListener = null; - } - if (webBrowserChrome !is null) { - webBrowserChrome.dispose (); - webBrowserChrome = null; - } - if (webBrowserChromeFocus !is null) { - webBrowserChromeFocus.dispose (); - webBrowserChromeFocus = null; - } - if (embeddingSiteWindow !is null) { - embeddingSiteWindow.dispose (); - embeddingSiteWindow = null; - } - if (interfaceRequestor !is null) { - interfaceRequestor.dispose (); - interfaceRequestor = null; - } - if (supportsWeakReference !is null) { - supportsWeakReference.dispose (); - supportsWeakReference = null; - } - if (contextMenuListener !is null) { - contextMenuListener.dispose (); - contextMenuListener = null; - } - if (uriContentListener !is null) { - uriContentListener.dispose (); - uriContentListener = null; - } - if (tooltipListener !is null) { - tooltipListener.dispose (); - tooltipListener = null; - } - if (domEventListener !is null) { - domEventListener.dispose (); - domEventListener = null; - } -} - +extern(D) public bool execute (String script) { if (awaitingNavigate) return false; - String url = PREFIX_JAVASCRIPT + script + ";void(0);"; //$NON-NLS-1$ - int /*long*/[] result = new int /*long*/[1]; - int rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + String url = PREFIX_JAVASCRIPT ~ script ~ ";void(0);"; //$NON-NLS-1$ + //int /*long*/[] result = new int /*long*/[1]; + nsIWebNavigation webNavigation; + int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); - 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); + //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 (url.toString16().toString16z(), nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null); webNavigation.Release (); return rc is XPCOM.NS_OK; } -static Browser findBrowser (int /*long*/ handle) { - return MozillaDelegate.findBrowser (handle); +extern(D) +static Browser findBrowser (void* handle) { + return MozillaDelegate.findBrowser (cast(GtkWidget*)handle); } -static Browser findBrowser (nsIDOMWindow aDOMWindow) { - int /*long*/[] result = new int /*long*/[1]; - int rc = XPCOM.NS_GetServiceManager (result); - if (rc !is XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] is 0) Mozilla.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 !is XPCOM.NS_OK) Mozilla.error(rc); - if (result[0] is 0) Mozilla.error (XPCOM.NS_NOINTERFACE); - serviceManager.Release (); - - nsIWindowWatcher windowWatcher = new nsIWindowWatcher (result[0]); - result[0] = 0; - /* the chrome will only be answered for the top-level nsIDOMWindow */ - rc = aDOMWindow.GetTop (result); - if (rc !is XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] is 0) Mozilla.error (XPCOM.NS_NOINTERFACE); - int /*long*/ topDOMWindow = result[0]; - result[0] = 0; - rc = windowWatcher.GetChromeForWindow (topDOMWindow, result); - if (rc !is XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] is 0) Mozilla.error (XPCOM.NS_NOINTERFACE); - new nsISupports (topDOMWindow).Release (); - windowWatcher.Release (); - - nsIWebBrowserChrome webBrowserChrome = new nsIWebBrowserChrome (result[0]); - result[0] = 0; - rc = webBrowserChrome.QueryInterface (nsIEmbeddingSiteWindow.NS_IEMBEDDINGSITEWINDOW_IID, result); - if (rc !is XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] is 0) Mozilla.error (XPCOM.NS_NOINTERFACE); - webBrowserChrome.Release (); - - nsIEmbeddingSiteWindow embeddingSiteWindow = new nsIEmbeddingSiteWindow (result[0]); - result[0] = 0; - rc = embeddingSiteWindow.GetSiteWindow (result); - if (rc !is XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] is 0) Mozilla.error (XPCOM.NS_NOINTERFACE); - embeddingSiteWindow.Release (); - - return findBrowser (result[0]); -} - +extern(D) public bool forward () { if (awaitingNavigate) return false; - int /*long*/[] result = new int /*long*/[1]; - int rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + //int /*long*/[] result = new int /*long*/[1]; + nsIWebNavigation webNavigation; + int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); - nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); + //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); rc = webNavigation.GoForward (); webNavigation.Release (); return rc is XPCOM.NS_OK; } -public String getBrowserType () { - return "mozilla"; //$NON-NLS-1$ -} - +extern(D) public String getText () { if (awaitingNavigate) return ""; //$NON-NLS-1$ - int /*long*/[] result = new int /*long*/[1]; - int rc = webBrowser.GetContentDOMWindow (result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); + //int /*long*/[] result = new int /*long*/[1]; + nsIDOMWindow window; + int rc = webBrowser.GetContentDOMWindow (&window); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (window is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); - nsIDOMWindow window = new nsIDOMWindow (result[0]); - result[0] = 0; - rc = window.GetDocument (result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); + //nsIDOMWindow window = new nsIDOMWindow (result[0]); + //result[0] = 0; + nsIDOMDocument document; + rc = window.GetDocument (&document); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (document is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); window.Release (); - int /*long*/ document = result[0]; - result[0] = 0; - rc = XPCOM.NS_GetComponentManager (result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); + //int /*long*/ document = result[0]; + //result[0] = 0; + nsIComponentManager componentManager; + rc = XPCOM.NS_GetComponentManager (&componentManager); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (componentManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); + + //nsIComponentManager componentManager = new nsIComponentManager (result[0]); + //result[0] = 0; + //byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_DOMSERIALIZER_CONTRACTID, true); + String chars = null; + nsIDOMSerializer_1_7 serializer_1_7; + rc = componentManager.CreateInstanceByContractID (XPCOM.NS_DOMSERIALIZER_CONTRACTID.ptr, null, &nsIDOMSerializer_1_7.IID, cast(void**)&serializer_1_7); + if (rc is XPCOM.NS_OK) { /* mozilla >= 1.7 */ + if (serializer_1_7 is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); - nsIComponentManager componentManager = new nsIComponentManager (result[0]); - result[0] = 0; - byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_DOMSERIALIZER_CONTRACTID, true); - char[] chars = null; + //nsIDOMSerializer_1_7 serializer = new nsIDOMSerializer_1_7 (result[0]); + //result[0] = 0; + scope auto string = new nsEmbedString; + rc = serializer_1_7.SerializeToString (cast(nsIDOMNode)document, cast(nsAString*) string); + serializer_1_7.Release (); - rc = componentManager.CreateInstanceByContractID (contractID, 0, nsIDOMSerializer_1_7.NS_IDOMSERIALIZER_IID, result); - if (rc is XPCOM.NS_OK) { /* mozilla >= 1.7 */ - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); - - nsIDOMSerializer_1_7 serializer = new nsIDOMSerializer_1_7 (result[0]); - result[0] = 0; - int /*long*/ string = XPCOM.nsEmbedString_new (); - rc = serializer.SerializeToString (document, string); + //int length = XPCOM.nsEmbedString_Length (string); + //int /*long*/ buffer = XPCOM.nsEmbedString_get (string); + //chars = new char[length]; + //XPCOM.memmove (chars, buffer, length * 2); + //XPCOM.nsEmbedString_delete (string); + chars = string.toString(); + } else { /* mozilla < 1.7 */ + nsIDOMSerializer serializer; + rc = componentManager.CreateInstanceByContractID (XPCOM.NS_DOMSERIALIZER_CONTRACTID.ptr, null, &nsIDOMSerializer.IID, cast(void**)&serializer); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (serializer is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); + // TODO: Lookup SerializeToString contract. Find out if the string must provide it's own memory to the method. -JJR + PRUnichar* string; + //nsIDOMSerializer serializer = new nsIDOMSerializer (result[0]); + //result[0] = 0; + rc = serializer.SerializeToString (cast(nsIDOMNode)document, &string ); serializer.Release (); - int length = XPCOM.nsEmbedString_Length (string); - int /*long*/ buffer = XPCOM.nsEmbedString_get (string); - chars = new char[length]; - XPCOM.memmove (chars, buffer, length * 2); - XPCOM.nsEmbedString_delete (string); - } else { /* mozilla < 1.7 */ - rc = componentManager.CreateInstanceByContractID (contractID, 0, nsIDOMSerializer.NS_IDOMSERIALIZER_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); - - nsIDOMSerializer serializer = new nsIDOMSerializer (result[0]); - result[0] = 0; - rc = serializer.SerializeToString (document, result); - serializer.Release (); - - int length = XPCOM.strlen_PRUnichar (result[0]); - chars = new char[length]; - XPCOM.memmove (chars, result[0], length * 2); + //int length = XPCOM.strlen_PRUnichar (string); + //chars = new char[length]; + //XPCOM.memmove (chars, result[0], length * 2); + chars = Utf.toString(fromString16z(string)); } componentManager.Release (); - new nsISupports (document).Release (); - return new String (chars); + document.Release (); + return chars.dup; } +extern(D) public String getUrl () { if (awaitingNavigate) return ""; //$NON-NLS-1$ - int /*long*/[] result = new int /*long*/[1]; - int rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + //int /*long*/[] result = new int /*long*/[1]; + nsIWebNavigation webNavigation; + int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); - nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); - int /*long*/[] aCurrentURI = new int /*long*/[1]; - rc = webNavigation.GetCurrentURI (aCurrentURI); - if (rc !is XPCOM.NS_OK) error (rc); + //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); + nsIURI aCurrentURI; + rc = webNavigation.GetCurrentURI (&aCurrentURI); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); webNavigation.Release (); - byte[] dest = null; - if (aCurrentURI[0] !is 0) { - nsIURI uri = new nsIURI (aCurrentURI[0]); - int /*long*/ aSpec = XPCOM.nsEmbedCString_new (); - rc = uri.GetSpec (aSpec); - if (rc !is 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 (); + String location = null; + if (aCurrentURI !is null) { + //nsIURI uri = new nsIURI (aCurrentURI[0]); + scope auto aSpec = new nsEmbedCString; + rc = aCurrentURI.GetSpec (cast(nsACString*)aSpec); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + //int length = XPCOM.nsEmbedCString_Length (aSpec); + //int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec); + location = aSpec.toString; + //XPCOM.memmove (dest, buffer, length); + //XPCOM.nsEmbedCString_delete (aSpec); + aCurrentURI.Release (); } - if (dest is null) return ""; //$NON-NLS-1$ + if (location is null) return ""; //$NON-NLS-1$ - String location = new String (dest); /* * If the URI indicates that the page is being rendered from memory * (via setText()) then set it to about:blank to be consistent with IE. */ - if (location.equals cast(URI_FROMMEMORY)) location = ABOUT_BLANK; + if (location.equals (URI_FROMMEMORY)) location = ABOUT_BLANK; return location; } +extern(D) public Object getWebBrowser () { if ((browser.getStyle () & DWT.MOZILLA) is 0) return null; if (webBrowserObject !is null) return webBrowserObject; - + implMissing(__FILE__,__LINE__); +/+ try { + // TODO: this references the JavaXPCOM browser... not sure what needs to be done here, + // but I don't think this method is necessary. Class clazz = Class.forName ("org.mozilla.xpcom.Mozilla"); //$NON-NLS-1$ Method method = clazz.getMethod ("getInstance", new Class[0]); //$NON-NLS-1$ Object mozilla = method.invoke (null, new Object[0]); method = clazz.getMethod ("wrapXPCOMObject", new Class[] {Long.TYPE, String.class}); //$NON-NLS-1$ - webBrowserObject = method.invoke (mozilla, new Object[] {new Long (webBrowser.getAddress ()), nsIWebBrowser.NS_IWEBBROWSER_IID_STR}); + webBrowserObject = webBrowser.getAddress ()), nsIWebBrowser.NS_IWEBBROWSER_IID_STR}); /* * The following AddRef() is needed to offset the automatic Release() that * will be performed by JavaXPCOM when webBrowserObject is finalized. */ webBrowser.AddRef (); return webBrowserObject; - } catch (ClassNotFoundException e) { - } catch (NoSuchMethodException e) { - } catch (IllegalArgumentException e) { - } catch (IllegalAccessException e) { - } catch (InvocationTargetException e) { - } - return null; + } catch (ClassNotFoundException e) { + } catch (NoSuchMethodException e) { + } catch (IllegalArgumentException e) { + } catch (IllegalAccessException e) { + } catch (InvocationTargetException e) { + } ++/ + return null; } +extern(D) public bool isBackEnabled () { if (awaitingNavigate) return false; - int /*long*/[] result = new int /*long*/[1]; - int rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + //int /*long*/[] result = new int /*long*/[1]; + nsIWebNavigation webNavigation; + int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); - nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); - int[] aCanGoBack = new int[1]; /* PRBool */ - rc = webNavigation.GetCanGoBack (aCanGoBack); + //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); + PRBool aCanGoBack; /* PRBool */ + rc = webNavigation.GetCanGoBack (&aCanGoBack); webNavigation.Release (); - return aCanGoBack[0] !is 0; + return aCanGoBack !is 0; } +extern(D) public bool isForwardEnabled () { if (awaitingNavigate) return false; - int /*long*/[] result = new int /*long*/[1]; - int rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + //int /*long*/[] result = new int /*long*/[1]; + nsIWebNavigation webNavigation; + int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); - nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); - int[] aCanGoForward = new int[1]; /* PRBool */ - rc = webNavigation.GetCanGoForward (aCanGoForward); + //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); + PRBool aCanGoForward; /* PRBool */ + rc = webNavigation.GetCanGoForward (&aCanGoForward); webNavigation.Release (); - return aCanGoForward[0] !is 0; + return aCanGoForward !is 0; } -static String error (int code) { - throw new DWTError ("XPCOM error " + code); //$NON-NLS-1$ +extern(D) +static void error (int code ) { + error ( code, "NOT GIVEN", 0 ); } +extern(D) +static String error (int code, char[] file, int line) { + Stdout ("File: ")(file)(" Line: ")(line).newline; + throw new DWTError ("XPCOM error " ~ Integer.toString(code)); //$NON-NLS-1$ +} + +extern(D) void onDispose (Display display) { - int rc = webBrowser.RemoveWebBrowserListener (weakReference.getAddress (), nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID); - if (rc !is XPCOM.NS_OK) error (rc); + int rc = webBrowser.RemoveWebBrowserListener (cast(nsIWeakReference)this, &nsIWebProgressListener.IID); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); - rc = webBrowser.SetParentURIContentListener (0); - if (rc !is XPCOM.NS_OK) error (rc); + rc = webBrowser.SetParentURIContentListener (null); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); unhookDOMListeners (); if (listener !is null) { - int[] folderEvents = new int[] { + int[] folderEvents = [ DWT.Dispose, DWT.Resize, DWT.FocusIn, @@ -1776,24 +1464,25 @@ DWT.Deactivate, DWT.Show, DWT.KeyDown, - }; + ]; for (int i = 0; i < folderEvents.length; i++) { browser.removeListener (folderEvents[i], listener); } listener = null; } - int /*long*/[] result = new int /*long*/[1]; - rc = webBrowser.QueryInterface (nsIBaseWindow.NS_IBASEWINDOW_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + //int /*long*/[] result = new int /*long*/[1]; + nsIBaseWindow baseWindow; + rc = webBrowser.QueryInterface (&nsIBaseWindow.IID, cast(void**)&baseWindow); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (baseWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); - nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); + //nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); rc = baseWindow.Destroy (); - if (rc !is XPCOM.NS_OK) error (rc); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); baseWindow.Release (); - this (); + Release (); webBrowser.Release (); webBrowser = null; webBrowserObject = null; @@ -1802,70 +1491,78 @@ tip = null; location = size = null; - Enumeration elements = unhookedDOMWindows.elements (); - while (elements.hasMoreElements ()) { - LONG ptrObject = cast(LONG)elements.nextElement (); - new nsISupports (ptrObject.value).Release (); + //Enumeration elements = unhookedDOMWindows.elements (); + foreach (win ; unhookedDOMWindows) { + //LONG ptrObject = (LONG)elements.nextElement (); + win.Release (); } unhookedDOMWindows = null; - delegate.onDispose (embedHandle); - delegate = null; + mozDelegate.onDispose (embedHandle); + mozDelegate = null; - embedHandle = 0; + embedHandle = null; BrowserCount--; } +extern(D) void Activate () { - int /*long*/[] result = new int /*long*/[1]; - int rc = webBrowser.QueryInterface (nsIWebBrowserFocus.NS_IWEBBROWSERFOCUS_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + //int /*long*/[] result = new int /*long*/[1]; + nsIWebBrowserFocus webBrowserFocus; + int rc = webBrowser.QueryInterface (&nsIWebBrowserFocus.IID, cast(void**)&webBrowserFocus); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (webBrowserFocus is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); - nsIWebBrowserFocus webBrowserFocus = new nsIWebBrowserFocus (result[0]); + //nsIWebBrowserFocus webBrowserFocus = new nsIWebBrowserFocus (result[0]); rc = webBrowserFocus.Activate (); - if (rc !is 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 !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - - nsIWebBrowserFocus webBrowserFocus = new nsIWebBrowserFocus (result[0]); - rc = webBrowserFocus.Deactivate (); - if (rc !is XPCOM.NS_OK) error (rc); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); webBrowserFocus.Release (); } +extern(D) +void Deactivate () { + //int /*long*/[] result = new int /*long*/[1]; + nsIWebBrowserFocus webBrowserFocus; + int rc = webBrowser.QueryInterface (&nsIWebBrowserFocus.IID, cast(void**)&webBrowserFocus); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (webBrowserFocus is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); + + //nsIWebBrowserFocus webBrowserFocus = new nsIWebBrowserFocus (result[0]); + rc = webBrowserFocus.Deactivate (); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + webBrowserFocus.Release (); +} + +extern(D) 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 !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + //int /*long*/[] result = new int /*long*/[1]; + nsIBaseWindow baseWindow; + int rc = webBrowser.QueryInterface (&nsIBaseWindow.IID, cast(void**)&baseWindow); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (baseWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); - delegate.setSize (embedHandle, width, height); - nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); + mozDelegate.setSize (embedHandle, width, height); + //nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); rc = baseWindow.SetPositionAndSize (0, 0, width, height, 1); - if (rc !is XPCOM.NS_OK) error (rc); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); baseWindow.Release (); } +extern(D) public void refresh () { if (awaitingNavigate) return; - int /*long*/[] result = new int /*long*/[1]; - int rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result); + //int /*long*/[] result = new int /*long*/[1]; + nsIWebNavigation webNavigation; + int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); if (rc !is XPCOM.NS_OK) error(rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); - nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); + //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); rc = webNavigation.Reload (nsIWebNavigation.LOAD_FLAGS_NONE); webNavigation.Release (); if (rc is XPCOM.NS_OK) return; @@ -1879,9 +1576,10 @@ * attempting to load a non-existent local url, which is not a Browser error, * so this error code should be ignored. */ - if (rc !is XPCOM.NS_ERROR_INVALID_POINTER && rc !is XPCOM.NS_ERROR_FILE_NOT_FOUND) error (rc); + if (rc !is XPCOM.NS_ERROR_INVALID_POINTER && rc !is XPCOM.NS_ERROR_FILE_NOT_FOUND) error (rc, __FILE__, __LINE__); } +extern(D) public bool setText (String html) { /* * Feature in Mozilla. The focus memory of Mozilla must be @@ -1900,58 +1598,63 @@ * would be to have a way to call deactivate when the Browser * or one of its children loses focus. */ - if (browser !is browser.getDisplay ().getFocusControl ()) Deactivate (); - + if (browser !is 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; } - + +/ awaitingNavigate = false; - byte[] contentTypeBuffer = MozillaDelegate.wcsToMbcs (null, "text/html", true); // $NON-NLS-1$ - int /*long*/ aContentType = XPCOM.nsEmbedCString_new (contentTypeBuffer, contentTypeBuffer.length); - byte[] contentCharsetBuffer = MozillaDelegate.wcsToMbcs (null, "UTF-8", true); //$NON-NLS-1$ - int /*long*/ aContentCharset = XPCOM.nsEmbedCString_new (contentCharsetBuffer, contentCharsetBuffer.length); + //byte[] contentTypeBuffer = MozillaDelegate.wcsToMbcs (null, "text/html", true); // $NON-NLS-1$ + scope auto aContentType = new nsEmbedCString ("text/html"); + //byte[] contentCharsetBuffer = MozillaDelegate.wcsToMbcs (null, "UTF-8", true); //$NON-NLS-1$ + scope auto aContentCharset = new nsEmbedCString ("UTF-8"); - int /*long*/[] result = new int /*long*/[1]; - int rc = XPCOM.NS_GetServiceManager (result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); + //int /*long*/[] result = new int /*long*/[1]; + nsIServiceManager serviceManager; + int rc = XPCOM.NS_GetServiceManager (&serviceManager); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (serviceManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); - nsIServiceManager serviceManager = new nsIServiceManager (result[0]); - result[0] = 0; - rc = serviceManager.GetService (XPCOM.NS_IOSERVICE_CID, nsIIOService.NS_IIOSERVICE_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); + //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); + //result[0] = 0; + nsIIOService ioService; + rc = serviceManager.GetService (&XPCOM.NS_IOSERVICE_CID, &nsIIOService.IID, cast(void**)&ioService); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (ioService is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); serviceManager.Release (); - nsIIOService ioService = new nsIIOService (result[0]); - result[0] = 0; + //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); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); - XPCOM.nsEmbedCString_delete (aSpec); + //byte[] aString = MozillaDelegate.wcsToMbcs (null, URI_FROMMEMORY, false); + scope auto aSpec = new nsEmbedCString(URI_FROMMEMORY); + nsIURI uri; + rc = ioService.NewURI (cast(nsACString*)aSpec, null, null, &uri); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (uri is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); + //XPCOM.nsEmbedCString_delete (aSpec); ioService.Release (); - nsIURI uri = new nsIURI (result[0]); - result[0] = 0; - - rc = webBrowser.QueryInterface (nsIInterfaceRequestor.NS_IINTERFACEREQUESTOR_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - nsIInterfaceRequestor interfaceRequestor = new nsIInterfaceRequestor (result[0]); - result[0] = 0; + //nsIURI uri = new nsIURI (result[0]); + //result[0] = 0; + nsIInterfaceRequestor interfaceRequestor; + rc = webBrowser.QueryInterface (&nsIInterfaceRequestor.IID, cast(void**)&interfaceRequestor); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (interfaceRequestor is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); + //nsIInterfaceRequestor interfaceRequestor = new nsIInterfaceRequestor (result[0]); + //result[0] = 0; /* * Feature in Mozilla. LoadStream invokes the nsIInputStream argument @@ -1959,163 +1662,174 @@ * a non java thread to the JVM otherwise the nsIInputStream Read and * Close methods never get called. */ - InputStream inputStream = new InputStream (data); + + // Using fully qualified name for disambiguation with dwthelper InputStream -JJR + auto inputStream = new dwt.browser.InputStream.InputStream (cast(byte[])html); inputStream.AddRef (); - rc = interfaceRequestor.GetInterface (nsIDocShell_1_9.NS_IDOCSHELL_IID, result); + nsIDocShell_1_9 docShell_1_9; + rc = interfaceRequestor.GetInterface (&nsIDocShell_1_9.IID, cast(void**)&docShell_1_9); if (rc is XPCOM.NS_OK) { - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - nsIDocShell_1_9 docShell = new nsIDocShell_1_9 (result[0]); - rc = docShell.LoadStream (inputStream.getAddress (), uri.getAddress (), aContentType, aContentCharset, 0); - docShell.Release (); + if (docShell_1_9 is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); + //nsIDocShell_1_9 docShell = new nsIDocShell_1_9 (result[0]); + rc = docShell_1_9.LoadStream (inputStream, uri, cast(nsACString*)aContentType, cast(nsACString*)aContentCharset, null); + docShell_1_9.Release (); } else { - result[0] = 0; - rc = interfaceRequestor.GetInterface (nsIDocShell_1_8.NS_IDOCSHELL_IID, result); + //result[0] = 0; + nsIDocShell_1_8 docShell_1_8; + rc = interfaceRequestor.GetInterface (&nsIDocShell_1_8.IID, cast(void**)&docShell_1_8); if (rc is XPCOM.NS_OK) { - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - nsIDocShell_1_8 docShell = new nsIDocShell_1_8 (result[0]); - rc = docShell.LoadStream (inputStream.getAddress (), uri.getAddress (), aContentType, aContentCharset, 0); - docShell.Release (); + if (docShell_1_8 is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); + //nsIDocShell_1_8 docShell = new nsIDocShell_1_8 (result[0]); + rc = docShell_1_8.LoadStream (inputStream, uri, cast(nsACString*)aContentType, cast(nsACString*)aContentCharset, null); + docShell_1_8.Release (); } else { - result[0] = 0; - rc = interfaceRequestor.GetInterface (nsIDocShell.NS_IDOCSHELL_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - nsIDocShell docShell = new nsIDocShell (result[0]); - rc = docShell.LoadStream (inputStream.getAddress (), uri.getAddress (), aContentType, aContentCharset, 0); + //result[0] = 0; + nsIDocShell docShell; + rc = interfaceRequestor.GetInterface (&nsIDocShell.IID, cast(void**)&docShell); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (docShell is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); + //nsIDocShell docShell = new nsIDocShell (result[0]); + rc = docShell.LoadStream (inputStream, uri, cast(nsACString*) aContentType, cast(nsACString*)aContentCharset, null); docShell.Release (); } } - if (rc !is XPCOM.NS_OK) error (rc); - result[0] = 0; + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + //result[0] = 0; inputStream.Release (); interfaceRequestor.Release (); uri.Release (); - XPCOM.nsEmbedCString_delete (aContentCharset); - XPCOM.nsEmbedCString_delete (aContentType); + //XPCOM.nsEmbedCString_delete (aContentCharset); + //XPCOM.nsEmbedCString_delete (aContentType); return true; } +extern(D) public bool setUrl (String url) { awaitingNavigate = false; - int /*long*/[] result = new int /*long*/[1]; - int rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + nsIWebNavigation webNavigation; + int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); - nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); - char[] uri = new char[url.length () + 1]; - url.getChars (0, url.length (), uri, 0); - rc = webNavigation.LoadURI (uri, nsIWebNavigation.LOAD_FLAGS_NONE, 0, 0, 0); + rc = webNavigation.LoadURI (url.toString16().toString16z(), nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null); webNavigation.Release (); return rc is XPCOM.NS_OK; } +extern(D) public void stop () { if (awaitingNavigate) return; - int /*long*/[] result = new int /*long*/[1]; - int rc = webBrowser.QueryInterface (nsIWebNavigation.NS_IWEBNAVIGATION_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + nsIWebNavigation webNavigation; + //int /*long*/[] result = new int /*long*/[1]; + int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); - nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); + //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); rc = webNavigation.Stop (nsIWebNavigation.STOP_ALL); - if (rc !is XPCOM.NS_OK) error (rc); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); webNavigation.Release (); } +extern(D) void hookDOMListeners (nsIDOMEventTarget target, bool isTop) { - nsEmbedString string = new nsEmbedString (XPCOM.DOMEVENT_FOCUS); - target.AddEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); - string = new nsEmbedString (XPCOM.DOMEVENT_UNLOAD); - target.AddEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); - string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEDOWN); - target.AddEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); - string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEUP); - target.AddEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); - string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEMOVE); - target.AddEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); - string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEWHEEL); - target.AddEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); - string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEDRAG); - target.AddEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); + scope auto string = new nsEmbedString (XPCOM.DOMEVENT_FOCUS.toString16()); + target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_UNLOAD.toString16()); + target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEDOWN.toString16()); + target.AddEventListener (cast(nsAString*)string,cast(nsIDOMEventListener)this, 0); + //string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEUP.toString16()); + target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEMOVE.toString16()); + target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEWHEEL.toString16()); + target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEDRAG.toString16()); + target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); /* * Only hook mouseover and mouseout if the target is a top-level frame, so that mouse moves * between frames will not generate events. */ - if (isTop && delegate.hookEnterExit ()) { - string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEOVER); - target.AddEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); - string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEOUT); - target.AddEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); + if (isTop && mozDelegate.hookEnterExit ()) { + string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEOVER.toString16()); + target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEOUT.toString16()); + target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); } - string = new nsEmbedString (XPCOM.DOMEVENT_KEYDOWN); - target.AddEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); - string = new nsEmbedString (XPCOM.DOMEVENT_KEYPRESS); - target.AddEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); - string = new nsEmbedString (XPCOM.DOMEVENT_KEYUP); - target.AddEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_KEYDOWN.toString16()); + target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_KEYPRESS.toString16()); + target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_KEYUP.toString16()); + target.AddEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); } +extern(D) void unhookDOMListeners () { - int /*long*/[] result = new int /*long*/[1]; - int rc = webBrowser.GetContentDOMWindow (result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + //int /*long*/[] result = new int /*long*/[1]; + nsIDOMWindow window; + int rc = webBrowser.GetContentDOMWindow (&window); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (window is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); - nsIDOMWindow window = new nsIDOMWindow (result[0]); - result[0] = 0; - rc = window.QueryInterface (nsIDOMEventTarget.NS_IDOMEVENTTARGET_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + //nsIDOMWindow window = new nsIDOMWindow (result[0]); + //result[0] = 0; + nsIDOMEventTarget target; + rc = window.QueryInterface (&nsIDOMEventTarget.IID, cast(void**)&target); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (target is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); - nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); - result[0] = 0; + //nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); + //result[0] = 0; unhookDOMListeners (target); target.Release (); /* Listeners must be unhooked in pages contained in frames */ - rc = window.GetFrames (result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - nsIDOMWindowCollection frames = new nsIDOMWindowCollection (result[0]); - result[0] = 0; - int[] frameCount = new int[1]; - rc = frames.GetLength (frameCount); /* PRUint32 */ - if (rc !is XPCOM.NS_OK) error (rc); - int count = frameCount[0]; + nsIDOMWindowCollection frames; + rc = window.GetFrames (&frames); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (frames is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); + //nsIDOMWindowCollection frames = new nsIDOMWindowCollection (result[0]); + //result[0] = 0; + PRUint32 count; + rc = frames.GetLength (&count); /* PRUint32 */ + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + //int count = frameCount[0]; if (count > 0) { + nsIDOMWindow frame; for (int i = 0; i < count; i++) { - rc = frames.Item (i, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + rc = frames.Item (i, &frame); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (frame is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); - nsIDOMWindow frame = new nsIDOMWindow (result[0]); - result[0] = 0; - rc = frame.QueryInterface (nsIDOMEventTarget.NS_IDOMEVENTTARGET_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + //nsIDOMWindow frame = new nsIDOMWindow (result[0]); + //result[0] = 0; + rc = frame.QueryInterface (&nsIDOMEventTarget.IID, cast(void**)&target); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (target is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); - target = new nsIDOMEventTarget (result[0]); - result[0] = 0; + //target = new nsIDOMEventTarget (result[0]); + //result[0] = 0; unhookDOMListeners (target); target.Release (); frame.Release (); @@ -2125,158 +1839,166 @@ window.Release (); } +extern(D) void unhookDOMListeners (nsIDOMEventTarget target) { - nsEmbedString string = new nsEmbedString (XPCOM.DOMEVENT_FOCUS); - target.RemoveEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); - string = new nsEmbedString (XPCOM.DOMEVENT_UNLOAD); - target.RemoveEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); - string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEDOWN); - target.RemoveEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); - string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEUP); - target.RemoveEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); - string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEMOVE); - target.RemoveEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); - string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEWHEEL); - target.RemoveEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); - string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEDRAG); - target.RemoveEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); - string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEOVER); - target.RemoveEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); - string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEOUT); - target.RemoveEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); - string = new nsEmbedString (XPCOM.DOMEVENT_KEYDOWN); - target.RemoveEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); - string = new nsEmbedString (XPCOM.DOMEVENT_KEYPRESS); - target.RemoveEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); - string = new nsEmbedString (XPCOM.DOMEVENT_KEYUP); - target.RemoveEventListener (string.getAddress (), domEventListener.getAddress (), 0); - string.dispose (); + scope auto string = new nsEmbedString (XPCOM.DOMEVENT_FOCUS.toString16()); + target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_UNLOAD.toString16()); + target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEDOWN.toString16()); + target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEUP.toString16()); + target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEMOVE.toString16()); + target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEWHEEL.toString16()); + target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEDRAG.toString16()); + target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEOVER.toString16()); + target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_MOUSEOUT.toString16()); + target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_KEYDOWN.toString16()); + target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_KEYPRESS.toString16()); + target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); + string = new nsEmbedString (XPCOM.DOMEVENT_KEYUP.toString16()); + target.RemoveEventListener (cast(nsAString*)string, cast(nsIDOMEventListener)this, 0); + //string.dispose (); } /* nsISupports */ -int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) { - if (riid is 0 || ppvObject is 0) return XPCOM.NS_ERROR_NO_INTERFACE; +extern(System) +nsresult QueryInterface (nsID* riid, void** ppvObject) { + if (riid is null || ppvObject is null) 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); + if (*riid == nsISupports.IID) { + *ppvObject = cast(void*)cast(nsISupports)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIWeakReference.NS_IWEAKREFERENCE_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {weakReference.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIWeakReference.IID) { + *ppvObject = cast(void*)cast(nsIWeakReference)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {webProgressListener.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIWebProgressListener.IID) { + *ppvObject = cast(void*)cast(nsIWebProgressListener)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIWebBrowserChrome.NS_IWEBBROWSERCHROME_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {webBrowserChrome.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIWebBrowserChrome.IID) { + *ppvObject = cast(void*)cast(nsIWebBrowserChrome)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIWebBrowserChromeFocus.NS_IWEBBROWSERCHROMEFOCUS_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {webBrowserChromeFocus.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIWebBrowserChromeFocus.IID) { + *ppvObject = cast(void*)cast(nsIWebBrowserChromeFocus)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIEmbeddingSiteWindow.NS_IEMBEDDINGSITEWINDOW_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {embeddingSiteWindow.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIEmbeddingSiteWindow.IID) { + *ppvObject = cast(void*)cast(nsIEmbeddingSiteWindow)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIInterfaceRequestor.NS_IINTERFACEREQUESTOR_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {interfaceRequestor.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIInterfaceRequestor.IID) { + *ppvObject = cast(void*)cast(nsIInterfaceRequestor)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsISupportsWeakReference.NS_ISUPPORTSWEAKREFERENCE_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {supportsWeakReference.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsISupportsWeakReference.IID) { + *ppvObject = cast(void*)cast(nsISupportsWeakReference)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIContextMenuListener.NS_ICONTEXTMENULISTENER_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {contextMenuListener.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIContextMenuListener.IID) { + *ppvObject = cast(void*)cast(nsIContextMenuListener)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIURIContentListener.NS_IURICONTENTLISTENER_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {uriContentListener.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIURIContentListener.IID) { + *ppvObject = cast(void*)cast(nsIURIContentListener)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsITooltipListener.NS_ITOOLTIPLISTENER_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {tooltipListener.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsITooltipListener.IID) { + *ppvObject = cast(void*)cast(nsITooltipListener)this; AddRef (); return XPCOM.NS_OK; } - XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); + *ppvObject = null; return XPCOM.NS_ERROR_NO_INTERFACE; } -int AddRef () { +extern(System) +nsrefcnt AddRef () { refCount++; return refCount; } -int Release () { +extern(System) +nsrefcnt Release () { refCount--; - if (refCount is 0) disposeCOMInterfaces (); + if (refCount is 0) return 0; return refCount; } /* nsIWeakReference */ - -int QueryReferent (int /*long*/ riid, int /*long*/ ppvObject) { + +extern(System) +nsresult QueryReferent (nsID* riid, void** ppvObject) { return QueryInterface (riid, ppvObject); } /* nsIInterfaceRequestor */ -int GetInterface (int /*long*/ riid, int /*long*/ ppvObject) { - if (riid is 0 || ppvObject is 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 !is XPCOM.NS_OK) error (rc); - if (aContentDOMWindow[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - XPCOM.memmove (ppvObject, aContentDOMWindow, C.PTR_SIZEOF); +extern(System) +nsresult GetInterface ( nsID* riid, void** ppvObject) { + if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; + //nsID guid = new nsID (); + //XPCOM.memmove (guid, riid, nsID.sizeof); + if (*riid == nsIDOMWindow.IID) { + nsIDOMWindow aContentDOMWindow; + //int /*long*/[] aContentDOMWindow = new int /*long*/[1]; + int rc = webBrowser.GetContentDOMWindow (&aContentDOMWindow); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (aContentDOMWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); + *ppvObject = cast(void*)aContentDOMWindow; + //XPCOM.memmove (ppvObject, aContentDOMWindow, C.PTR_SIZEOF); return rc; } return QueryInterface (riid, ppvObject); } -int GetWeakReference (int /*long*/ ppvObject) { - XPCOM.memmove (ppvObject, new int /*long*/[] {weakReference.getAddress ()}, C.PTR_SIZEOF); +extern(System) +nsresult GetWeakReference (nsIWeakReference* ppvObject) { + *ppvObject = cast(nsIWeakReference)this; + //XPCOM.memmove (ppvObject, new int /*long*/[] {weakReference.getAddress ()}, C.PTR_SIZEOF); AddRef (); return XPCOM.NS_OK; } /* nsIWebProgressListener */ -int OnStateChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aStateFlags, int aStatus) { +extern(System) +nsresult OnStateChange (nsIWebProgress aWebProgress, nsIRequest aRequest, PRUint32 aStateFlags, nsresult aStatus) { if ((aStateFlags & nsIWebProgressListener.STATE_IS_DOCUMENT) is 0) return XPCOM.NS_OK; if ((aStateFlags & nsIWebProgressListener.STATE_START) !is 0) { - if (request is 0) request = aRequest; + if (request is null) request = aRequest; if (!awaitingNavigate) { /* @@ -2285,15 +2007,16 @@ * process. These listeners cannot be added yet because the * nsIDOMWindow is not ready to take them at this stage. */ - int /*long*/[] result = new int /*long*/[1]; - nsIWebProgress progress = new nsIWebProgress (aWebProgress); - int rc = progress.GetDOMWindow (result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); - unhookedDOMWindows.addElement (new LONG (result[0])); + //int /*long*/[] result = new int /*long*/[1]; + nsIDOMWindow window; + //nsIWebProgress progress = new nsIWebProgress (aWebProgress); + int rc = aWebProgress.GetDOMWindow (&window); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (window is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); + unhookedDOMWindows ~= window; } } else if ((aStateFlags & nsIWebProgressListener.STATE_REDIRECTING) !is 0) { - if (request is aRequest) request = 0; + if (request is aRequest) request = null; } else if ((aStateFlags & nsIWebProgressListener.STATE_STOP) !is 0) { /* * If this page's nsIDOMWindow handle is still in unhookedDOMWindows then @@ -2302,30 +2025,32 @@ * received for every window in a page, which is when these listeners * are typically added. */ - int /*long*/[] result = new int /*long*/[1]; - nsIWebProgress progress = new nsIWebProgress (aWebProgress); - int rc = progress.GetDOMWindow (result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); - nsIDOMWindow domWindow = new nsIDOMWindow (result[0]); + //int /*long*/[] result = new int /*long*/[1]; + //nsIWebProgress progress = new nsIWebProgress (aWebProgress); + nsIDOMWindow domWindow; + int rc = aWebProgress.GetDOMWindow (&domWindow); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (domWindow is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); + //nsIDOMWindow domWindow = new nsIDOMWindow (result[0]); - LONG ptrObject = new LONG (result[0]); - result[0] = 0; - int index = unhookedDOMWindows.indexOf (ptrObject); + //LONG ptrObject = new LONG (result[0]); + //result[0] = 0; + int index = unhookedDOMWindows.arrayIndexOf (domWindow); if (index !is -1) { - rc = webBrowser.GetContentDOMWindow (result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - bool isTop = result[0] is domWindow.getAddress (); - new nsISupports (result[0]).Release (); - result[0] = 0; + nsIDOMWindow contentWindow; + rc = webBrowser.GetContentDOMWindow (&contentWindow); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (contentWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); + bool isTop = contentWindow is domWindow; + contentWindow.Release (); + //result[0] = 0; + nsIDOMEventTarget target; + rc = domWindow.QueryInterface (&nsIDOMEventTarget.IID, cast(void**)&target); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (target is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); - rc = domWindow.QueryInterface (nsIDOMEventTarget.NS_IDOMEVENTTARGET_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - - nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); - result[0] = 0; + //nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); + //result[0] = 0; hookDOMListeners (target, isTop); target.Release (); @@ -2333,13 +2058,13 @@ * Remove and unreference the nsIDOMWindow from the collection of windows * that are waiting to have DOM listeners hooked on them. */ - unhookedDOMWindows.remove (ptrObject); - new nsISupports (ptrObject.value).Release (); + unhookedDOMWindows = unhookedDOMWindows.arrayIndexRemove (index); + domWindow.Release (); } domWindow.Release (); /* - * Feature in Mozilla. When a request is redirected cast(STATE_REDIRECTING), + * Feature in 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 @@ -2347,8 +2072,8 @@ * - the new request resulting from the redirection - is used to send * the ProgressListener.completed event. */ - if (request is aRequest || request is 0) { - request = 0; + if (request is aRequest || request is null) { + request = null; if (!awaitingNavigate) { StatusTextEvent event = new StatusTextEvent (browser); event.display = browser.getDisplay (); @@ -2370,30 +2095,32 @@ * Hook DOM listeners to the page's nsIDOMWindow here because this is * the earliest opportunity to do so. */ - int /*long*/[] result = new int /*long*/[1]; - nsIWebProgress progress = new nsIWebProgress (aWebProgress); - int rc = progress.GetDOMWindow (result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); - nsIDOMWindow domWindow = new nsIDOMWindow (result[0]); + //int /*long*/[] result = new int /*long*/[1]; + // nsIWebProgress progress = new nsIWebProgress (aWebProgress); + nsIDOMWindow domWindow; + int rc = aWebProgress.GetDOMWindow (&domWindow); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (domWindow is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); + //nsIDOMWindow domWindow = new nsIDOMWindow (result[0]); - LONG ptrObject = new LONG (result[0]); - result[0] = 0; - int index = unhookedDOMWindows.indexOf (ptrObject); + //LONG ptrObject = new LONG (result[0]); + //result[0] = 0; + int index = unhookedDOMWindows.arrayIndexOf ( domWindow); if (index !is -1) { - rc = webBrowser.GetContentDOMWindow (result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - bool isTop = result[0] is domWindow.getAddress (); - new nsISupports (result[0]).Release (); - result[0] = 0; + nsIDOMWindow contentWindow; + rc = webBrowser.GetContentDOMWindow (&contentWindow); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (contentWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); + bool isTop = contentWindow is domWindow; + contentWindow.Release (); + //result[0] = 0; + nsIDOMEventTarget target; + rc = domWindow.QueryInterface (&nsIDOMEventTarget.IID, cast(void**)&target); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (target is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); - rc = domWindow.QueryInterface (nsIDOMEventTarget.NS_IDOMEVENTTARGET_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); - - nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); - result[0] = 0; + //nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); + //result[0] = 0; hookDOMListeners (target, isTop); target.Release (); @@ -2401,28 +2128,30 @@ * Remove and unreference the nsIDOMWindow from the collection of windows * that are waiting to have DOM listeners hooked on them. */ - unhookedDOMWindows.remove (ptrObject); - new nsISupports (ptrObject.value).Release (); + unhookedDOMWindows = unhookedDOMWindows.arrayIndexRemove(index); + domWindow.Release (); } domWindow.Release (); } return XPCOM.NS_OK; } -int OnProgressChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aCurSelfProgress, int aMaxSelfProgress, int aCurTotalProgress, int aMaxTotalProgress) { - if (awaitingNavigate || progressListeners.length is 0) return XPCOM.NS_OK; +extern(System) +nsresult OnProgressChange (nsIWebProgress aWebProgress, nsIRequest aRequest, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) { + if (awaitingNavigate || super.progressListeners.length is 0) return XPCOM.NS_OK; ProgressEvent event = new ProgressEvent (browser); event.display = browser.getDisplay (); event.widget = browser; event.current = aCurTotalProgress; event.total = aMaxTotalProgress; - for (int i = 0; i < progressListeners.length; i++) { - progressListeners[i].changed (event); + for (int i = 0; i < super.progressListeners.length; i++) { + super.progressListeners[i].changed (event); } return XPCOM.NS_OK; } -int OnLocationChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aLocation) { +extern(System) +nsresult OnLocationChange (nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation) { /* * Feature in Mozilla. When a page is loaded via setText before a previous * setText page load has completed, the expected OnStateChange STATE_STOP for the @@ -2432,35 +2161,38 @@ * (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 !is 0 && request !is aRequest) request = aRequest; + if (request !is null && request !is aRequest) request = aRequest; if (awaitingNavigate || locationListeners.length is 0) return XPCOM.NS_OK; - nsIWebProgress webProgress = new nsIWebProgress (aWebProgress); - int /*long*/[] aDOMWindow = new int /*long*/[1]; - int rc = webProgress.GetDOMWindow (aDOMWindow); - if (rc !is XPCOM.NS_OK) error (rc); - if (aDOMWindow[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + //nsIWebProgress webProgress = new nsIWebProgress (aWebProgress); - nsIDOMWindow domWindow = new nsIDOMWindow (aDOMWindow[0]); - int /*long*/[] aTop = new int /*long*/[1]; - rc = domWindow.GetTop (aTop); - if (rc !is XPCOM.NS_OK) error (rc); - if (aTop[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); + nsIDOMWindow domWindow; + //int /*long*/[] aDOMWindow = new int /*long*/[1]; + int rc = aWebProgress.GetDOMWindow (&domWindow); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (domWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); + + //nsIDOMWindow domWindow = new nsIDOMWindow (aDOMWindow[0]); + //int /*long*/[] aTop = new int /*long*/[1]; + nsIDOMWindow topWindow; + rc = domWindow.GetTop (&topWindow); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (topWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); domWindow.Release (); - nsIDOMWindow topWindow = new nsIDOMWindow (aTop[0]); + //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); - String url = new String (dest); + //nsIURI location = new nsIURI (aLocation); + scope auto aSpec = new nsEmbedCString; + aLocation.GetSpec (cast(nsACString*)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 = aSpec.toString; /* * As of Mozilla 1.8, the first time that a page is displayed, regardless of @@ -2468,7 +2200,7 @@ * to about:blank and fires the corresponding navigation events. Do not send * this event on to the user since it is not expected. */ - if (!IsPre_1_8 && aRequest is 0 && url.startsWith cast(ABOUT_BLANK)) return XPCOM.NS_OK; + if (!IsPre_1_8 && aRequest is null && url.startsWith (ABOUT_BLANK)) return XPCOM.NS_OK; LocationEvent event = new LocationEvent (browser); event.display = browser.getDisplay (); @@ -2478,80 +2210,88 @@ * If the URI indicates that the page is being rendered from memory * (via setText()) then set it to about:blank to be consistent with IE. */ - if (event.location.equals cast(URI_FROMMEMORY)) event.location = ABOUT_BLANK; - event.top = aTop[0] is aDOMWindow[0]; + if (event.location.equals (URI_FROMMEMORY)) event.location = ABOUT_BLANK; + event.top = topWindow is domWindow; for (int i = 0; i < locationListeners.length; i++) { locationListeners[i].changed (event); } return XPCOM.NS_OK; } -int OnStatusChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int aStatus, int /*long*/ aMessage) { +extern(System) +nsresult OnStatusChange (nsIWebProgress aWebProgress, nsIRequest aRequest, nsresult aStatus, PRUnichar* aMessage) { if (awaitingNavigate || statusTextListeners.length is 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); + //int length = XPCOM.strlen_PRUnichar (aMessage); + //char[] dest = new char[length]; + //XPCOM.memmove (dest, aMessage, length * 2); + event.text = Utf.toString(fromString16z(aMessage)); for (int i = 0; i < statusTextListeners.length; i++) { statusTextListeners[i].changed (event); } return XPCOM.NS_OK; } -int OnSecurityChange (int /*long*/ aWebProgress, int /*long*/ aRequest, int state) { +extern(System) +nsresult OnSecurityChange (nsIWebProgress aWebProgress, nsIRequest aRequest, PRUint32 state) { return XPCOM.NS_OK; } /* nsIWebBrowserChrome */ -int SetStatus (int statusType, int /*long*/ status) { +extern(System) +nsresult SetStatus (PRUint32 statusType, PRUnichar* status) { if (awaitingNavigate || statusTextListeners.length is 0) return XPCOM.NS_OK; 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; + //int length = XPCOM.strlen_PRUnichar (status); + //char[] dest = new char[length]; + //XPCOM.memmove (dest, status, length * 2); + //String string = new String (dest); + event.text = Utf.toString(fromString16z(status)); for (int i = 0; i < statusTextListeners.length; i++) { statusTextListeners[i].changed (event); } return XPCOM.NS_OK; } -int GetWebBrowser (int /*long*/ aWebBrowser) { - int /*long*/[] ret = new int /*long*/[1]; +extern(System) +nsresult GetWebBrowser (nsIWebBrowser* aWebBrowser) { + //int /*long*/[] ret = new int /*long*/[1]; if (webBrowser !is null) { webBrowser.AddRef (); - ret[0] = webBrowser.getAddress (); + *aWebBrowser = webBrowser; } - XPCOM.memmove (aWebBrowser, ret, C.PTR_SIZEOF); + //XPCOM.memmove (aWebBrowser, ret, C.PTR_SIZEOF); return XPCOM.NS_OK; } -int SetWebBrowser (int /*long*/ aWebBrowser) { +extern(System) +nsresult SetWebBrowser (nsIWebBrowser aWebBrowser) { if (webBrowser !is null) webBrowser.Release (); - webBrowser = aWebBrowser !is 0 ? new nsIWebBrowser (aWebBrowser) : null; - return XPCOM.NS_OK; -} - -int GetChromeFlags (int /*long*/ aChromeFlags) { - int[] ret = new int[1]; - ret[0] = chromeFlags; - XPCOM.memmove (aChromeFlags, ret, 4); /* PRUint32 */ + webBrowser = aWebBrowser !is null ? cast(nsIWebBrowser)cast(void*)aWebBrowser : null; return XPCOM.NS_OK; } -int SetChromeFlags (int aChromeFlags) { +extern(System) +nsresult GetChromeFlags (PRUint32* aChromeFlags) { + //int[] ret = new int[1]; + *aChromeFlags = chromeFlags; + //XPCOM.memmove (aChromeFlags, ret, 4); /* PRUint32 */ + return XPCOM.NS_OK; +} + +extern(System) +nsresult SetChromeFlags (PRUint32 aChromeFlags) { chromeFlags = aChromeFlags; return XPCOM.NS_OK; } -int DestroyBrowserWindow () { +extern(System) +nsresult DestroyBrowserWindow () { WindowEvent newEvent = new WindowEvent (browser); newEvent.display = browser.getDisplay (); newEvent.widget = browser; @@ -2567,8 +2307,9 @@ browser.dispose (); return XPCOM.NS_OK; } - -int SizeBrowserTo (int aCX, int aCY) { + +extern(System) +nsresult SizeBrowserTo (PRInt32 aCX, PRInt32 aCY) { size = new Point (aCX, aCY); bool isChrome = (chromeFlags & nsIWebBrowserChrome.CHROME_OPENAS_CHROME) !is 0; if (isChrome) { @@ -2578,50 +2319,56 @@ return XPCOM.NS_OK; } -int ShowAsModal () { - int /*long*/[] result = new int /*long*/[1]; - int rc = XPCOM.NS_GetServiceManager (result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); +extern(System) +nsresult ShowAsModal () { + //int /*long*/[] result = new int /*long*/[1]; + nsIServiceManager serviceManager; + int rc = XPCOM.NS_GetServiceManager (&serviceManager); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (serviceManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); - 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 !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); + //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); + //result[0] = 0; + //byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_CONTEXTSTACK_CONTRACTID, true); + nsIJSContextStack stack; + rc = serviceManager.GetServiceByContractID (XPCOM.NS_CONTEXTSTACK_CONTRACTID.ptr, &nsIJSContextStack.IID, cast(void**)&stack); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (stack is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); serviceManager.Release (); - nsIJSContextStack stack = new nsIJSContextStack (result[0]); - result[0] = 0; - rc = stack.Push (0); - if (rc !is XPCOM.NS_OK) error (rc); + //nsIJSContextStack stack = new nsIJSContextStack (result[0]); + //result[0] = 0; + rc = stack.Push (null); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); Shell shell = browser.getShell (); Display display = browser.getDisplay (); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } - - rc = stack.Pop (result); - if (rc !is XPCOM.NS_OK) error (rc); + JSContext* result; + rc = stack.Pop (&result); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); stack.Release (); return XPCOM.NS_OK; } -int IsWindowModal (int /*long*/ retval) { - int result = (chromeFlags & nsIWebBrowserChrome.CHROME_MODAL) !is 0 ? 1 : 0; - XPCOM.memmove (retval, new int[] {result}, 4); /* PRBool */ +extern(System) +nsresult IsWindowModal (PRBool* retval) { + *retval = (chromeFlags & nsIWebBrowserChrome.CHROME_MODAL) !is 0 ? 1 : 0; + //XPCOM.memmove (retval, new int[] {result}, 4); /* PRBool */ return XPCOM.NS_OK; } - -int ExitModalEventLoop (int aStatus) { + +extern(System) +nsresult ExitModalEventLoop (nsresult aStatus) { return XPCOM.NS_OK; } /* nsIEmbeddingSiteWindow */ -int SetDimensions (int flags, int x, int y, int cx, int cy) { +extern(System) +nsresult SetDimensions (PRUint32 flags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy) { if ((flags & nsIEmbeddingSiteWindow.DIM_FLAGS_POSITION) !is 0) { location = new Point (x, y); browser.getShell ().setLocation (x, y); @@ -2635,34 +2382,37 @@ return XPCOM.NS_OK; } -int GetDimensions (int flags, int /*long*/ x, int /*long*/ y, int /*long*/ cx, int /*long*/ cy) { +extern(System) +nsresult GetDimensions (PRUint32 flags, PRInt32* x, PRInt32* y, PRInt32* cx, PRInt32* cy) { if ((flags & nsIEmbeddingSiteWindow.DIM_FLAGS_POSITION) !is 0) { Point location = browser.getShell ().getLocation (); - if (x !is 0) C.memmove (x, new int[] {location.x}, 4); /* PRInt32 */ - if (y !is 0) C.memmove (y, new int[] {location.y}, 4); /* PRInt32 */ + if (x !is null) *x = location.x; /* PRInt32 */ + if (y !is null) *y = location.y; /* PRInt32 */ } if ((flags & nsIEmbeddingSiteWindow.DIM_FLAGS_SIZE_INNER) !is 0) { Point size = browser.getSize (); - if (cx !is 0) C.memmove (cx, new int[] {size.x}, 4); /* PRInt32 */ - if (cy !is 0) C.memmove (cy, new int[] {size.y}, 4); /* PRInt32 */ + if (cx !is null) *cx = size.x; /* PRInt32 */ + if (cy !is null) *cy = size.y; /* PRInt32 */ } if ((flags & nsIEmbeddingSiteWindow.DIM_FLAGS_SIZE_OUTER) !is 0) { Point size = browser.getShell().getSize (); - if (cx !is 0) C.memmove (cx, new int[] {size.x}, 4); /* PRInt32 */ - if (cy !is 0) C.memmove (cy, new int[] {size.y}, 4); /* PRInt32 */ + if (cx !is null) *cx = size.x; /* PRInt32 */ + if (cy !is null) *cy = size.y; /* PRInt32 */ } return XPCOM.NS_OK; } -int SetFocus () { - int /*long*/[] result = new int /*long*/[1]; - int rc = webBrowser.QueryInterface (nsIBaseWindow.NS_IBASEWINDOW_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_ERROR_NO_INTERFACE); +extern(System) +nsresult SetFocus () { + //int /*long*/[] result = new int /*long*/[1]; + nsIBaseWindow baseWindow; + int rc = webBrowser.QueryInterface (&nsIBaseWindow.IID, cast(void**)&baseWindow); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (baseWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); - nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); + //nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); rc = baseWindow.SetFocus (); - if (rc !is XPCOM.NS_OK) error (rc); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); baseWindow.Release (); /* @@ -2673,13 +2423,16 @@ return XPCOM.NS_OK; } -int GetVisibility (int /*long*/ aVisibility) { +extern(System) +nsresult GetVisibility (PRBool* aVisibility) { bool visible = browser.isVisible () && !browser.getShell ().getMinimized (); - XPCOM.memmove (aVisibility, new int[] {visible ? 1 : 0}, 4); /* PRBool */ + *aVisibility = visible ? 1 : 0; + //XPCOM.memmove (aVisibility, new int[] {visible ? 1 : 0}, 4); /* PRBool */ return XPCOM.NS_OK; } -int SetVisibility (int aVisibility) { +extern(System) +nsresult SetVisibility (PRBool aVisibility) { if (isChild) { WindowEvent event = new WindowEvent (browser); event.display = browser.getDisplay (); @@ -2716,11 +2469,13 @@ return XPCOM.NS_OK; } -int GetTitle (int /*long*/ aTitle) { +extern(System) +nsresult GetTitle (PRUnichar** aTitle) { return XPCOM.NS_OK; } -int SetTitle (int /*long*/ aTitle) { +extern(System) +nsresult SetTitle (PRUnichar* aTitle) { if (awaitingNavigate || titleListeners.length is 0) return XPCOM.NS_OK; TitleEvent event = new TitleEvent (browser); event.display = browser.getDisplay (); @@ -2732,9 +2487,9 @@ */ 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); + //char[] dest = new char[length]; + //XPCOM.memmove (dest, aTitle, length * 2); + event.title = Utf.toString(fromString16z(aTitle)); } else { event.title = getUrl (); } @@ -2744,7 +2499,8 @@ return XPCOM.NS_OK; } -int GetSiteWindow (int /*long*/ aSiteWindow) { +extern(System) +nsresult GetSiteWindow (void** aSiteWindow) { /* * Note. The handle is expected to be an HWND on Windows and * a GtkWidget* on GTK. This callback is invoked on Windows @@ -2752,20 +2508,21 @@ * 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); + *aSiteWindow = cast(void*) embedHandle; return XPCOM.NS_OK; } /* nsIWebBrowserChromeFocus */ -int FocusNextElement () { +extern(System) +nsresult 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 () { + browser.getDisplay ().asyncExec (new class() Runnable { public void run () { if (browser.isDisposed ()) return; browser.traverse (DWT.TRAVERSE_TAB_NEXT); @@ -2774,14 +2531,15 @@ return XPCOM.NS_OK; } -int FocusPrevElement () { +extern(System) +nsresult 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 () { + browser.getDisplay ().asyncExec (new class() Runnable { public void run () { if (browser.isDisposed ()) return; browser.traverse (DWT.TRAVERSE_TAB_PREVIOUS); @@ -2792,31 +2550,33 @@ /* nsIContextMenuListener */ -int OnShowContextMenu (int aContextFlags, int /*long*/ aEvent, int /*long*/ aNode) { +extern(System) +nsresult OnShowContextMenu (PRUint32 aContextFlags, nsIDOMEvent aEvent, nsIDOMNode aNode) { if (awaitingNavigate) return XPCOM.NS_OK; - nsIDOMEvent domEvent = new nsIDOMEvent (aEvent); - int /*long*/[] result = new int /*long*/[1]; - int rc = domEvent.QueryInterface (nsIDOMMouseEvent.NS_IDOMMOUSEEVENT_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); + //nsIDOMEvent domEvent = new nsIDOMEvent (aEvent); + //int /*long*/[] result = new int /*long*/[1]; + nsIDOMMouseEvent domMouseEvent; + int rc = aEvent.QueryInterface (&nsIDOMMouseEvent.IID, cast(void**)&domMouseEvent); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (domMouseEvent is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); - nsIDOMMouseEvent domMouseEvent = new nsIDOMMouseEvent (result[0]); - int[] aScreenX = new int[1], aScreenY = new int[1]; - rc = domMouseEvent.GetScreenX (aScreenX); - if (rc !is XPCOM.NS_OK) error (rc); - rc = domMouseEvent.GetScreenY (aScreenY); - if (rc !is XPCOM.NS_OK) error (rc); + //nsIDOMMouseEvent domMouseEvent = new nsIDOMMouseEvent (result[0]); + PRInt32 aScreenX, aScreenY; + rc = domMouseEvent.GetScreenX (&aScreenX); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = domMouseEvent.GetScreenY (&aScreenY); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); domMouseEvent.Release (); - Event event = new Event (); - event.x = aScreenX[0]; - event.y = aScreenY[0]; + auto event = new Event; + event.x = aScreenX; + event.y = aScreenY; browser.notifyListeners (DWT.MenuDetect, event); - if (!event.doit || browser.isDisposed ()) return XPCOM.NS_OK; + if (!event.doit) return XPCOM.NS_OK; Menu menu = browser.getMenu (); if (menu !is null && !menu.isDisposed ()) { - if (aScreenX[0] !is event.x || aScreenY[0] !is event.y) { + if (aScreenX !is event.x || aScreenY !is event.y) { menu.setLocation (event.x, event.y); } menu.setVisible (true); @@ -2826,28 +2586,30 @@ /* nsIURIContentListener */ -int OnStartURIOpen (int /*long*/ aURI, int /*long*/ retval) { +extern(System) +nsresult OnStartURIOpen (nsIURI aURI, PRBool* retval) { if (awaitingNavigate || locationListeners.length is 0) { - XPCOM.memmove (retval, new int[] {0}, 4); /* PRBool */ + *retval = 0; + //XPCOM.memmove (retval, new int[] {0}, 4); /* PRBool */ return XPCOM.NS_OK; } - 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); + //nsIURI location = new nsIURI (aURI); + scope auto aSpec = new nsEmbedCString; + aURI.GetSpec (cast(nsACString*)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 = aSpec.toString; bool doit = true; - if (request is 0) { + if (request is null) { /* * listeners should not be notified of internal transitions like "javascipt:..." * because this is an implementation side-effect, not a true navigate */ - if (!value.startsWith cast(PREFIX_JAVASCRIPT)) { + if (!value.startsWith (PREFIX_JAVASCRIPT)) { LocationEvent event = new LocationEvent (browser); event.display = browser.getDisplay(); event.widget = browser; @@ -2856,7 +2618,7 @@ * If the URI indicates that the page is being rendered from memory * (via setText()) then set it to about:blank to be consistent with IE. */ - if (event.location.equals cast(URI_FROMMEMORY)) event.location = ABOUT_BLANK; + if (event.location.equals (URI_FROMMEMORY)) event.location = ABOUT_BLANK; event.doit = doit; for (int i = 0; i < locationListeners.length; i++) { locationListeners[i].changing (event); @@ -2864,57 +2626,64 @@ doit = event.doit && !browser.isDisposed(); } } - XPCOM.memmove (retval, new int[] {doit ? 0 : 1}, 4); /* PRBool */ + *retval = doit ? 0 : 1; + //XPCOM.memmove (retval, new int[] {doit ? 0 : 1}, 4); /* PRBool */ return XPCOM.NS_OK; } -int DoContent (int /*long*/ aContentType, int aIsContentPreferred, int /*long*/ aRequest, int /*long*/ aContentHandler, int /*long*/ retval) { +extern(System) +nsresult DoContent (char* aContentType, PRBool aIsContentPreferred, nsIRequest aRequest, nsIStreamListener* aContentHandler, PRBool* retval) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int IsPreferred (int /*long*/ aContentType, int /*long*/ aDesiredContentType, int /*long*/ retval) { +extern(System) +nsresult IsPreferred (char* aContentType, char** aDesiredContentType, PRBool* retval) { bool preferred = false; - int size = XPCOM.strlen (aContentType); + auto size = strlen (aContentType); if (size > 0) { - byte[] typeBytes = new byte[size + 1]; - XPCOM.memmove (typeBytes, aContentType, size); - String contentType = new String (typeBytes, 0, size); + //byte[] typeBytes = new byte[size + 1]; + //XPCOM.memmove (typeBytes, aContentType, size); + String contentType = fromStringz(aContentType); /* 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 !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); - nsIServiceManager serviceManager = new nsIServiceManager (result[0]); - result[0] = 0; + // int /*long*/[] result = new int /*long*/[1]; + nsIServiceManager serviceManager; + int rc = XPCOM.NS_GetServiceManager (&serviceManager); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (serviceManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); + //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); + //result[0] = 0; /* First try to use the nsIWebNavigationInfo if it's available (>= mozilla 1.8) */ - byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_WEBNAVIGATIONINFO_CONTRACTID, true); - rc = serviceManager.GetServiceByContractID (aContractID, nsIWebNavigationInfo.NS_IWEBNAVIGATIONINFO_IID, result); + //byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_WEBNAVIGATIONINFO_CONTRACTID, true); + nsIWebNavigationInfo info; + rc = serviceManager.GetServiceByContractID (XPCOM.NS_WEBNAVIGATIONINFO_CONTRACTID.ptr, &nsIWebNavigationInfo.IID, cast(void**)&info); if (rc is XPCOM.NS_OK) { - byte[] bytes = MozillaDelegate.wcsToMbcs (null, contentType, true); - int /*long*/ typePtr = XPCOM.nsEmbedCString_new (bytes, bytes.length); - nsIWebNavigationInfo info = new nsIWebNavigationInfo (result[0]); - result[0] = 0; - int[] isSupportedResult = new int[1]; /* PRUint32 */ - rc = info.IsTypeSupported (typePtr, 0, isSupportedResult); - if (rc !is XPCOM.NS_OK) error (rc); + //byte[] bytes = MozillaDelegate.wcsToMbcs (null, contentType, true); + scope auto typePtr = new nsEmbedCString(contentType); + //nsIWebNavigationInfo info = new nsIWebNavigationInfo (result[0]); + //result[0] = 0; + PRUint32 isSupportedResult; /* PRUint32 */ + rc = info.IsTypeSupported (cast(nsACString*)typePtr, null, &isSupportedResult); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); info.Release (); - XPCOM.nsEmbedCString_delete (typePtr); - preferred = isSupportedResult[0] !is 0; + //XPCOM.nsEmbedCString_delete (typePtr); + preferred = isSupportedResult !is 0; } else { /* nsIWebNavigationInfo is not available, so do the type lookup */ - result[0] = 0; - rc = serviceManager.GetService (XPCOM.NS_CATEGORYMANAGER_CID, nsICategoryManager.NS_ICATEGORYMANAGER_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); + //result[0] = 0; + nsICategoryManager categoryManager; + rc = serviceManager.GetService (&XPCOM.NS_CATEGORYMANAGER_CID, &nsICategoryManager.IID, cast(void**)&categoryManager); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (categoryManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); - 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); + //nsICategoryManager categoryManager = new nsICategoryManager (result[0]); + //result[0] = 0; + char* categoryBytes = "Gecko-Content-Viewers"; //$NON-NLS-1$ + char* result; + rc = categoryManager.GetCategoryEntry (categoryBytes, aContentType, &result); categoryManager.Release (); /* if no viewer for the content type is registered then rc is XPCOM.NS_ERROR_NOT_AVAILABLE */ preferred = rc is XPCOM.NS_OK; @@ -2923,42 +2692,48 @@ } } - XPCOM.memmove(retval, new int[] {preferred ? 1 : 0}, 4); /* PRBool */ + *retval = preferred ? 1 : 0; /* PRBool */ if (preferred) { - XPCOM.memmove (aDesiredContentType, new int /*long*/[] {0}, C.PTR_SIZEOF); + *aDesiredContentType = null; } return XPCOM.NS_OK; } -int CanHandleContent (int /*long*/ aContentType, int aIsContentPreferred, int /*long*/ aDesiredContentType, int /*long*/ retval) { +extern(System) +nsresult CanHandleContent (char* aContentType, PRBool aIsContentPreferred, char** aDesiredContentType, PRBool* retval) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetLoadCookie (int /*long*/ aLoadCookie) { +extern(System) +nsresult GetLoadCookie (nsISupports* aLoadCookie) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int SetLoadCookie (int /*long*/ aLoadCookie) { +extern(System) +nsresult SetLoadCookie (nsISupports aLoadCookie) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int GetParentContentListener (int /*long*/ aParentContentListener) { +extern(System) +nsresult GetParentContentListener (nsIURIContentListener* aParentContentListener) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } - -int SetParentContentListener (int /*long*/ aParentContentListener) { + +extern(System) +nsresult SetParentContentListener (nsIURIContentListener aParentContentListener) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } /* nsITooltipListener */ -int OnShowTooltip (int aXCoords, int aYCoords, int /*long*/ aTipText) { +extern(System) +nsresult OnShowTooltip (PRInt32 aXCoords, PRInt32 aYCoords, PRUnichar* aTipText) { if (awaitingNavigate) return XPCOM.NS_OK; - int length = XPCOM.strlen_PRUnichar (aTipText); - char[] dest = new char[length]; - XPCOM.memmove (dest, aTipText, length * 2); - String text = new String (dest); + //int length = XPCOM.strlen_PRUnichar (aTipText); + //char[] dest = new char[length]; + //XPCOM.memmove (dest, aTipText, length * 2); + String text = Utf.toString(fromString16z(aTipText)); if (tip !is null && !tip.isDisposed ()) tip.dispose (); Display display = browser.getDisplay (); Shell parent = browser.getShell (); @@ -2984,7 +2759,8 @@ return XPCOM.NS_OK; } -int OnHideTooltip () { +extern(System) +nsresult OnHideTooltip () { if (tip !is null && !tip.isDisposed ()) tip.dispose (); tip = null; return XPCOM.NS_OK; @@ -2992,48 +2768,51 @@ /* nsIDOMEventListener */ -int HandleEvent (int /*long*/ event) { - nsIDOMEvent domEvent = new nsIDOMEvent (event); +extern(System) +nsresult HandleEvent (nsIDOMEvent event) { + //nsIDOMEvent domEvent = new nsIDOMEvent (event); - int /*long*/ type = XPCOM.nsEmbedString_new (); - int rc = domEvent.GetType (type); - if (rc !is XPCOM.NS_OK) error (rc); - int length = XPCOM.nsEmbedString_Length (type); - int /*long*/ buffer = XPCOM.nsEmbedString_get (type); - char[] chars = new char[length]; - XPCOM.memmove (chars, buffer, length * 2); - String typeString = new String (chars); - XPCOM.nsEmbedString_delete (type); + scope auto type = new nsEmbedString; + int rc = event.GetType (cast(nsAString*)type); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + //int length = XPCOM.nsEmbedString_Length (type); + //int /*long*/ buffer = XPCOM.nsEmbedString_get (type); + //char[] chars = new char[length]; + //XPCOM.memmove (chars, buffer, length * 2); + String typeString = type.toString; + //XPCOM.nsEmbedString_delete (type); if (XPCOM.DOMEVENT_UNLOAD.equals (typeString)) { - int /*long*/[] result = new int /*long*/[1]; - rc = domEvent.GetCurrentTarget (result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); + //int /*long*/[] result = new int /*long*/[1]; + nsIDOMEventTarget target; + rc = event.GetCurrentTarget (&target); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (target is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); - nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); + //nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); unhookDOMListeners (target); target.Release (); return XPCOM.NS_OK; } if (XPCOM.DOMEVENT_FOCUS.equals (typeString)) { - delegate.handleFocus (); + mozDelegate.handleFocus (); return XPCOM.NS_OK; } if (XPCOM.DOMEVENT_KEYDOWN.equals (typeString)) { - int /*long*/[] result = new int /*long*/[1]; - rc = domEvent.QueryInterface (nsIDOMKeyEvent.NS_IDOMKEYEVENT_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); - nsIDOMKeyEvent domKeyEvent = new nsIDOMKeyEvent (result[0]); - result[0] = 0; + //int /*long*/[] result = new int /*long*/[1]; + nsIDOMKeyEvent domKeyEvent; + rc = event.QueryInterface (&nsIDOMKeyEvent.IID, cast(void**)&domKeyEvent); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (domKeyEvent is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); + //nsIDOMKeyEvent domKeyEvent = new nsIDOMKeyEvent (result[0]); + //result[0] = 0; - int[] aKeyCode = new int[1]; /* PRUint32 */ - rc = domKeyEvent.GetKeyCode (aKeyCode); - if (rc !is XPCOM.NS_OK) error (rc); - int keyCode = translateKey (aKeyCode[0]); + PRUint32 aKeyCode; /* PRUint32 */ + rc = domKeyEvent.GetKeyCode (&aKeyCode); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + int keyCode = super.translateKey (aKeyCode); /* * if keyCode is lastKeyCode then either a repeating key like Shift @@ -3051,25 +2830,25 @@ case DWT.SCROLL_LOCK: case DWT.COMMAND: { /* keypress events will not be received for these keys, so send KeyDowns for them now */ - int[] aAltKey = new int[1], aCtrlKey = new int[1], aShiftKey = new int[1], aMetaKey = new int[1]; /* PRBool */ - rc = domKeyEvent.GetAltKey (aAltKey); - if (rc !is XPCOM.NS_OK) error (rc); - rc = domKeyEvent.GetCtrlKey (aCtrlKey); - if (rc !is XPCOM.NS_OK) error (rc); - rc = domKeyEvent.GetShiftKey (aShiftKey); - if (rc !is XPCOM.NS_OK) error (rc); - rc = domKeyEvent.GetMetaKey (aMetaKey); - if (rc !is XPCOM.NS_OK) error (rc); + PRBool aAltKey, aCtrlKey, aShiftKey, aMetaKey; /* PRBool */ + rc = domKeyEvent.GetAltKey (&aAltKey); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = domKeyEvent.GetCtrlKey (&aCtrlKey); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = domKeyEvent.GetShiftKey (&aShiftKey); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = domKeyEvent.GetMetaKey (&aMetaKey); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); Event keyEvent = new Event (); keyEvent.widget = browser; keyEvent.type = DWT.KeyDown; keyEvent.keyCode = keyCode; - keyEvent.stateMask = (aAltKey[0] !is 0 ? DWT.ALT : 0) | (aCtrlKey[0] !is 0 ? DWT.CTRL : 0) | (aShiftKey[0] !is 0 ? DWT.SHIFT : 0) | (aMetaKey[0] !is 0 ? DWT.COMMAND : 0); + keyEvent.stateMask = (aAltKey !is 0 ? DWT.ALT : 0) | (aCtrlKey !is 0 ? DWT.CTRL : 0) | (aShiftKey !is 0 ? DWT.SHIFT : 0) | (aMetaKey !is 0 ? DWT.COMMAND : 0); keyEvent.stateMask &= ~keyCode; /* remove current keydown if it's a state key */ browser.notifyListeners (keyEvent.type, keyEvent); - if (!keyEvent.doit || browser.isDisposed ()) { - domEvent.PreventDefault (); + if (!keyEvent.doit) { + event.PreventDefault (); } break; } @@ -3080,28 +2859,28 @@ * does not have Meta as a modifier, or has Meta+Ctrl as a modifier, then then do nothing here * because its KeyDown event will be sent from the keypress listener. */ - int[] aMetaKey = new int[1]; /* PRBool */ - rc = domKeyEvent.GetMetaKey (aMetaKey); - if (rc !is XPCOM.NS_OK) error (rc); - if (aMetaKey[0] !is 0) { - int[] aCtrlKey = new int[1]; /* PRBool */ - rc = domKeyEvent.GetCtrlKey (aCtrlKey); - if (rc !is XPCOM.NS_OK) error (rc); - if (aCtrlKey[0] is 0) { - int[] aAltKey = new int[1], aShiftKey = new int[1]; /* PRBool */ - rc = domKeyEvent.GetAltKey (aAltKey); - if (rc !is XPCOM.NS_OK) error (rc); - rc = domKeyEvent.GetShiftKey (aShiftKey); - if (rc !is XPCOM.NS_OK) error (rc); + PRBool aMetaKey; /* PRBool */ + rc = domKeyEvent.GetMetaKey (&aMetaKey); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (aMetaKey !is 0) { + PRBool aCtrlKey; /* PRBool */ + rc = domKeyEvent.GetCtrlKey (&aCtrlKey); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (aCtrlKey is 0) { + PRBool aAltKey, aShiftKey; /* PRBool */ + rc = domKeyEvent.GetAltKey (&aAltKey); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = domKeyEvent.GetShiftKey (&aShiftKey); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); Event keyEvent = new Event (); keyEvent.widget = browser; keyEvent.type = DWT.KeyDown; keyEvent.keyCode = lastKeyCode; - keyEvent.stateMask = (aAltKey[0] !is 0 ? DWT.ALT : 0) | (aCtrlKey[0] !is 0? DWT.CTRL : 0) | (aShiftKey[0] !is 0? DWT.SHIFT : 0) | (aMetaKey[0] !is 0? DWT.COMMAND : 0); + keyEvent.stateMask = (aAltKey !is 0 ? DWT.ALT : 0) | (aCtrlKey !is 0? DWT.CTRL : 0) | (aShiftKey !is 0? DWT.SHIFT : 0) | (aMetaKey !is 0? DWT.COMMAND : 0); browser.notifyListeners (keyEvent.type, keyEvent); - if (!keyEvent.doit || browser.isDisposed ()) { - domEvent.PreventDefault (); + if (!keyEvent.doit) { + event.PreventDefault (); } } } @@ -3129,30 +2908,32 @@ case DWT.CAPS_LOCK: case DWT.NUM_LOCK: case DWT.SCROLL_LOCK: return XPCOM.NS_OK; + default: break; } - int /*long*/[] result = new int /*long*/[1]; - rc = domEvent.QueryInterface (nsIDOMKeyEvent.NS_IDOMKEYEVENT_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); - nsIDOMKeyEvent domKeyEvent = new nsIDOMKeyEvent (result[0]); - result[0] = 0; + //int /*long*/[] result = new int /*long*/[1]; + nsIDOMKeyEvent domKeyEvent; + rc = event.QueryInterface (&nsIDOMKeyEvent.IID, cast(void**)&domKeyEvent); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (domKeyEvent is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); + //nsIDOMKeyEvent domKeyEvent = new nsIDOMKeyEvent (result[0]); + //result[0] = 0; - int[] aAltKey = new int[1], aCtrlKey = new int[1], aShiftKey = new int[1], aMetaKey = new int[1]; /* PRBool */ - rc = domKeyEvent.GetAltKey (aAltKey); - if (rc !is XPCOM.NS_OK) error (rc); - rc = domKeyEvent.GetCtrlKey (aCtrlKey); - if (rc !is XPCOM.NS_OK) error (rc); - rc = domKeyEvent.GetShiftKey (aShiftKey); - if (rc !is XPCOM.NS_OK) error (rc); - rc = domKeyEvent.GetMetaKey (aMetaKey); - if (rc !is XPCOM.NS_OK) error (rc); + PRBool aAltKey, aCtrlKey, aShiftKey, aMetaKey; /* PRBool */ + rc = domKeyEvent.GetAltKey (&aAltKey); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = domKeyEvent.GetCtrlKey (&aCtrlKey); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = domKeyEvent.GetShiftKey (&aShiftKey); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = domKeyEvent.GetMetaKey (&aMetaKey); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); domKeyEvent.Release (); - int[] aCharCode = new int[1]; /* PRUint32 */ - rc = domKeyEvent.GetCharCode (aCharCode); - if (rc !is XPCOM.NS_OK) error (rc); - lastCharCode = aCharCode[0]; + PRUint32 aCharCode; /* PRUint32 */ + rc = domKeyEvent.GetCharCode (&aCharCode); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + lastCharCode = aCharCode; if (lastCharCode is 0) { switch (lastKeyCode) { case DWT.TAB: lastCharCode = DWT.TAB; break; @@ -3160,9 +2941,10 @@ case DWT.BS: lastCharCode = DWT.BS; break; case DWT.ESC: lastCharCode = DWT.ESC; break; case DWT.DEL: lastCharCode = DWT.DEL; break; + default: break; } } - if (aCtrlKey[0] !is 0 && (0 <= lastCharCode && lastCharCode <= 0x7F)) { + if (aCtrlKey !is 0 && (0 <= lastCharCode && lastCharCode <= 0x7F)) { if ('a' <= lastCharCode && lastCharCode <= 'z') lastCharCode -= 'a' - 'A'; if (64 <= lastCharCode && lastCharCode <= 95) lastCharCode -= 64; } @@ -3172,26 +2954,27 @@ keyEvent.type = DWT.KeyDown; keyEvent.keyCode = lastKeyCode; keyEvent.character = cast(wchar)lastCharCode; - keyEvent.stateMask = (aAltKey[0] !is 0 ? DWT.ALT : 0) | (aCtrlKey[0] !is 0 ? DWT.CTRL : 0) | (aShiftKey[0] !is 0 ? DWT.SHIFT : 0) | (aMetaKey[0] !is 0 ? DWT.COMMAND : 0); + keyEvent.stateMask = (aAltKey !is 0 ? DWT.ALT : 0) | (aCtrlKey !is 0 ? DWT.CTRL : 0) | (aShiftKey !is 0 ? DWT.SHIFT : 0) | (aMetaKey !is 0 ? DWT.COMMAND : 0); browser.notifyListeners (keyEvent.type, keyEvent); - if (!keyEvent.doit || browser.isDisposed ()) { - domEvent.PreventDefault (); + if (!keyEvent.doit) { + event.PreventDefault (); } return XPCOM.NS_OK; } if (XPCOM.DOMEVENT_KEYUP.equals (typeString)) { - int /*long*/[] result = new int /*long*/[1]; - rc = domEvent.QueryInterface (nsIDOMKeyEvent.NS_IDOMKEYEVENT_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); - nsIDOMKeyEvent domKeyEvent = new nsIDOMKeyEvent (result[0]); - result[0] = 0; + //int /*long*/[] result = new int /*long*/[1]; + nsIDOMKeyEvent domKeyEvent; + rc = event.QueryInterface (&nsIDOMKeyEvent.IID, cast(void**)&domKeyEvent); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (domKeyEvent is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); + //nsIDOMKeyEvent domKeyEvent = new nsIDOMKeyEvent (result[0]); + //result[0] = 0; - int[] aKeyCode = new int[1]; /* PRUint32 */ - rc = domKeyEvent.GetKeyCode (aKeyCode); - if (rc !is XPCOM.NS_OK) error (rc); - int keyCode = translateKey (aKeyCode[0]); + PRUint32 aKeyCode; /* PRUint32 */ + rc = domKeyEvent.GetKeyCode (&aKeyCode); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + int keyCode = super.translateKey (aKeyCode); if (keyCode is 0) { /* indicates a key for which key events are not sent */ domKeyEvent.Release (); @@ -3203,15 +2986,15 @@ lastCharCode = 0; } - int[] aAltKey = new int[1], aCtrlKey = new int[1], aShiftKey = new int[1], aMetaKey = new int[1]; /* PRBool */ - rc = domKeyEvent.GetAltKey (aAltKey); - if (rc !is XPCOM.NS_OK) error (rc); - rc = domKeyEvent.GetCtrlKey (aCtrlKey); - if (rc !is XPCOM.NS_OK) error (rc); - rc = domKeyEvent.GetShiftKey (aShiftKey); - if (rc !is XPCOM.NS_OK) error (rc); - rc = domKeyEvent.GetMetaKey (aMetaKey); - if (rc !is XPCOM.NS_OK) error (rc); + PRBool aAltKey, aCtrlKey, aShiftKey, aMetaKey; /* PRBool */ + rc = domKeyEvent.GetAltKey (&aAltKey); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = domKeyEvent.GetCtrlKey (&aCtrlKey); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = domKeyEvent.GetShiftKey (&aShiftKey); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = domKeyEvent.GetMetaKey (&aMetaKey); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); domKeyEvent.Release (); Event keyEvent = new Event (); @@ -3219,7 +3002,7 @@ keyEvent.type = DWT.KeyUp; keyEvent.keyCode = lastKeyCode; keyEvent.character = cast(wchar)lastCharCode; - keyEvent.stateMask = (aAltKey[0] !is 0 ? DWT.ALT : 0) | (aCtrlKey[0] !is 0 ? DWT.CTRL : 0) | (aShiftKey[0] !is 0 ? DWT.SHIFT : 0) | (aMetaKey[0] !is 0 ? DWT.COMMAND : 0); + keyEvent.stateMask = (aAltKey !is 0 ? DWT.ALT : 0) | (aCtrlKey !is 0 ? DWT.CTRL : 0) | (aShiftKey !is 0 ? DWT.SHIFT : 0) | (aMetaKey !is 0 ? DWT.COMMAND : 0); switch (lastKeyCode) { case DWT.SHIFT: case DWT.CONTROL: @@ -3227,10 +3010,11 @@ case DWT.COMMAND: { keyEvent.stateMask |= lastKeyCode; } + default: break; } browser.notifyListeners (keyEvent.type, keyEvent); - if (!keyEvent.doit || browser.isDisposed ()) { - domEvent.PreventDefault (); + if (!keyEvent.doit) { + event.PreventDefault (); } lastKeyCode = lastCharCode = 0; return XPCOM.NS_OK; @@ -3238,12 +3022,13 @@ /* mouse event */ - int /*long*/[] result = new int /*long*/[1]; - rc = domEvent.QueryInterface (nsIDOMMouseEvent.NS_IDOMMOUSEEVENT_IID, result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] is 0) error (XPCOM.NS_NOINTERFACE); - nsIDOMMouseEvent domMouseEvent = new nsIDOMMouseEvent (result[0]); - result[0] = 0; + //int /*long*/[] result = new int /*long*/[1]; + nsIDOMMouseEvent domMouseEvent; + rc = event.QueryInterface (&nsIDOMMouseEvent.IID, cast(void**)&domMouseEvent); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (domMouseEvent is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); + //nsIDOMMouseEvent domMouseEvent = new nsIDOMMouseEvent (result[0]); + //result[0] = 0; /* * MouseOver and MouseOut events are fired any time the mouse enters or exits @@ -3253,45 +3038,46 @@ * is within the Browser. */ if (XPCOM.DOMEVENT_MOUSEOVER.equals (typeString) || XPCOM.DOMEVENT_MOUSEOUT.equals (typeString)) { - rc = domMouseEvent.GetRelatedTarget (result); - if (rc !is XPCOM.NS_OK) error (rc); - if (result[0] !is 0) { + nsIDOMEventTarget eventTarget; + rc = domMouseEvent.GetRelatedTarget (&eventTarget); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + if (eventTarget !is null) { domMouseEvent.Release (); return XPCOM.NS_OK; } } - int[] aClientX = new int[1], aClientY = new int[1], aDetail = new int[1]; /* PRInt32 */ - rc = domMouseEvent.GetClientX (aClientX); - if (rc !is XPCOM.NS_OK) error (rc); - rc = domMouseEvent.GetClientY (aClientY); - if (rc !is XPCOM.NS_OK) error (rc); - rc = domMouseEvent.GetDetail (aDetail); - if (rc !is XPCOM.NS_OK) error (rc); - short[] aButton = new short[1]; /* PRUint16 */ - rc = domMouseEvent.GetButton (aButton); - if (rc !is XPCOM.NS_OK) error (rc); - int[] aAltKey = new int[1], aCtrlKey = new int[1], aShiftKey = new int[1], aMetaKey = new int[1]; /* PRBool */ - rc = domMouseEvent.GetAltKey (aAltKey); - if (rc !is XPCOM.NS_OK) error (rc); - rc = domMouseEvent.GetCtrlKey (aCtrlKey); - if (rc !is XPCOM.NS_OK) error (rc); - rc = domMouseEvent.GetShiftKey (aShiftKey); - if (rc !is XPCOM.NS_OK) error (rc); - rc = domMouseEvent.GetMetaKey (aMetaKey); - if (rc !is XPCOM.NS_OK) error (rc); + PRInt32 aClientX, aClientY, aDetail; /* PRInt32 */ + rc = domMouseEvent.GetClientX (&aClientX); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = domMouseEvent.GetClientY (&aClientY); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = domMouseEvent.GetDetail (&aDetail); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + PRUint16 aButton; /* PRUint16 */ + rc = domMouseEvent.GetButton (&aButton); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + PRBool aAltKey, aCtrlKey, aShiftKey, aMetaKey; /* PRBool */ + rc = domMouseEvent.GetAltKey (&aAltKey); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = domMouseEvent.GetCtrlKey (&aCtrlKey); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = domMouseEvent.GetShiftKey (&aShiftKey); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); + rc = domMouseEvent.GetMetaKey (&aMetaKey); + if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); domMouseEvent.Release (); Event mouseEvent = new Event (); mouseEvent.widget = browser; - mouseEvent.x = aClientX[0]; mouseEvent.y = aClientY[0]; - mouseEvent.stateMask = (aAltKey[0] !is 0 ? DWT.ALT : 0) | (aCtrlKey[0] !is 0 ? DWT.CTRL : 0) | (aShiftKey[0] !is 0 ? DWT.SHIFT : 0) | (aMetaKey[0] !is 0 ? DWT.COMMAND : 0); + mouseEvent.x = aClientX; mouseEvent.y = aClientY; + mouseEvent.stateMask = (aAltKey !is 0 ? DWT.ALT : 0) | (aCtrlKey !is 0 ? DWT.CTRL : 0) | (aShiftKey !is 0 ? DWT.SHIFT : 0) | (aMetaKey !is 0 ? DWT.COMMAND : 0); if (XPCOM.DOMEVENT_MOUSEDOWN.equals (typeString)) { - delegate.handleMouseDown (); + mozDelegate.handleMouseDown (); mouseEvent.type = DWT.MouseDown; - mouseEvent.button = aButton[0] + 1; - mouseEvent.count = aDetail[0]; + mouseEvent.button = aButton + 1; + mouseEvent.count = aDetail; } else if (XPCOM.DOMEVENT_MOUSEUP.equals (typeString)) { /* * Bug on OSX. For some reason multiple mouseup events come from the DOM @@ -3300,8 +3086,8 @@ * button 3 mouseup events that do not have a count since mouse events * without a click count are not valid. */ - int button = aButton[0] + 1; - int count = aDetail[0]; + int button = aButton + 1; + int count = aDetail; if (count is 0 && button is 3) return XPCOM.NS_OK; mouseEvent.type = DWT.MouseUp; mouseEvent.button = button; @@ -3310,33 +3096,33 @@ mouseEvent.type = DWT.MouseMove; } else if (XPCOM.DOMEVENT_MOUSEWHEEL.equals (typeString)) { mouseEvent.type = DWT.MouseWheel; - mouseEvent.count = -aDetail[0]; + mouseEvent.count = -aDetail; } else if (XPCOM.DOMEVENT_MOUSEOVER.equals (typeString)) { mouseEvent.type = DWT.MouseEnter; } else if (XPCOM.DOMEVENT_MOUSEOUT.equals (typeString)) { mouseEvent.type = DWT.MouseExit; } else if (XPCOM.DOMEVENT_MOUSEDRAG.equals (typeString)) { mouseEvent.type = DWT.DragDetect; - mouseEvent.button = aButton[0] + 1; + mouseEvent.button = aButton + 1; switch (mouseEvent.button) { case 1: mouseEvent.stateMask |= DWT.BUTTON1; break; case 2: mouseEvent.stateMask |= DWT.BUTTON2; break; case 3: mouseEvent.stateMask |= DWT.BUTTON3; break; case 4: mouseEvent.stateMask |= DWT.BUTTON4; break; case 5: mouseEvent.stateMask |= DWT.BUTTON5; break; + default: break; } } browser.notifyListeners (mouseEvent.type, mouseEvent); - if (browser.isDisposed ()) return XPCOM.NS_OK; - if (aDetail[0] is 2 && XPCOM.DOMEVENT_MOUSEDOWN.equals (typeString)) { + if (aDetail is 2 && XPCOM.DOMEVENT_MOUSEDOWN.equals (typeString)) { mouseEvent = new Event (); mouseEvent.widget = browser; - mouseEvent.x = aClientX[0]; mouseEvent.y = aClientY[0]; - mouseEvent.stateMask = (aAltKey[0] !is 0 ? DWT.ALT : 0) | (aCtrlKey[0] !is 0 ? DWT.CTRL : 0) | (aShiftKey[0] !is 0 ? DWT.SHIFT : 0) | (aMetaKey[0] !is 0 ? DWT.COMMAND : 0); + mouseEvent.x = aClientX; mouseEvent.y = aClientY; + mouseEvent.stateMask = (aAltKey !is 0 ? DWT.ALT : 0) | (aCtrlKey !is 0 ? DWT.CTRL : 0) | (aShiftKey !is 0 ? DWT.SHIFT : 0) | (aMetaKey !is 0 ? DWT.COMMAND : 0); mouseEvent.type = DWT.MouseDoubleClick; - mouseEvent.button = aButton[0] + 1; - mouseEvent.count = aDetail[0]; + mouseEvent.button = aButton + 1; + mouseEvent.count = aDetail; browser.notifyListeners (mouseEvent.type, mouseEvent); } return XPCOM.NS_OK;
--- a/dwt/browser/MozillaDelegate.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/MozillaDelegate.d Fri Jan 16 12:49:08 2009 +0100 @@ -21,6 +21,7 @@ import dwt.widgets.Listener; import dwt.browser.Browser; +import dwt.browser.Mozilla; import objc = dwt.internal.objc.runtime; class MozillaDelegate { @@ -29,7 +30,6 @@ boolean hasFocus; this (Browser browser) { - super (); this.browser = browser; } @@ -38,7 +38,7 @@ return cast(Browser)display.findWidget (handle); } -static char[] mbcsToWcs (String codePage, byte [] buffer) { +/+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; @@ -54,10 +54,10 @@ // } // return chars; // TODO implement mbcsToWcs - return new String(buffer).toCharArray(); -} + return new_String(buffer).toCharArray(); +}+/ -static byte[] wcsToMbcs (String codePage, String string, boolean terminate) { +/+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); @@ -78,9 +78,9 @@ // TODO implement wcsToMbcs if (terminate) string += "\0"; return string.getBytes(); -} +}+/ -int /*long*/ getHandle () { +objc.id getHandle () { return browser.view.id; } @@ -95,21 +95,21 @@ void handleFocus () { if (hasFocus) return; hasFocus = true; - ((Mozilla)browser.webBrowser).Activate (); + (cast(Mozilla)browser.webBrowser).Activate (); browser.setFocus (); - listener = new Listener () { + listener = new class () Listener { public void handleEvent (Event event) { if (event.widget == browser) return; - ((Mozilla)browser.webBrowser).Deactivate (); + (cast(Mozilla)browser.webBrowser).Deactivate (); hasFocus = false; - browser.getDisplay ().removeFilter (SWT.FocusIn, this); - browser.getShell ().removeListener (SWT.Deactivate, this); + browser.getDisplay ().removeFilter (DWT.FocusIn, this); + browser.getShell ().removeListener (DWT.Deactivate, this); listener = null; } }; - browser.getDisplay ().addFilter (SWT.FocusIn, listener); - browser.getShell ().addListener (SWT.Deactivate, listener); + browser.getDisplay ().addFilter (DWT.FocusIn, listener); + browser.getShell ().addListener (DWT.Deactivate, listener); } void handleMouseDown () { @@ -126,16 +126,16 @@ return false; } -void onDispose (int /*long*/ embedHandle) { - if (listener != null) { - browser.getDisplay ().removeFilter (SWT.FocusIn, listener); - browser.getShell ().removeListener (SWT.Deactivate, listener); +void onDispose (objc.id embedHandle) { + if (listener !is null) { + browser.getDisplay ().removeFilter (DWT.FocusIn, listener); + browser.getShell ().removeListener (DWT.Deactivate, listener); listener = null; } browser = null; } -void setSize (int /*long*/ embedHandle, int width, int height) { +void setSize (objc.id embedHandle, int width, int height) { // TODO }
--- a/dwt/browser/OpenWindowListener.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/OpenWindowListener.d Fri Jan 16 12:49:08 2009 +0100 @@ -7,15 +7,13 @@ * * Contributors: * IBM Corporation - initial API and implementation - * * Port to the D programming language: - * Jacob Carlborg <doob@me.com> + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.OpenWindowListener; +import dwt.internal.DWTEventListener; import dwt.browser.WindowEvent; -import dwt.dwthelper.utils; -import dwt.internal.DWTEventListener; /** * This listener interface may be implemented in order to receive @@ -31,35 +29,35 @@ */ public interface OpenWindowListener : DWTEventListener { - /** - * This method is called when a new window needs to be created. - * <p> - * A particular <code>Browser</code> can be passed to the event.browser - * field to host the content of a new window. - * <p> - * A standalone system browser is used to host the new window - * if the event.required field value is false and if the event.browser - * field is left <code>null</code>. The event.required field - * is true on platforms that don't support a standalone system browser for - * new window requests. - * <p> - * The navigation is cancelled if the event.required field is set to - * true and the event.browser field is left <code>null</code>. - * <p> - * <p>The following fields in the <code>WindowEvent</code> apply: - * <ul> - * <li>(in/out) required true if the platform requires the user to provide a - * <code>Browser</code> to handle the new window or false otherwise. - * <li>(out) browser the new <code>Browser</code> that will host the - * content of the new window. - * <li>(in) widget the <code>Browser</code> that is requesting to open a - * new window - * </ul> - * - * @param event the <code>WindowEvent</code> that needs to be passed a new - * <code>Browser</code> to handle the new window request - * - * @since 3.0 - */ - public void open (WindowEvent event); +/** + * This method is called when a new window needs to be created. + * <p> + * A particular <code>Browser</code> can be passed to the event.browser + * field to host the content of a new window. + * <p> + * A standalone system browser is used to host the new window + * if the event.required field value is false and if the event.browser + * field is left <code>null</code>. The event.required field + * is true on platforms that don't support a standalone system browser for + * new window requests. + * <p> + * The navigation is cancelled if the event.required field is set to + * true and the event.browser field is left <code>null</code>. + * <p> + * <p>The following fields in the <code>WindowEvent</code> apply: + * <ul> + * <li>(in/out) required true if the platform requires the user to provide a + * <code>Browser</code> to handle the new window or false otherwise. + * <li>(out) browser the new <code>Browser</code> that will host the + * content of the new window. + * <li>(in) widget the <code>Browser</code> that is requesting to open a + * new window + * </ul> + * + * @param event the <code>WindowEvent</code> that needs to be passed a new + * <code>Browser</code> to handle the new window request + * + * @since 3.0 + */ +public void open(WindowEvent event); }
--- a/dwt/browser/ProgressAdapter.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/ProgressAdapter.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,5 +1,5 @@ -/******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. +/******************************************************************************* + * Copyright (c) 2003, 2004 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 @@ -7,15 +7,13 @@ * * Contributors: * IBM Corporation - initial API and implementation - * * Port to the D programming language: - * Jacob Carlborg <doob@me.com> + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.ProgressAdapter; +import dwt.browser.ProgressEvent; import dwt.browser.ProgressListener; -import dwt.browser.ProgressEvent; -import dwt.dwthelper.utils; /** * This adapter class provides default implementations for the @@ -26,15 +24,13 @@ * interested in. * </p> * - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * * @since 3.0 */ public abstract class ProgressAdapter : ProgressListener { - - public void changed (ProgressEvent event) { - } + +public void changed(ProgressEvent event) { +} - public void completed (ProgressEvent event) { - } +public void completed(ProgressEvent event) { } +}
--- a/dwt/browser/ProgressEvent.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/ProgressEvent.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,5 +1,5 @@ -/******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. +/******************************************************************************* + * Copyright (c) 2003, 2004 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 @@ -7,14 +7,15 @@ * * Contributors: * IBM Corporation - initial API and implementation - * * Port to the D programming language: - * Jacob Carlborg <doob@me.com> + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.ProgressEvent; -import dwt.dwthelper.string; +import tango.text.convert.Format; + import dwt.dwthelper.utils; + import dwt.events.TypedEvent; import dwt.widgets.Widget; @@ -24,32 +25,28 @@ * loading of the current URL or when the loading of the current * URL has been completed. * - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * * @since 3.0 */ public class ProgressEvent : TypedEvent { /** current value */ public int current; - /** total value */ public int total; - - static const long serialVersionUID = 3977018427045393972L; + + static final long serialVersionUID = 3977018427045393972L; - this (Widget w) { - super(w); - } +this(Widget w) { + super(w); +} - /** - * Returns a string containing a concise, human-readable - * description of the receiver. - * - * @return a string representation of the event - */ - public String toString () { - String str = super.toString(); - return str.substring(0, str.length() - 1) // remove trailing '}' - + " current=" + current + " total=" + total + "}"; - } +/** + * Returns a string containing a concise, human-readable + * description of the receiver. + * + * @return a string representation of the event + */ +public override String toString() { + return Format( "{} {current = {}, total = {}}", + super.toString[1 .. $-2], current, total ); } +}
--- a/dwt/browser/ProgressListener.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/ProgressListener.d Fri Jan 16 12:49:08 2009 +0100 @@ -7,14 +7,12 @@ * * Contributors: * IBM Corporation - initial API and implementation - * * Port to the D programming language: - * Jacob Carlborg <doob@me.com> + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.ProgressListener; import dwt.browser.ProgressEvent; -import dwt.dwthelper.utils; import dwt.internal.DWTEventListener; /** @@ -30,39 +28,39 @@ * @since 3.0 */ public interface ProgressListener : DWTEventListener { - - /** - * This method is called when a progress is made during the loading of the - * current location. - * <p> - * - * <p>The following fields in the <code>ProgressEvent</code> apply: - * <ul> - * <li>(in) current the progress for the location currently being loaded - * <li>(in) total the maximum progress for the location currently being loaded - * <li>(in) widget the <code>Browser</code> whose current URL is being loaded - * </ul> - * - * @param event the <code>ProgressEvent</code> related to the loading of the - * current location of a <code>Browser</code> - * - * @since 3.0 - */ - public void changed (ProgressEvent event); - - /** - * This method is called when the current location has been completely loaded. - * <p> - * - * <p>The following fields in the <code>ProgressEvent</code> apply: - * <ul> - * <li>(in) widget the <code>Browser</code> whose current URL has been loaded - * </ul> - * - * @param event the <code>ProgressEvent</code> related to the <code>Browser</code> - * that has loaded its current URL. - * - * @since 3.0 - */ - public void completed (ProgressEvent event); + +/** + * This method is called when a progress is made during the loading of the + * current location. + * <p> + * + * <p>The following fields in the <code>ProgressEvent</code> apply: + * <ul> + * <li>(in) current the progress for the location currently being loaded + * <li>(in) total the maximum progress for the location currently being loaded + * <li>(in) widget the <code>Browser</code> whose current URL is being loaded + * </ul> + * + * @param event the <code>ProgressEvent</code> related to the loading of the + * current location of a <code>Browser</code> + * + * @since 3.0 + */ +public void changed(ProgressEvent event); + +/** + * This method is called when the current location has been completely loaded. + * <p> + * + * <p>The following fields in the <code>ProgressEvent</code> apply: + * <ul> + * <li>(in) widget the <code>Browser</code> whose current URL has been loaded + * </ul> + * + * @param event the <code>ProgressEvent</code> related to the <code>Browser</code> + * that has loaded its current URL. + * + * @since 3.0 + */ +public void completed(ProgressEvent event); }
--- a/dwt/browser/PromptDialog.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/PromptDialog.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * 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 @@ -7,9 +7,12 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Port to the D programming language: + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.PromptDialog; +import Math = tango.math.Math; import dwt.dwthelper.utils; import dwt.DWT; @@ -37,16 +40,16 @@ this(parent, 0); } - void alertCheck(String title, String text, String check, final int[] checkValue) { + void alertCheck(String title, String text, String check, ref int checkValue) { Shell parent = getParent(); - final Shell shell = new Shell(parent, DWT.DIALOG_TRIM | DWT.APPLICATION_MODAL); + /* final */ Shell shell = new Shell(parent, DWT.DIALOG_TRIM | DWT.APPLICATION_MODAL); if (title !is null) shell.setText(title); GridLayout gridLayout = new GridLayout(); shell.setLayout(gridLayout); Label label = new Label(shell, DWT.WRAP); label.setText(text); GridData data = new GridData(); - Monitor monitor = parent.getMonitor(); + dwt.widgets.Monitor.Monitor monitor = parent.getMonitor(); int maxWidth = monitor.getBounds().width * 2 / 3; int width = label.computeSize(DWT.DEFAULT, DWT.DEFAULT).x; data.widthHint = Math.min(width, maxWidth); @@ -57,19 +60,20 @@ final Button checkButton = check !is null ? new Button(shell, DWT.CHECK) : null; if (checkButton !is null) { checkButton.setText(check); - checkButton.setSelection(checkValue[0] !is 0); + checkButton.setSelection(checkValue !is 0); data = new GridData (); data.horizontalAlignment = GridData.BEGINNING; checkButton.setLayoutData (data); } Button okButton = new Button(shell, DWT.PUSH); - okButton.setText(DWT.getMessage("DWT_OK")); //$NON-NLS-1$ + okButton.setText("OK"); // TODO: Need to do this through Resource Bundle + //okButton.setText(DWT.getMessage("SWT_OK")); //$NON-NLS-1$ data = new GridData (); data.horizontalAlignment = GridData.CENTER; okButton.setLayoutData (data); - okButton.addListener(DWT.Selection, new Listener() { + okButton.addListener(DWT.Selection, new class() Listener { public void handleEvent(Event event) { - if (checkButton !is null) checkValue[0] = checkButton.getSelection() ? 1 : 0; + if (checkButton !is null) checkValue = checkButton.getSelection() ? 1 : 0; shell.close(); } }); @@ -82,16 +86,16 @@ } } - void confirmEx(String title, String text, String check, String button0, String button1, String button2, int defaultIndex, final int[] checkValue, final int[] result) { + void confirmEx(String title, String text, String check, String button0, String button1, String button2, int defaultIndex, ref int checkValue, ref int result) { Shell parent = getParent(); - final Shell shell = new Shell(parent, DWT.DIALOG_TRIM | DWT.APPLICATION_MODAL); + /* final */ Shell shell = new Shell(parent, DWT.DIALOG_TRIM | DWT.APPLICATION_MODAL); shell.setText(title); GridLayout gridLayout = new GridLayout(); shell.setLayout(gridLayout); Label label = new Label(shell, DWT.WRAP); label.setText(text); GridData data = new GridData(); - Monitor monitor = parent.getMonitor(); + dwt.widgets.Monitor.Monitor monitor = parent.getMonitor(); int maxWidth = monitor.getBounds().width * 2 / 3; int width = label.computeSize(DWT.DEFAULT, DWT.DEFAULT).x; data.widthHint = Math.min(width, maxWidth); @@ -100,13 +104,13 @@ label.setLayoutData (data); final Button[] buttons = new Button[4]; - Listener listener = new Listener() { + Listener listener = new class() Listener { public void handleEvent(Event event) { - if (buttons[0] !is null) checkValue[0] = buttons[0].getSelection() ? 1 : 0; + if (buttons[0] !is null) checkValue = buttons[0].getSelection() ? 1 : 0; Widget widget = event.widget; for (int i = 1; i < buttons.length; i++) { if (widget is buttons[i]) { - result[0] = i - 1; + result = i - 1; break; } } @@ -116,7 +120,7 @@ if (check !is null) { buttons[0] = new Button(shell, DWT.CHECK); buttons[0].setText(check); - buttons[0].setSelection(checkValue[0] !is 0); + buttons[0].setSelection(checkValue !is 0); data = new GridData (); data.horizontalAlignment = GridData.BEGINNING; buttons[0].setLayoutData (data); @@ -162,16 +166,16 @@ } } - void prompt(String title, String text, String check, final String[] value, final int[] checkValue, final int[] result) { + void prompt(String title, String text, String check, /* final */ref String value, /* final */ ref int checkValue, /* final */ref int result) { Shell parent = getParent(); - final Shell shell = new Shell(parent, DWT.DIALOG_TRIM | DWT.APPLICATION_MODAL); + /* final */ Shell shell = new Shell(parent, DWT.DIALOG_TRIM | DWT.APPLICATION_MODAL); if (title !is null) shell.setText(title); GridLayout gridLayout = new GridLayout(); shell.setLayout(gridLayout); Label label = new Label(shell, DWT.WRAP); label.setText(text); GridData data = new GridData(); - Monitor monitor = parent.getMonitor(); + dwt.widgets.Monitor.Monitor monitor = parent.getMonitor(); int maxWidth = monitor.getBounds().width * 2 / 3; int width = label.computeSize(DWT.DEFAULT, DWT.DEFAULT).x; data.widthHint = Math.min(width, maxWidth); @@ -180,7 +184,7 @@ label.setLayoutData (data); final Text valueText = new Text(shell, DWT.BORDER); - if (value[0] !is null) valueText.setText(value[0]); + if (value !is null) valueText.setText(value); data = new GridData(); width = valueText.computeSize(DWT.DEFAULT, DWT.DEFAULT).x; if (width > maxWidth) data.widthHint = maxWidth; @@ -189,18 +193,18 @@ valueText.setLayoutData(data); final Button[] buttons = new Button[3]; - Listener listener = new Listener() { + Listener listener = new class() Listener { public void handleEvent(Event event) { - if (buttons[0] !is null) checkValue[0] = buttons[0].getSelection() ? 1 : 0; - value[0] = valueText.getText(); - result[0] = event.widget is buttons[1] ? 1 : 0; + if (buttons[0] !is null) checkValue = buttons[0].getSelection() ? 1 : 0; + value = valueText.getText(); + result = event.widget is buttons[1] ? 1 : 0; shell.close(); } }; if (check !is null) { buttons[0] = new Button(shell, DWT.CHECK); buttons[0].setText(check); - buttons[0].setSelection(checkValue[0] !is 0); + buttons[0].setSelection(checkValue !is 0); data = new GridData (); data.horizontalAlignment = GridData.BEGINNING; buttons[0].setLayoutData (data); @@ -211,11 +215,13 @@ composite.setLayoutData (data); composite.setLayout(new GridLayout(2, true)); buttons[1] = new Button(composite, DWT.PUSH); - buttons[1].setText(DWT.getMessage("DWT_OK")); //$NON-NLS-1$ + //buttons[1].setText(DWT.getMessage("SWT_OK")); //$NON-NLS-1$ + buttons[1].setText("OK"); buttons[1].setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); buttons[1].addListener(DWT.Selection, listener); buttons[2] = new Button(composite, DWT.PUSH); - buttons[2].setText(DWT.getMessage("DWT_Cancel")); //$NON-NLS-1$ + //buttons[2].setText(DWT.getMessage("SWT_Cancel")); //$NON-NLS-1$ + buttons[2].setText("Cancel"); buttons[2].setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); buttons[2].addListener(DWT.Selection, listener); @@ -227,16 +233,16 @@ } } - void promptUsernameAndPassword(String title, String text, String check, final String[] user, final String[] pass, final int[] checkValue, final int[] result) { + void promptUsernameAndPassword(String title, String text, String check, ref String user, ref String pass, ref int checkValue, ref int result) { Shell parent = getParent(); - final Shell shell = new Shell(parent, DWT.DIALOG_TRIM | DWT.APPLICATION_MODAL); + /* final */ Shell shell = new Shell(parent, DWT.DIALOG_TRIM | DWT.APPLICATION_MODAL); shell.setText(title); GridLayout gridLayout = new GridLayout(); shell.setLayout(gridLayout); Label label = new Label(shell, DWT.WRAP); label.setText(text); GridData data = new GridData(); - Monitor monitor = parent.getMonitor(); + dwt.widgets.Monitor.Monitor monitor = parent.getMonitor(); int maxWidth = monitor.getBounds().width * 2 / 3; int width = label.computeSize(DWT.DEFAULT, DWT.DEFAULT).x; data.widthHint = Math.min(width, maxWidth); @@ -245,39 +251,39 @@ label.setLayoutData (data); Label userLabel = new Label(shell, DWT.NONE); - userLabel.setText(DWT.getMessage("DWT_Username")); //$NON-NLS-1$ - + //userLabel.setText(DWT.getMessage("SWT_Username")); //$NON-NLS-1$ + userLabel.setText("Username:"); final Text userText = new Text(shell, DWT.BORDER); - if (user[0] !is null) userText.setText(user[0]); + if (user !is null) userText.setText(user); data = new GridData(); data.horizontalAlignment = GridData.FILL; data.grabExcessHorizontalSpace = true; userText.setLayoutData(data); Label passwordLabel = new Label(shell, DWT.NONE); - passwordLabel.setText(DWT.getMessage("DWT_Password")); //$NON-NLS-1$ - + //passwordLabel.setText(DWT.getMessage("SWT_Password")); //$NON-NLS-1$ + passwordLabel.setText("Password:"); final Text passwordText = new Text(shell, DWT.PASSWORD | DWT.BORDER); - if (pass[0] !is null) passwordText.setText(pass[0]); + if (pass !is null) passwordText.setText(pass); data = new GridData(); data.horizontalAlignment = GridData.FILL; data.grabExcessHorizontalSpace = true; passwordText.setLayoutData(data); final Button[] buttons = new Button[3]; - Listener listener = new Listener() { + Listener listener = new class() Listener { public void handleEvent(Event event) { - if (buttons[0] !is null) checkValue[0] = buttons[0].getSelection() ? 1 : 0; - user[0] = userText.getText(); - pass[0] = passwordText.getText(); - result[0] = event.widget is buttons[1] ? 1 : 0; + if (buttons[0] !is null) checkValue = buttons[0].getSelection() ? 1 : 0; + user = userText.getText(); + pass = passwordText.getText(); + result = event.widget is buttons[1] ? 1 : 0; shell.close(); } }; if (check !is null) { buttons[0] = new Button(shell, DWT.CHECK); buttons[0].setText(check); - buttons[0].setSelection(checkValue[0] !is 0); + buttons[0].setSelection(checkValue !is 0); data = new GridData (); data.horizontalAlignment = GridData.BEGINNING; buttons[0].setLayoutData (data); @@ -288,11 +294,13 @@ composite.setLayoutData (data); composite.setLayout(new GridLayout(2, true)); buttons[1] = new Button(composite, DWT.PUSH); - buttons[1].setText(DWT.getMessage("DWT_OK")); //$NON-NLS-1$ + //buttons[1].setText(DWT.getMessage("SWT_OK")); //$NON-NLS-1$ + buttons[1].setText("OK"); buttons[1].setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); buttons[1].addListener(DWT.Selection, listener); buttons[2] = new Button(composite, DWT.PUSH); - buttons[2].setText(DWT.getMessage("DWT_Cancel")); //$NON-NLS-1$ + //buttons[2].setText(DWT.getMessage("SWT_Cancel")); //$NON-NLS-1$ + buttons[2].setText("Cancel"); buttons[2].setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); buttons[2].addListener(DWT.Selection, listener);
--- a/dwt/browser/PromptService2.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/PromptService2.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2003, 2008 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 @@ -7,156 +7,161 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Port to the D programming language: + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.PromptService2; +import tango.stdc.stdlib; +import tango.text.convert.Format; + import dwt.dwthelper.utils; import dwt.DWT; -import dwt.internal.C; + import dwt.internal.Compatibility; -import dwt.internal.mozilla.XPCOM; -import dwt.internal.mozilla.XPCOMObject; + +import XPCOM = dwt.internal.mozilla.XPCOM; + +import dwt.internal.mozilla.Common; import dwt.internal.mozilla.nsEmbedString; import dwt.internal.mozilla.nsIAuthInformation; import dwt.internal.mozilla.nsIChannel; import dwt.internal.mozilla.nsID; import dwt.internal.mozilla.nsIDOMWindow; +import dwt.internal.mozilla.nsIEmbeddingSiteWindow; import dwt.internal.mozilla.nsIMemory; import dwt.internal.mozilla.nsIPromptService; import dwt.internal.mozilla.nsIPromptService2; import dwt.internal.mozilla.nsIServiceManager; import dwt.internal.mozilla.nsISupports; import dwt.internal.mozilla.nsIURI; +import dwt.internal.mozilla.nsIWebBrowserChrome; +import dwt.internal.mozilla.nsIWindowWatcher; +import dwt.internal.mozilla.nsIAuthPromptCallback; +import dwt.internal.mozilla.nsICancelable; +import dwt.internal.mozilla.nsStringAPI; + import dwt.widgets.MessageBox; import dwt.widgets.Shell; -class PromptService2 { - XPCOMObject supports; - XPCOMObject promptService; - XPCOMObject promptService2; +import dwt.browser.Browser; +import dwt.browser.Mozilla; +import dwt.browser.PromptDialog; + +class PromptService2 : nsIPromptService2 { int refCount = 0; this () { - createCOMInterfaces (); } -int AddRef () { +extern(System) +nsrefcnt 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], cast(int)/*64*/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], cast(int)/*64*/args[3], args[4], args[5], args[6]);} - }; - - promptService2 = new XPCOMObject (new int[] {2, 0, 0, 3, 5, 4, 6, 10, 7, 8, 7, 7, 7, 9}) { - 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], cast(int)/*64*/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], cast(int)/*64*/args[3], args[4], args[5], args[6]);} - public int /*long*/ method12 (int /*long*/[] args) {return PromptAuth (args[0], args[1], cast(int)/*64*/args[2], args[3], args[4], args[5], args[6]);} - public int /*long*/ method13 (int /*long*/[] args) {return AsyncPromptAuth (args[0], args[1], args[2], args[3], cast(int)/*64*/args[4], args[5], args[6], args[7], args[8]);} - }; -} - -void disposeCOMInterfaces () { - if (supports !is null) { - supports.dispose (); - supports = null; - } - if (promptService !is null) { - promptService.dispose (); - promptService = null; - } - if (promptService2 !is null) { - promptService2.dispose (); - promptService2 = null; - } -} - -int /*long*/ getAddress () { - return promptService2.getAddress (); -} - -int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) { - if (riid is 0 || ppvObject is 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); +extern(System) +nsresult QueryInterface (nsID* riid, void** ppvObject) { + if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; + + if (*riid == nsISupports.IID) { + *ppvObject = cast(void*)cast(nsISupports)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIPromptService.NS_IPROMPTSERVICE_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {promptService.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIPromptService.IID) { + *ppvObject = cast(void*)cast(nsIPromptService)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIPromptService2.NS_IPROMPTSERVICE2_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {promptService2.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIPromptService2.IID) { + *ppvObject = cast(void*)cast(nsIPromptService2)this; AddRef (); return XPCOM.NS_OK; } - XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); + *ppvObject = null; return XPCOM.NS_ERROR_NO_INTERFACE; } - -int Release () { + +extern(System) +nsrefcnt Release () { refCount--; - if (refCount is 0) disposeCOMInterfaces (); + //if (refCount is 0) disposeCOMInterfaces (); return refCount; } -Browser getBrowser (int /*long*/ aDOMWindow) { - if (aDOMWindow is 0) return null; - nsIDOMWindow window = new nsIDOMWindow (aDOMWindow); - return Mozilla.findBrowser (window); +extern(D) +Browser getBrowser (nsIDOMWindow aDOMWindow) { + if (aDOMWindow is null) return null; + + //int /*long*/[] result = new int /*long*/[1]; + nsIServiceManager serviceManager; + auto rc = XPCOM.NS_GetServiceManager (&serviceManager); + if (rc !is XPCOM.NS_OK) Mozilla.error (rc); + if (serviceManager is null) Mozilla.error (XPCOM.NS_NOINTERFACE); + + //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); + //result[0] = 0; + //byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_WINDOWWATCHER_CONTRACTID, true); + nsIWindowWatcher windowWatcher; + rc = serviceManager.GetServiceByContractID (XPCOM.NS_WINDOWWATCHER_CONTRACTID.ptr, &nsIWindowWatcher.IID, cast(void**)&windowWatcher); + if (rc !is XPCOM.NS_OK) Mozilla.error(rc); + if (windowWatcher is null) Mozilla.error (XPCOM.NS_NOINTERFACE); + serviceManager.Release (); + + //nsIWindowWatcher windowWatcher = new nsIWindowWatcher (result[0]); + //result[0] = 0; + /* the chrome will only be answered for the top-level nsIDOMWindow */ + //nsIDOMWindow window = new nsIDOMWindow (aDOMWindow); + nsIDOMWindow top; + rc = aDOMWindow.GetTop (&top); + if (rc !is XPCOM.NS_OK) Mozilla.error (rc); + if (top is null) Mozilla.error (XPCOM.NS_NOINTERFACE); + //aDOMWindow = result[0]; + //result[0] = 0; + nsIWebBrowserChrome webBrowserChrome; + rc = windowWatcher.GetChromeForWindow (top, &webBrowserChrome); + if (rc !is XPCOM.NS_OK) Mozilla.error (rc); + if (webBrowserChrome is null) Mozilla.error (XPCOM.NS_NOINTERFACE); + windowWatcher.Release (); + + //nsIWebBrowserChrome webBrowserChrome = new nsIWebBrowserChrome (result[0]); + //result[0] = 0; + nsIEmbeddingSiteWindow embeddingSiteWindow; + rc = webBrowserChrome.QueryInterface (&nsIEmbeddingSiteWindow.IID, cast(void**)&embeddingSiteWindow); + if (rc !is XPCOM.NS_OK) Mozilla.error (rc); + if (embeddingSiteWindow is null) Mozilla.error (XPCOM.NS_NOINTERFACE); + webBrowserChrome.Release (); + + //nsIEmbeddingSiteWindow embeddingSiteWindow = new nsIEmbeddingSiteWindow (result[0]); + //result[0] = 0; + + void* result; + rc = embeddingSiteWindow.GetSiteWindow (&result); + if (rc !is XPCOM.NS_OK) Mozilla.error (rc); + if (result is null) Mozilla.error (XPCOM.NS_NOINTERFACE); + embeddingSiteWindow.Release (); + + return Mozilla.findBrowser (result); } -String getLabel (int buttonFlag, int index, int /*long*/ buttonTitle) { +String getLabel (int buttonFlag, int index, PRUnichar* buttonTitle) { String label = null; int flag = (buttonFlag & (0xff * index)) / index; switch (flag) { - case nsIPromptService.BUTTON_TITLE_CANCEL : label = DWT.getMessage ("DWT_Cancel"); break; //$NON-NLS-1$ - case nsIPromptService.BUTTON_TITLE_NO : label = DWT.getMessage ("DWT_No"); break; //$NON-NLS-1$ - case nsIPromptService.BUTTON_TITLE_OK : label = DWT.getMessage ("DWT_OK"); break; //$NON-NLS-1$ - case nsIPromptService.BUTTON_TITLE_SAVE : label = DWT.getMessage ("DWT_Save"); break; //$NON-NLS-1$ - case nsIPromptService.BUTTON_TITLE_YES : label = DWT.getMessage ("DWT_Yes"); break; //$NON-NLS-1$ + // TODO: implement with DWT.getMessage - JJR + case nsIPromptService.BUTTON_TITLE_CANCEL : label = "Cancel"; break; //$NON-NLS-1$ + case nsIPromptService.BUTTON_TITLE_NO : label = "No"; break; //$NON-NLS-1$ + case nsIPromptService.BUTTON_TITLE_OK : label = "OK"; break; //$NON-NLS-1$ + case nsIPromptService.BUTTON_TITLE_SAVE : label = "Save"; break; //$NON-NLS-1$ + case nsIPromptService.BUTTON_TITLE_YES : label = "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); + auto span = XPCOM.strlen_PRUnichar (buttonTitle); + //char[] dest = new char[length]; + //XPCOM.memmove (dest, buttonTitle, length * 2); + label = Utf.toString (buttonTitle[0 .. span]); } } return label; @@ -164,18 +169,19 @@ /* nsIPromptService */ -int Alert (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText) { +extern(System) +nsresult Alert (nsIDOMWindow aParent, PRUnichar* aDialogTitle, PRUnichar* aText) { Browser browser = getBrowser (aParent); - int length = XPCOM.strlen_PRUnichar (aDialogTitle); - char[] dest = new char[length]; - XPCOM.memmove (dest, aDialogTitle, length * 2); - String titleLabel = new String (dest); + int span = XPCOM.strlen_PRUnichar (aDialogTitle); + //char[] dest = new char[length]; + //XPCOM.memmove (dest, aDialogTitle, length * 2); + String titleLabel = Utf.toString (aDialogTitle[0 .. span]); - length = XPCOM.strlen_PRUnichar (aText); - dest = new char[length]; - XPCOM.memmove (dest, aText, length * 2); - String textLabel = new String (dest); + span = XPCOM.strlen_PRUnichar (aText); + //dest = new char[length]; + //XPCOM.memmove (dest, aText, length * 2); + String textLabel = Utf.toString (aText[0 .. span]); Shell shell = browser is null ? new Shell () : browser.getShell (); MessageBox messageBox = new MessageBox (shell, DWT.OK | DWT.ICON_WARNING); @@ -185,83 +191,88 @@ return XPCOM.NS_OK; } -int AlertCheck (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aCheckMsg, int /*long*/ aCheckState) { +extern(System) +nsresult AlertCheck (nsIDOMWindow aParent, PRUnichar* aDialogTitle, PRUnichar* aText, PRUnichar* aCheckMsg, PRBool* aCheckState) { Browser browser = getBrowser (aParent); - int length = XPCOM.strlen_PRUnichar (aDialogTitle); - char[] dest = new char[length]; - XPCOM.memmove (dest, aDialogTitle, length * 2); - String titleLabel = new String (dest); + int span = XPCOM.strlen_PRUnichar (aDialogTitle); + //char[] dest = new char[length]; + //XPCOM.memmove (dest, aDialogTitle, length * 2); + String titleLabel = Utf.toString (aDialogTitle[0 .. span]); - length = XPCOM.strlen_PRUnichar (aText); - dest = new char[length]; - XPCOM.memmove (dest, aText, length * 2); - String textLabel = new String (dest); + span = XPCOM.strlen_PRUnichar (aText); + //dest = new char[length]; + //XPCOM.memmove (dest, aText, length * 2); + String textLabel = Utf.toString (aText[0 .. span]); - length = XPCOM.strlen_PRUnichar (aCheckMsg); - dest = new char[length]; - XPCOM.memmove (dest, aCheckMsg, length * 2); - String checkLabel = new String (dest); + span = XPCOM.strlen_PRUnichar (aCheckMsg); + //dest = new char[length]; + //XPCOM.memmove (dest, aCheckMsg, length * 2); + String checkLabel = Utf.toString (aCheckMsg[0..span]); Shell shell = browser is null ? new Shell () : browser.getShell (); PromptDialog dialog = new PromptDialog (shell); - int[] check = new int[1]; - if (aCheckState !is 0) XPCOM.memmove (check, aCheckState, 4); /* PRBool */ - dialog.alertCheck (titleLabel, textLabel, checkLabel, check); - if (aCheckState !is 0) XPCOM.memmove (aCheckState, check, 4); /* PRBool */ + int check; + if (aCheckState !is null) check = *aCheckState; /* PRBool */ + dialog.alertCheck (titleLabel, textLabel, checkLabel, /*ref*/ check); + if (aCheckState !is null) *aCheckState = check; /* PRBool */ return XPCOM.NS_OK; } -int AsyncPromptAuth(int /*long*/ aParent, int /*long*/ aChannel, int /*long*/ aCallback, int /*long*/ aContext, int level, int /*long*/ authInfo, int /*long*/ checkboxLabel, int /*long*/ checkValue, int /*long*/ _retval) { +extern(System) +nsresult AsyncPromptAuth(nsIDOMWindow aParent, nsIChannel aChannel, nsIAuthPromptCallback aCallback, nsISupports aContext, PRUint32 level, nsIAuthInformation authInfo, PRUnichar* checkboxLabel, PRBool* checkValue, nsICancelable* _retval) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int Confirm (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ _retval) { +extern(System) +nsresult Confirm (nsIDOMWindow aParent, PRUnichar* aDialogTitle, PRUnichar* aText, PRBool* _retval) { Browser browser = getBrowser (aParent); - int length = XPCOM.strlen_PRUnichar (aDialogTitle); - char[] dest = new char[length]; - XPCOM.memmove (dest, aDialogTitle, length * 2); - String titleLabel = new String (dest); + int span = XPCOM.strlen_PRUnichar (aDialogTitle); + //char[] dest = new char[length]; + //XPCOM.memmove (dest, aDialogTitle, length * 2); + String titleLabel = Utf.toString (aDialogTitle[0 .. span]); - length = XPCOM.strlen_PRUnichar (aText); - dest = new char[length]; - XPCOM.memmove (dest, aText, length * 2); - String textLabel = new String (dest); + span = XPCOM.strlen_PRUnichar (aText); + //dest = new char[length]; + //XPCOM.memmove (dest, aText, length * 2); + String textLabel = Utf.toString (aText[0 .. span]); Shell shell = browser is null ? new Shell () : browser.getShell (); MessageBox messageBox = new MessageBox (shell, DWT.OK | DWT.CANCEL | DWT.ICON_QUESTION); messageBox.setText (titleLabel); messageBox.setMessage (textLabel); int id = messageBox.open (); - int[] result = {id is DWT.OK ? 1 : 0}; - XPCOM.memmove (_retval, result, 4); + int result = id is DWT.OK ? 1 : 0; + *_retval = result; return XPCOM.NS_OK; } -int ConfirmCheck (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) { +extern(System) +nsresult ConfirmCheck (nsIDOMWindow aParent, PRUnichar* aDialogTitle, PRUnichar* aText, PRUnichar* aCheckMsg, PRBool* aCheckState, PRBool* _retval) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int ConfirmEx (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int aButtonFlags, int /*long*/ aButton0Title, int /*long*/ aButton1Title, int /*long*/ aButton2Title, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) { +extern(System) +nsresult ConfirmEx (nsIDOMWindow aParent, PRUnichar* aDialogTitle, PRUnichar* aText, PRUint32 aButtonFlags, PRUnichar* aButton0Title, PRUnichar* aButton1Title, PRUnichar* aButton2Title, PRUnichar* aCheckMsg, PRBool* aCheckState, PRInt32* _retval) { Browser browser = getBrowser (aParent); - int length = XPCOM.strlen_PRUnichar (aDialogTitle); - char[] dest = new char[length]; - XPCOM.memmove (dest, aDialogTitle, length * 2); - String titleLabel = new String (dest); + int span = XPCOM.strlen_PRUnichar (aDialogTitle); + //char[] dest = new char[length]; + //XPCOM.memmove (dest, aDialogTitle, length * 2); + String titleLabel = Utf.toString (aDialogTitle[0 .. span]); - length = XPCOM.strlen_PRUnichar (aText); - dest = new char[length]; - XPCOM.memmove (dest, aText, length * 2); - String textLabel = new String (dest); + span = XPCOM.strlen_PRUnichar (aText); + //dest = new char[length]; + //XPCOM.memmove (dest, aText, length * 2); + String textLabel = Utf.toString (aText[0 .. span]); String checkLabel = null; - if (aCheckMsg !is 0) { - length = XPCOM.strlen_PRUnichar (aCheckMsg); - dest = new char[length]; - XPCOM.memmove (dest, aCheckMsg, length * 2); - checkLabel = new String (dest); + if (aCheckMsg !is null) { + span = XPCOM.strlen_PRUnichar (aCheckMsg); + //dest = new char[length]; + //XPCOM.memmove (dest, aCheckMsg, length * 2); + checkLabel = Utf.toString (aCheckMsg[0 .. span]); } String button0Label = getLabel (aButtonFlags, nsIPromptService.BUTTON_POS_0, aButton0Title); @@ -277,172 +288,182 @@ Shell shell = browser is null ? new Shell () : browser.getShell (); PromptDialog dialog = new PromptDialog (shell); - int[] check = new int[1], result = new int[1]; - if (aCheckState !is 0) XPCOM.memmove (check, aCheckState, 4); - dialog.confirmEx (titleLabel, textLabel, checkLabel, button0Label, button1Label, button2Label, defaultIndex, check, result); - if (aCheckState !is 0) XPCOM.memmove (aCheckState, check, 4); - XPCOM.memmove (_retval, result, 4); + int check, result; + if (aCheckState !is null) check = *aCheckState; + dialog.confirmEx (titleLabel, textLabel, checkLabel, button0Label, button1Label, button2Label, defaultIndex, /*ref*/check, /*ref*/result); + if (aCheckState !is null) *aCheckState = check; + *_retval = result; return XPCOM.NS_OK; } -int Prompt (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aValue, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) { +extern(System) +nsresult Prompt (nsIDOMWindow aParent, PRUnichar* aDialogTitle, PRUnichar* aText, PRUnichar** aValue, PRUnichar* aCheckMsg, PRBool* aCheckState, PRBool* _retval) { Browser browser = getBrowser (aParent); - String titleLabel = null, textLabel, checkLabel = null; - String[] valueLabel = new String[1]; - char[] dest; - int length; - if (aDialogTitle !is 0) { - length = XPCOM.strlen_PRUnichar (aDialogTitle); - dest = new char[length]; - XPCOM.memmove (dest, aDialogTitle, length * 2); - titleLabel = new String (dest); + String titleLabel = null; + String textLabel = null, checkLabel = null; + String valueLabel; + //char[] dest; + int span; + if (aDialogTitle !is null) { + span = XPCOM.strlen_PRUnichar (aDialogTitle); + //dest = new char[length]; + //XPCOM.memmove (dest, aDialogTitle, length * 2); + titleLabel = Utf.toString (aDialogTitle[0 .. span]); } - length = XPCOM.strlen_PRUnichar (aText); - dest = new char[length]; - XPCOM.memmove (dest, aText, length * 2); - textLabel = new String (dest); + span = XPCOM.strlen_PRUnichar (aText); + //dest = new char[length]; + //XPCOM.memmove (dest, aText, length * 2); + textLabel = Utf.toString (aText[0 .. span]); - int /*long*/[] valueAddr = new int /*long*/[1]; - XPCOM.memmove (valueAddr, aValue, C.PTR_SIZEOF); - if (valueAddr[0] !is 0) { - length = XPCOM.strlen_PRUnichar (valueAddr[0]); - dest = new char[length]; - XPCOM.memmove (dest, valueAddr[0], length * 2); - valueLabel[0] = new String (dest); + //int /*long*/[] valueAddr = new int /*long*/[1]; + //XPCOM.memmove (valueAddr, aValue, C.PTR_SIZEOF); + auto valueAddr = aValue; + if (valueAddr[0] !is null) { + span = XPCOM.strlen_PRUnichar (valueAddr[0]); + //dest = new char[length]; + //XPCOM.memmove (dest, valueAddr[0], length * 2); + valueLabel = Utf.toString ((valueAddr[0])[0 .. span]); } - if (aCheckMsg !is 0) { - length = XPCOM.strlen_PRUnichar (aCheckMsg); - if (length > 0) { - dest = new char[length]; - XPCOM.memmove (dest, aCheckMsg, length * 2); - checkLabel = new String (dest); + if (aCheckMsg !is null) { + span = XPCOM.strlen_PRUnichar (aCheckMsg); + if (span > 0) { + //dest = new char[length]; + //XPCOM.memmove (dest, aCheckMsg, length * 2); + checkLabel = Utf.toString (aCheckMsg[0 .. span]); } } Shell shell = browser is null ? new Shell () : browser.getShell (); PromptDialog dialog = new PromptDialog (shell); - int[] check = new int[1], result = new int[1]; - if (aCheckState !is 0) XPCOM.memmove (check, aCheckState, 4); - dialog.prompt (titleLabel, textLabel, checkLabel, valueLabel, check, result); - - XPCOM.memmove (_retval, result, 4); - if (result[0] is 1) { + int check, result; + if (aCheckState !is null) check = *aCheckState; + dialog.prompt (titleLabel, textLabel, checkLabel, /*ref*/valueLabel,/*ref*/ check,/*ref*/ result); + *_retval = result; + if (result is 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] !is null) { - cnt = valueLabel[0].length (); - buffer = new char[cnt + 1]; - valueLabel[0].getChars (0, cnt, buffer, 0); + int size; + void* ptr; + wchar[] buffer; + nsIServiceManager serviceManager; + if (valueLabel !is null) { + //cnt = valueLabel.length; + //buffer = new wchar[cnt + 1]; + //valueLabel.getChars (0, cnt, buffer, 0); + buffer = Utf.toString16(valueLabel); size = buffer.length * 2; - ptr = C.malloc (size); - XPCOM.memmove (ptr, buffer, size); - XPCOM.memmove (aValue, new int /*long*/[] {ptr}, C.PTR_SIZEOF); + ptr = tango.stdc.stdlib.malloc (size); + (cast(wchar*)ptr)[0 .. buffer.length] = buffer[0 .. $]; + //XPCOM.memmove (ptr, buffer, size); + //XPCOM.memmove (aValue, new int /*long*/[] {ptr}, C.PTR_SIZEOF); + *aValue = cast(PRUnichar*)ptr; - if (valueAddr[0] !is 0) { - int rc = XPCOM.NS_GetServiceManager (result2); + if (valueAddr[0] !is null) { + int rc = XPCOM.NS_GetServiceManager (&serviceManager); if (rc !is XPCOM.NS_OK) DWT.error (rc); - if (result2[0] is 0) DWT.error (XPCOM.NS_NOINTERFACE); + if (serviceManager is null) DWT.error (XPCOM.NS_NOINTERFACE); - nsIServiceManager serviceManager = new nsIServiceManager (result2[0]); - result2[0] = 0; - byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); - rc = serviceManager.GetServiceByContractID (aContractID, nsIMemory.NS_IMEMORY_IID, result2); + //nsIServiceManager serviceManager = new nsIServiceManager (result2[0]); + //result2[0] = 0; + nsIMemory memory; + //byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); + rc = serviceManager.GetServiceByContractID (XPCOM.NS_MEMORY_CONTRACTID.ptr, &nsIMemory.IID, cast(void**)&memory); if (rc !is XPCOM.NS_OK) DWT.error (rc); - if (result2[0] is 0) DWT.error (XPCOM.NS_NOINTERFACE); + if (memory is null) DWT.error (XPCOM.NS_NOINTERFACE); serviceManager.Release (); - nsIMemory memory = new nsIMemory (result2[0]); - result2[0] = 0; + //nsIMemory memory = new nsIMemory (result2[0]); + //result2[0] = 0; memory.Free (valueAddr[0]); memory.Release (); } } } - if (aCheckState !is 0) XPCOM.memmove (aCheckState, check, 4); + if (aCheckState !is null) *aCheckState = check; return XPCOM.NS_OK; } -int PromptAuth(int /*long*/ aParent, int /*long*/ aChannel, int level, int /*long*/ authInfo, int /*long*/ checkboxLabel, int /*long*/ checkboxValue, int /*long*/ _retval) { +extern(System) +nsresult PromptAuth(nsIDOMWindow aParent, nsIChannel aChannel, PRUint32 level, nsIAuthInformation authInfo, PRUnichar* checkboxLabel, PRBool* checkboxValue, PRBool* _retval) { Browser browser = getBrowser (aParent); String checkLabel = null; - int[] checkValue = new int[1]; - String[] userLabel = new String[1], passLabel = new String[1]; - - String title = DWT.getMessage ("DWT_Authentication_Required"); //$NON-NLS-1$ + //int[] checkValue = new int[1]; + //String[] userLabel = new String[1], passLabel = new String[1]; + int checkValue; + String userLabel, passLabel; + //String title = DWT.getMessage ("SWT_Authentication_Required"); //$NON-NLS-1$ + String title = "Authentication Required"; - if (checkboxLabel !is 0 && checkboxValue !is 0) { - int length = XPCOM.strlen_PRUnichar (checkboxLabel); - char[] dest = new char[length]; - XPCOM.memmove (dest, checkboxLabel, length * 2); - checkLabel = new String (dest); - XPCOM.memmove (checkValue, checkboxValue, 4); /* PRBool */ + if (checkboxLabel !is null && checkboxValue !is null) { + //int span = XPCOM.strlen_PRUnichar (checkboxLabel); + //char[] dest = new char[length]; + //XPCOM.memmove (dest, checkboxLabel, length * 2); + checkLabel = Utf.toString (fromString16z(checkboxLabel)); + checkValue = *checkboxValue; /* PRBool */ } /* get initial username and password values */ - nsIAuthInformation auth = new nsIAuthInformation (authInfo); + //nsIAuthInformation auth = new nsIAuthInformation (authInfo); - int /*long*/ ptr = XPCOM.nsEmbedString_new (); - int rc = auth.GetUsername (ptr); + scope auto ptr1 = new nsEmbedString; + int rc = authInfo.GetUsername (cast(nsAString*)ptr1); if (rc !is XPCOM.NS_OK) DWT.error (rc); - int length = XPCOM.nsEmbedString_Length (ptr); - int /*long*/ buffer = XPCOM.nsEmbedString_get (ptr); - char[] chars = new char[length]; - XPCOM.memmove (chars, buffer, length * 2); - userLabel[0] = new String (chars); - XPCOM.nsEmbedString_delete (ptr); + //int length = XPCOM.nsEmbedString_Length (ptr); + //int /*long*/ buffer = XPCOM.nsEmbedString_get (ptr); + //char[] chars = new char[length]; + //XPCOM.memmove (chars, buffer, length * 2); + userLabel = ptr1.toString; + //XPCOM.nsEmbedString_delete (ptr); - ptr = XPCOM.nsEmbedString_new (); - rc = auth.GetPassword (ptr); + scope auto ptr2 = new nsEmbedString; + rc = authInfo.GetPassword (cast(nsAString*)ptr2); if (rc !is XPCOM.NS_OK) DWT.error (rc); - length = XPCOM.nsEmbedString_Length (ptr); - buffer = XPCOM.nsEmbedString_get (ptr); - chars = new char[length]; - XPCOM.memmove (chars, buffer, length * 2); - passLabel[0] = new String (chars); - XPCOM.nsEmbedString_delete (ptr); + //length = XPCOM.nsEmbedString_Length (ptr); + //buffer = XPCOM.nsEmbedString_get (ptr); + //chars = new char[length]; + //XPCOM.memmove (chars, buffer, length * 2); + passLabel = ptr2.toString; + //XPCOM.nsEmbedString_delete (ptr); /* compute the message text */ - ptr = XPCOM.nsEmbedString_new (); - rc = auth.GetRealm (ptr); + scope auto ptr3 = new nsEmbedString; + rc = authInfo.GetRealm (cast(nsAString*)ptr3); if (rc !is XPCOM.NS_OK) DWT.error (rc); - length = XPCOM.nsEmbedString_Length (ptr); - buffer = XPCOM.nsEmbedString_get (ptr); - chars = new char[length]; - XPCOM.memmove (chars, buffer, length * 2); - String realm = new String (chars); - XPCOM.nsEmbedString_delete (ptr); + //length = XPCOM.nsEmbedString_Length (ptr); + //buffer = XPCOM.nsEmbedString_get (ptr); + //chars = new char[length]; + //XPCOM.memmove (chars, buffer, length * 2); + String realm = ptr3.toString; + //XPCOM.nsEmbedString_delete (ptr); - nsIChannel channel = new nsIChannel (aChannel); - int /*long*/[] uri = new int /*long*/[1]; - rc = channel.GetURI (uri); + //nsIChannel channel = new nsIChannel (aChannel); + nsIURI uri; + rc = aChannel.GetURI (&uri); if (rc !is XPCOM.NS_OK) DWT.error (rc); - if (uri[0] is 0) Mozilla.error (XPCOM.NS_NOINTERFACE); + if (uri is null) Mozilla.error (XPCOM.NS_NOINTERFACE); - nsIURI nsURI = new nsIURI (uri[0]); - int /*long*/ aSpec = XPCOM.nsEmbedCString_new (); - rc = nsURI.GetHost (aSpec); + //nsIURI nsURI = new nsIURI (uri[0]); + scope auto aSpec = new nsEmbedCString; + rc = uri.GetHost (cast(nsACString*)aSpec); if (rc !is XPCOM.NS_OK) DWT.error (rc); - length = XPCOM.nsEmbedCString_Length (aSpec); - buffer = XPCOM.nsEmbedCString_get (aSpec); - byte[] bytes = new byte[length]; - XPCOM.memmove (bytes, buffer, length); - XPCOM.nsEmbedCString_delete (aSpec); - String host = new String (bytes); - nsURI.Release (); + //length = XPCOM.nsEmbedCString_Length (aSpec); + //buffer = XPCOM.nsEmbedCString_get (aSpec); + //byte[] bytes = new byte[length]; + //XPCOM.memmove (bytes, buffer, length); + //XPCOM.nsEmbedCString_delete (aSpec); + String host = aSpec.toString; + uri.Release (); String message; if (realm.length () > 0 && host.length () > 0) { - message = Compatibility.getMessage ("DWT_Enter_Username_and_Password", new String[] {realm, host}); //$NON-NLS-1$ + //message = Compatibility.getMessage ("SWT_Enter_Username_and_Password", new String[] {realm, host}); //$NON-NLS-1$ + message = Format("Enter user name and password for {0} at {1}",realm, host); } else { message = ""; //$NON-NLS-1$ } @@ -450,155 +471,172 @@ /* open the prompter */ Shell shell = browser is null ? new Shell () : browser.getShell (); PromptDialog dialog = new PromptDialog (shell); - int[] result = new int[1]; + int result; dialog.promptUsernameAndPassword (title, message, checkLabel, userLabel, passLabel, checkValue, result); - XPCOM.memmove (_retval, result, 4); /* PRBool */ - if (result[0] is 1) { /* User selected OK */ - nsEmbedString string = new nsEmbedString (userLabel[0]); - rc = auth.SetUsername(string.getAddress ()); + //XPCOM.memmove (_retval, result, 4); /* PRBool */ + *_retval = result; + if (result is 1) { /* User selected OK */ + scope auto string1 = new nsEmbedString (toString16(userLabel)); + rc = authInfo.SetUsername(cast(nsAString*)string1); if (rc !is XPCOM.NS_OK) DWT.error (rc); - string.dispose (); + //string.dispose (); - string = new nsEmbedString (passLabel[0]); - rc = auth.SetPassword(string.getAddress ()); + scope auto string2 = new nsEmbedString (toString16(passLabel)); + rc = authInfo.SetPassword(cast(nsAString*)string2); if (rc !is XPCOM.NS_OK) DWT.error (rc); - string.dispose (); + //string.dispose (); } - if (checkboxValue !is 0) XPCOM.memmove (checkboxValue, checkValue, 4); /* PRBool */ + if (checkboxValue !is null) *checkboxValue = checkValue; /* PRBool */ return XPCOM.NS_OK; } -int PromptUsernameAndPassword (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aUsername, int /*long*/ aPassword, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) { +extern(System) +nsresult PromptUsernameAndPassword (nsIDOMWindow aParent, PRUnichar* aDialogTitle, PRUnichar* aText, PRUnichar** aUsername, PRUnichar** aPassword, PRUnichar* aCheckMsg, PRBool* aCheckState, PRBool* _retval) { Browser browser = getBrowser (aParent); String titleLabel, textLabel, checkLabel = null; - String[] userLabel = new String[1], passLabel = new String[1]; + String userLabel, passLabel; char[] dest; - int length; - if (aDialogTitle !is 0) { - length = XPCOM.strlen_PRUnichar (aDialogTitle); - dest = new char[length]; - XPCOM.memmove (dest, aDialogTitle, length * 2); - titleLabel = new String (dest); + int span; + if (aDialogTitle !is null) { + //span = XPCOM.strlen_PRUnichar (aDialogTitle); + //dest = new char[length]; + //XPCOM.memmove (dest, aDialogTitle, length * 2); + titleLabel = Utf.toString (fromString16z(aDialogTitle)); } else { - titleLabel = DWT.getMessage ("DWT_Authentication_Required"); //$NON-NLS-1$ + //titleLabel = DWT.getMessage ("SWT_Authentication_Required"); //$NON-NLS-1$ + titleLabel = "Authentication Required"; } - length = XPCOM.strlen_PRUnichar (aText); - dest = new char[length]; - XPCOM.memmove (dest, aText, length * 2); - textLabel = new String (dest); + //span = XPCOM.strlen_PRUnichar (aText); + //dest = new char[length]; + //XPCOM.memmove (dest, aText, length * 2); + textLabel = Utf.toString (fromString16z(aText)); - int /*long*/[] userAddr = new int /*long*/[1]; - XPCOM.memmove (userAddr, aUsername, C.PTR_SIZEOF); - if (userAddr[0] !is 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*/[] userAddr = new int /*long*/[1]; + //XPCOM.memmove (userAddr, aUsername, C.PTR_SIZEOF); + auto userAddr = *aUsername; + if (*aUsername !is null) { + //span = XPCOM.strlen_PRUnichar (userAddr[0]); + //dest = new char[length]; + //XPCOM.memmove (dest, userAddr[0], length * 2); + userLabel = Utf.toString(fromString16z(*aUsername)); } - int /*long*/[] passAddr = new int /*long*/[1]; - XPCOM.memmove (passAddr, aPassword, C.PTR_SIZEOF); - if (passAddr[0] !is 0) { - length = XPCOM.strlen_PRUnichar (passAddr[0]); - dest = new char[length]; - XPCOM.memmove (dest, passAddr[0], length * 2); - passLabel[0] = new String (dest); + //int /*long*/[] passAddr = new int /*long*/[1]; + //XPCOM.memmove (passAddr, aPassword, C.PTR_SIZEOF); + auto passAddr = *aPassword; + if (*aPassword !is null) { + //span = XPCOM.strlen_PRUnichar (passAddr[0]); + //dest = new char[length]; + //XPCOM.memmove (dest, passAddr[0], length * 2); + passLabel = Utf.toString(fromString16z(*aPassword)); } - if (aCheckMsg !is 0) { - length = XPCOM.strlen_PRUnichar (aCheckMsg); - if (length > 0) { - dest = new char[length]; - XPCOM.memmove (dest, aCheckMsg, length * 2); - checkLabel = new String (dest); - } + if (aCheckMsg !is null) { + //span = XPCOM.strlen_PRUnichar (aCheckMsg); + //if (span > 0) { + //dest = new char[length]; + //XPCOM.memmove (dest, aCheckMsg, length * 2); + checkLabel = Utf.toString (fromString16z(aCheckMsg)); + //} } Shell shell = browser is null ? new Shell () : browser.getShell (); PromptDialog dialog = new PromptDialog (shell); - int[] check = new int[1], result = new int[1]; - if (aCheckState !is 0) XPCOM.memmove (check, aCheckState, 4); /* PRBool */ - dialog.promptUsernameAndPassword (titleLabel, textLabel, checkLabel, userLabel, passLabel, check, result); + int check, result; + if (aCheckState !is null) check = *aCheckState; /* PRBool */ + dialog.promptUsernameAndPassword (titleLabel, textLabel, checkLabel, /*ref*/ userLabel, /*ref*/ passLabel, check, result); - XPCOM.memmove (_retval, result, 4); /* PRBool */ - if (result[0] is 1) { + *_retval = result; /* PRBool */ + if (result is 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; + void* ptr; + wchar[] buffer; int /*long*/[] result2 = new int /*long*/[1]; - if (userLabel[0] !is 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 (aUsername, new int /*long*/[] {ptr}, C.PTR_SIZEOF); - - if (userAddr[0] !is 0) { - int rc = XPCOM.NS_GetServiceManager (result2); + if (userLabel !is null) { + //cnt = userLabel[0].length (); + //buffer = new char[cnt + 1]; + //buffer = Utf.toString16(userLabel); + //userLabel[0].getChars (0, cnt, buffer, 0); + //size = buffer.length * 2; + //ptr = tango.stdc.stdlib.malloc (size); + //(cast(wchar*)ptr)[0 .. buffer.length] = buffer[0 .. $]; + //XPCOM.memmove (ptr, buffer, size); + *aUsername = toString16z(Utf.toString16(userLabel)); + //XPCOM.memmove (aUsername, new int /*long*/[] {ptr}, C.PTR_SIZEOF); + nsIServiceManager serviceManager; + + if (userAddr !is null) { + int rc = XPCOM.NS_GetServiceManager (&serviceManager); if (rc !is XPCOM.NS_OK) DWT.error (rc); - if (result2[0] is 0) DWT.error (XPCOM.NS_NOINTERFACE); + if (serviceManager is null) DWT.error (XPCOM.NS_NOINTERFACE); - nsIServiceManager serviceManager = new nsIServiceManager (result2[0]); - result2[0] = 0; - byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); - rc = serviceManager.GetServiceByContractID (aContractID, nsIMemory.NS_IMEMORY_IID, result2); + //nsIServiceManager serviceManager = new nsIServiceManager (result2[0]); + //result2[0] = 0; + //byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); + nsIMemory memory; + rc = serviceManager.GetServiceByContractID (XPCOM.NS_MEMORY_CONTRACTID.ptr, &nsIMemory.IID, cast(void**)&memory); if (rc !is XPCOM.NS_OK) DWT.error (rc); - if (result[0] is 0) DWT.error (XPCOM.NS_NOINTERFACE); + if (memory is null) DWT.error (XPCOM.NS_NOINTERFACE); serviceManager.Release (); - nsIMemory memory = new nsIMemory (result2[0]); - result2[0] = 0; - memory.Free (userAddr[0]); + //nsIMemory memory = new nsIMemory (result2[0]); + //result2[0] = 0; + memory.Free (userAddr); memory.Release (); } } - if (passLabel[0] !is 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 (aPassword, new int /*long*/[] {ptr}, C.PTR_SIZEOF); + if (passLabel !is null) { + //cnt = passLabel[0].length (); + //buffer = new char[cnt + 1]; + //buffer = Utf.toString16( passLabel ); + //passLabel[0].getChars (0, cnt, buffer, 0); + //size = buffer.length * 2; + //ptr = tango.stdc.stdlib.malloc (size); + //(cast(wchar*)ptr)[0 .. buffer.length] = buffer[0 .. $]; + //XPCOM.memmove (ptr, buffer, size); + *aPassword = toString16z(Utf.toString16(passLabel)); + //XPCOM.memmove (aPassword, new int /*long*/[] {ptr}, C.PTR_SIZEOF); - if (passAddr[0] !is 0) { - int rc = XPCOM.NS_GetServiceManager (result2); + nsIServiceManager serviceManager; + if (passAddr !is null) { + int rc = XPCOM.NS_GetServiceManager (&serviceManager); if (rc !is XPCOM.NS_OK) DWT.error (rc); - if (result2[0] is 0) DWT.error (XPCOM.NS_NOINTERFACE); + if (serviceManager is null) DWT.error (XPCOM.NS_NOINTERFACE); - nsIServiceManager serviceManager = new nsIServiceManager (result2[0]); - result2[0] = 0; - byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); - rc = serviceManager.GetServiceByContractID (aContractID, nsIMemory.NS_IMEMORY_IID, result2); + //nsIServiceManager serviceManager = new nsIServiceManager (result2[0]); + //result2[0] = 0; + //byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); + nsIMemory memory; + rc = serviceManager.GetServiceByContractID (XPCOM.NS_MEMORY_CONTRACTID.ptr, &nsIMemory.IID, cast(void**)&memory); if (rc !is XPCOM.NS_OK) DWT.error (rc); - if (result2[0] is 0) DWT.error (XPCOM.NS_NOINTERFACE); + if (memory is null) DWT.error (XPCOM.NS_NOINTERFACE); serviceManager.Release (); - nsIMemory memory = new nsIMemory (result2[0]); - result2[0] = 0; - memory.Free (passAddr[0]); + //nsIMemory memory = new nsIMemory (result2[0]); + //result2[0] = 0; + memory.Free (passAddr); memory.Release (); } } } - if (aCheckState !is 0) XPCOM.memmove (aCheckState, check, 4); /* PRBool */ + if (aCheckState !is null) *aCheckState = check; /* PRBool */ return XPCOM.NS_OK; } -int PromptPassword (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int /*long*/ aPassword, int /*long*/ aCheckMsg, int /*long*/ aCheckState, int /*long*/ _retval) { +extern(System) +nsresult PromptPassword (nsIDOMWindow aParent, PRUnichar* aDialogTitle, PRUnichar* aText, PRUnichar** aPassword, PRUnichar* aCheckMsg, PRBool* aCheckState, PRBool* _retval) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } -int Select (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, int aCount, int /*long*/ aSelectList, int /*long*/ aOutSelection, int /*long*/ _retval) { +extern(System) +nsresult Select (nsIDOMWindow aParent, PRUnichar* aDialogTitle, PRUnichar* aText, PRUint32 aCount, PRUnichar** aSelectList, PRInt32* aOutSelection, PRBool* _retval) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; }
--- a/dwt/browser/PromptService2Factory.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/PromptService2Factory.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2003, 2008 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 @@ -7,100 +7,81 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Port to the D programming language: + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.PromptService2Factory; -import dwt.dwthelper.utils; - -import dwt.internal.C; -import dwt.internal.mozilla.XPCOM; -import dwt.internal.mozilla.XPCOMObject; +//import dwt.dwthelper.utils; +import dwt.internal.mozilla.Common; +//import dwt.internal.C; +import XPCOM = dwt.internal.mozilla.XPCOM; +//import dwt.internal.mozilla.XPCOMObject; import dwt.internal.mozilla.nsID; import dwt.internal.mozilla.nsIFactory; import dwt.internal.mozilla.nsISupports; +import dwt.browser.PromptService2; -class PromptService2Factory { - XPCOMObject supports; - XPCOMObject factory; +class PromptService2Factory : nsIFactory { + // XPCOMObject supports; + // XPCOMObject factory; int refCount = 0; this () { - createCOMInterfaces (); +// createCOMInterfaces (); } -int AddRef () { +extern(System) +nsrefcnt 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 ();} - }; +extern(System) +nsresult QueryInterface (nsID* riid, void** ppvObject) { + if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; + //nsID guid = new nsID (); + //XPCOM.memmove (guid, riid, nsID.sizeof); - 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 (cast(int)/*64*/args[0]);} - }; -} - -void disposeCOMInterfaces () { - if (supports !is null) { - supports.dispose (); - supports = null; - } - if (factory !is null) { - factory.dispose (); - factory = null; - } -} - -int /*long*/ getAddress () { - return factory.getAddress (); -} - -int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) { - if (riid is 0 || ppvObject is 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); + if (*riid == nsISupports.IID) { + *ppvObject = cast(void*)cast(nsISupports)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIFactory.NS_IFACTORY_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {factory.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIFactory.IID) { + *ppvObject = cast(void*)cast(nsIFactory)this; AddRef (); return XPCOM.NS_OK; } - XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); + *ppvObject = null; return XPCOM.NS_ERROR_NO_INTERFACE; } - -int Release () { + +extern(System) +nsrefcnt Release () { refCount--; - if (refCount is 0) disposeCOMInterfaces (); + //if (refCount is null) disposeCOMInterfaces (); return refCount; } /* nsIFactory */ -int CreateInstance (int /*long*/ aOuter, int /*long*/ iid, int /*long*/ result) { - PromptService2 promptService = new PromptService2 (); - promptService.AddRef (); - XPCOM.memmove (result, new int /*long*/[] {promptService.getAddress ()}, C.PTR_SIZEOF); - return XPCOM.NS_OK; +extern(System) +nsresult CreateInstance (nsISupports aOuter, nsIID* iid, void** result) { + if (result is null) + return XPCOM.NS_ERROR_INVALID_ARG; + auto promptService = new PromptService2; + nsresult rv = promptService.QueryInterface( iid, result ); + if (XPCOM.NS_FAILED(rv)) { + *result = null; + delete promptService; + } + return rv; } -int LockFactory (int lock) { +extern(System) +nsresult LockFactory (PRBool lock) { return XPCOM.NS_OK; } }
--- a/dwt/browser/Safari.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/Safari.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2008 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
--- a/dwt/browser/SimpleEnumerator.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/SimpleEnumerator.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * 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 @@ -7,21 +7,22 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Port to the D programming language: + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.SimpleEnumerator; -import dwt.dwthelper.utils; +//import dwt.dwthelper.utils; -import dwt.internal.C; -import dwt.internal.mozilla.XPCOM; -import dwt.internal.mozilla.XPCOMObject; +//import dwt.internal.C; +import XPCOM = dwt.internal.mozilla.XPCOM; + +import dwt.internal.mozilla.Common; import dwt.internal.mozilla.nsID; import dwt.internal.mozilla.nsISimpleEnumerator; import dwt.internal.mozilla.nsISupports; -class SimpleEnumerator { - XPCOMObject supports; - XPCOMObject simpleEnumerator; +class SimpleEnumerator : nsISimpleEnumerator{ int refCount = 0; nsISupports[] values; int index = 0; @@ -31,89 +32,55 @@ for (int i = 0; i < values.length; i++) { values[i].AddRef (); } - createCOMInterfaces (); } -int AddRef () { +extern(System) +nsrefcnt 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 ();} - }; - - simpleEnumerator = new XPCOMObject (new int[] {2, 0, 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 HasMoreElements (args[0]);} - public int /*long*/ method4 (int /*long*/[] args) {return GetNext (args[0]);} - }; -} +extern(System) +nsresult QueryInterface (nsID* riid, void** ppvObject) { + if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; + //nsID guid = new nsID (); + //XPCOM.memmove (guid, riid, nsID.sizeof); -void disposeCOMInterfaces () { - if (supports !is null) { - supports.dispose (); - supports = null; - } - if (simpleEnumerator !is null) { - simpleEnumerator.dispose (); - simpleEnumerator = null; - } - if (values !is null) { - for (int i = 0; i < values.length; i++) { - values[i].Release (); - } - values = null; - } -} - -int /*long*/ getAddress () { - return simpleEnumerator.getAddress (); -} - -int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) { - if (riid is 0 || ppvObject is 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); + if (*riid == nsISupports.IID) { + *ppvObject = cast(void*)cast(nsISupports)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsISimpleEnumerator.NS_ISIMPLEENUMERATOR_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {simpleEnumerator.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsISimpleEnumerator.IID) { + *ppvObject = cast(void*)cast(nsISimpleEnumerator)this; AddRef (); return XPCOM.NS_OK; } - XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); + *ppvObject = null; return XPCOM.NS_ERROR_NO_INTERFACE; } -int Release () { +extern(System) +nsresult Release () { refCount--; - if (refCount is 0) disposeCOMInterfaces (); + //if (refCount is 0) disposeCOMInterfaces (); return refCount; } -int HasMoreElements (int /*long*/ _retval) { +extern(System) +nsresult HasMoreElements (PRBool* _retval) { bool more = values !is null && index < values.length; - XPCOM.memmove (_retval, new int[] {more ? 1 : 0}, 4); /*PRBool */ + *_retval = more ? 1 : 0; /*PRBool */ return XPCOM.NS_OK; -} - -int GetNext (int /*long*/ _retval) { +} + +extern(System) +nsresult GetNext (nsISupports* _retval) { if (values is null || index is values.length) return XPCOM.NS_ERROR_UNEXPECTED; nsISupports value = values[index++]; value.AddRef (); - XPCOM.memmove (_retval, new int /*long*/[] {value.getAddress ()}, C.PTR_SIZEOF); + *_retval = value; return XPCOM.NS_OK; } }
--- a/dwt/browser/StatusTextEvent.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/StatusTextEvent.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,5 +1,5 @@ -/******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. +/******************************************************************************* + * Copyright (c) 2003, 2004 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 @@ -7,14 +7,15 @@ * * Contributors: * IBM Corporation - initial API and implementation - * * Port to the D programming language: - * Jacob Carlborg <doob@me.com> + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.StatusTextEvent; -import dwt.dwthelper.string; +import tango.text.convert.Format; + import dwt.dwthelper.utils; + import dwt.events.TypedEvent; import dwt.widgets.Widget; @@ -24,29 +25,27 @@ * The status text is typically displayed in the status bar of * a browser application. * - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * * @since 3.0 */ public class StatusTextEvent : TypedEvent { /** status text */ public String text; - - static const long serialVersionUID = 3258407348371600439L; + + static final long serialVersionUID = 3258407348371600439L; - this (Widget w) { - super(w); - } +this(Widget w) { + super(w); +} - /** - * Returns a string containing a concise, human-readable - * description of the receiver. - * - * @return a string representation of the event - */ - public String toString () { - String string = super.toString(); - return string.substring(0, string.length() - 1) // remove trailing '}' - + " text=" + text + "}"; - } +/** + * Returns a string containing a concise, human-readable + * description of the receiver. + * + * @return a string representation of the event + */ +public override String toString() { + return Format( "{} {text = {}}", + super.toString[1 .. $-2], text ); } + +}
--- a/dwt/browser/StatusTextListener.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/StatusTextListener.d Fri Jan 16 12:49:08 2009 +0100 @@ -7,14 +7,14 @@ * * Contributors: * IBM Corporation - initial API and implementation - * * Port to the D programming language: - * Jacob Carlborg <doob@me.com> + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.StatusTextListener; import dwt.browser.StatusTextEvent; -import dwt.dwthelper.utils; +//import dwt.dwthelper.utils; + import dwt.internal.DWTEventListener; /** @@ -29,22 +29,22 @@ */ public interface StatusTextListener : DWTEventListener { - /** - * This method is called when the status text is changed. The - * status text is typically displayed in the status bar of a browser - * application. - * <p> - * - * <p>The following fields in the <code>StatusTextEvent</code> apply: - * <ul> - * <li>(in) text the modified status text - * <li>(in) widget the <code>Browser</code> whose status text is changed - * </ul> - * - * @param event the <code>StatusTextEvent</code> that contains the updated - * status description of a <code>Browser</code> - * - * @since 3.0 - */ - public void changed (StatusTextEvent event); +/** + * This method is called when the status text is changed. The + * status text is typically displayed in the status bar of a browser + * application. + * <p> + * + * <p>The following fields in the <code>StatusTextEvent</code> apply: + * <ul> + * <li>(in) text the modified status text + * <li>(in) widget the <code>Browser</code> whose status text is changed + * </ul> + * + * @param event the <code>StatusTextEvent</code> that contains the updated + * status description of a <code>Browser</code> + * + * @since 3.0 + */ +public void changed(StatusTextEvent event); }
--- a/dwt/browser/TitleEvent.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/TitleEvent.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,5 +1,5 @@ -/******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. +/******************************************************************************* + * Copyright (c) 2003, 2004 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 @@ -7,14 +7,15 @@ * * Contributors: * IBM Corporation - initial API and implementation - * * Port to the D programming language: - * Jacob Carlborg <doob@me.com> + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.TitleEvent; +import tango.text.convert.Format; + import dwt.dwthelper.utils; -import dwt.dwthelper.string; + import dwt.events.TypedEvent; import dwt.widgets.Widget; @@ -23,29 +24,26 @@ * {@link TitleListener}'s when the title of the current document * is available or when it is modified. * - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * * @since 3.0 */ public class TitleEvent : TypedEvent { /** the title of the current document */ public String title; - - static const long serialVersionUID = 4121132532906340919L; + + static final long serialVersionUID = 4121132532906340919L; - this (Widget w) { - super(w); - } +this(Widget w) { + super(w); +} - /** - * Returns a string containing a concise, human-readable - * description of the receiver. - * - * @return a string representation of the event - */ - public String toString () { - String str = super.toString(); - return str.substring(0, string.length() - 1) // remove trailing '}' - + " title=" + title + "}"; - } +/** + * Returns a string containing a concise, human-readable + * description of the receiver. + * + * @return a string representation of the event + */ +public override String toString() { + return Format( "{} {title = {}}", + super.toString[1 .. $-2], title ); } +}
--- a/dwt/browser/TitleListener.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/TitleListener.d Fri Jan 16 12:49:08 2009 +0100 @@ -7,14 +7,14 @@ * * Contributors: * IBM Corporation - initial API and implementation - * * Port to the D programming language: - * Jacob Carlborg <doob@me.com> + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.TitleListener; import dwt.browser.TitleEvent; -import dwt.dwthelper.utils; +//import dwt.dwthelper.utils; + import dwt.internal.DWTEventListener; /** @@ -29,22 +29,22 @@ */ public interface TitleListener : DWTEventListener { - /** - * This method is called when the title of the current document - * is available or has changed. - * <p> - * - * <p>The following fields in the <code>TitleEvent</code> apply: - * <ul> - * <li>(in) title the title of the current document - * <li>(in) widget the <code>Browser</code> whose current document's - * title is known or modified - * </ul> - * - * @param event the <code>TitleEvent</code> that contains the title - * of the document currently displayed in a <code>Browser</code> - * - * @since 3.0 - */ - public void changed (TitleEvent event); +/** + * This method is called when the title of the current document + * is available or has changed. + * <p> + * + * <p>The following fields in the <code>TitleEvent</code> apply: + * <ul> + * <li>(in) title the title of the current document + * <li>(in) widget the <code>Browser</code> whose current document's + * title is known or modified + * </ul> + * + * @param event the <code>TitleEvent</code> that contains the title + * of the document currently displayed in a <code>Browser</code> + * + * @since 3.0 + */ +public void changed(TitleEvent event); }
--- a/dwt/browser/VisibilityWindowAdapter.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/VisibilityWindowAdapter.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,5 +1,5 @@ -/******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. +/******************************************************************************* + * Copyright (c) 2003, 2004 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 @@ -7,15 +7,13 @@ * * Contributors: * IBM Corporation - initial API and implementation - * * Port to the D programming language: - * Jacob Carlborg <doob@me.com> + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.VisibilityWindowAdapter; +import dwt.browser.WindowEvent; import dwt.browser.VisibilityWindowListener; -import dwt.browser.WindowEvent; -import dwt.dwthelper.utils; /** * This adapter class provides default implementations for the @@ -26,15 +24,13 @@ * interested in. * </p> * - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> - * * @since 3.0 */ public abstract class VisibilityWindowAdapter : VisibilityWindowListener { public void hide(WindowEvent event) { } - + public void show(WindowEvent event) { } }
--- a/dwt/browser/VisibilityWindowListener.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/VisibilityWindowListener.d Fri Jan 16 12:49:08 2009 +0100 @@ -7,14 +7,14 @@ * * Contributors: * IBM Corporation - initial API and implementation - * * Port to the D programming language: - * Jacob Carlborg <doob@me.com> + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.VisibilityWindowListener; import dwt.browser.WindowEvent; -import dwt.dwthelper.utils; +//import dwt.dwthelper.utils; + import dwt.internal.DWTEventListener; /** @@ -30,67 +30,67 @@ * @since 3.0 */ public interface VisibilityWindowListener : DWTEventListener { - - /** - * This method is called when the window hosting a <code>Browser</code> - * is requested to be hidden. Application would typically hide the - * {@link dwt.widgets.Shell} that hosts the <code>Browser</code>. - * <p> - * - * <p>The following fields in the <code>WindowEvent</code> apply: - * <ul> - * <li>(in) widget the <code>Browser</code> that needs to be hidden - * </ul> - * - * @param event the <code>WindowEvent</code> that specifies the - * <code>Browser</code> that needs to be hidden - * - * @see dwt.widgets.Shell#setVisible(bool) - * - * @since 3.0 - */ - public void hide (WindowEvent event); + +/** + * This method is called when the window hosting a <code>Browser</code> + * is requested to be hidden. Application would typically hide the + * {@link dwt.widgets.Shell} that hosts the <code>Browser</code>. + * <p> + * + * <p>The following fields in the <code>WindowEvent</code> apply: + * <ul> + * <li>(in) widget the <code>Browser</code> that needs to be hidden + * </ul> + * + * @param event the <code>WindowEvent</code> that specifies the + * <code>Browser</code> that needs to be hidden + * + * @see dwt.widgets.Shell#setVisible(bool) + * + * @since 3.0 + */ +public void hide(WindowEvent event); - /** - * This method is called when the window hosting a <code>Browser</code> - * is requested to be displayed. Application would typically set the - * location and the size of the {@link dwt.widgets.Shell} - * that hosts the <code>Browser</code>, if a particular location and size - * are specified. The application would then open that <code>Shell</code>. - * <p> - * - * <p>The following fields in the <code>WindowEvent</code> apply: - * <ul> - * <li>(in) widget the <code>Browser</code> to display - * <li>(in) location the requested location for the <code>Shell</code> - * hosting the browser. It is <code>null</code> if no location is set. - * <li>(in) size the requested size for the <code>Browser</code>. - * The client area of the <code>Shell</code> hosting the - * <code>Browser</code> should be large enough to accommodate that size. - * It is <code>null</code> if no size is set. - * <li>(in) addressBar <code>true</code> if the <code>Shell</code> - * hosting the <code>Browser</code> should display an address bar or - * <code>false</code> otherwise - * <li>(in) menuBar <code>true</code> if the <code>Shell</code> - * hosting the <code>Browser</code> should display a menu bar or - * <code>false</code> otherwise - * <li>(in) statusBar <code>true</code> if the <code>Shell</code> - * hosting the <code>Browser</code> should display a status bar or - * <code>false</code> otherwise - * <li>(in) toolBar <code>true</code> if the <code>Shell</code> - * hosting the <code>Browser</code> should display a tool bar or - * <code>false</code> otherwise - * </ul> - * - * @param event the <code>WindowEvent</code> that specifies the - * <code>Browser</code> that needs to be displayed - * - * @see dwt.widgets.Control#setLocation(dwt.graphics.Point) - * @see dwt.widgets.Control#setSize(dwt.graphics.Point) - * @see dwt.widgets.Shell#open() - * - * @since 3.0 - */ - public void show (WindowEvent event); +/** + * This method is called when the window hosting a <code>Browser</code> + * is requested to be displayed. Application would typically set the + * location and the size of the {@link dwt.widgets.Shell} + * that hosts the <code>Browser</code>, if a particular location and size + * are specified. The application would then open that <code>Shell</code>. + * <p> + * + * <p>The following fields in the <code>WindowEvent</code> apply: + * <ul> + * <li>(in) widget the <code>Browser</code> to display + * <li>(in) location the requested location for the <code>Shell</code> + * hosting the browser. It is <code>null</code> if no location is set. + * <li>(in) size the requested size for the <code>Browser</code>. + * The client area of the <code>Shell</code> hosting the + * <code>Browser</code> should be large enough to accommodate that size. + * It is <code>null</code> if no size is set. + * <li>(in) addressBar <code>true</code> if the <code>Shell</code> + * hosting the <code>Browser</code> should display an address bar or + * <code>false</code> otherwise + * <li>(in) menuBar <code>true</code> if the <code>Shell</code> + * hosting the <code>Browser</code> should display a menu bar or + * <code>false</code> otherwise + * <li>(in) statusBar <code>true</code> if the <code>Shell</code> + * hosting the <code>Browser</code> should display a status bar or + * <code>false</code> otherwise + * <li>(in) toolBar <code>true</code> if the <code>Shell</code> + * hosting the <code>Browser</code> should display a tool bar or + * <code>false</code> otherwise + * </ul> + * + * @param event the <code>WindowEvent</code> that specifies the + * <code>Browser</code> that needs to be displayed + * + * @see dwt.widgets.Control#setLocation(dwt.graphics.Point) + * @see dwt.widgets.Control#setSize(dwt.graphics.Point) + * @see dwt.widgets.Shell#open() + * + * @since 3.0 + */ +public void show(WindowEvent event); }
--- a/dwt/browser/WebBrowser.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/WebBrowser.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,5 +1,5 @@ -/******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. +/******************************************************************************* + * 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 @@ -7,13 +7,16 @@ * * Contributors: * IBM Corporation - initial API and implementation - * * Port to the D programming language: - * Jacob Carlborg <doob@me.com> + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.WebBrowser; +import dwt.dwthelper.utils; + import dwt.DWT; +import dwt.widgets.Composite; + import dwt.browser.Browser; import dwt.browser.CloseWindowListener; import dwt.browser.LocationListener; @@ -22,413 +25,390 @@ import dwt.browser.StatusTextListener; import dwt.browser.TitleListener; import dwt.browser.VisibilityWindowListener; -import dwt.dwthelper.utils; -import dwt.dwthelper.Runnable; -import dwt.dwthelper.System; -import dwt.widgets.Composite; abstract class WebBrowser { Browser browser; - CloseWindowListener[] closeWindowListeners = new CloseWindowListener[0]; - LocationListener[] locationListeners = new LocationListener[0]; - OpenWindowListener[] openWindowListeners = new OpenWindowListener[0]; - ProgressListener[] progressListeners = new ProgressListener[0]; - StatusTextListener[] statusTextListeners = new StatusTextListener[0]; - TitleListener[] titleListeners = new TitleListener[0]; - VisibilityWindowListener[] visibilityWindowListeners = new VisibilityWindowListener[0]; + CloseWindowListener[] closeWindowListeners; + LocationListener[] locationListeners; + OpenWindowListener[] openWindowListeners; + ProgressListener[] progressListeners; + StatusTextListener[] statusTextListeners; + TitleListener[] titleListeners; + VisibilityWindowListener[] visibilityWindowListeners; static Runnable MozillaClearSessions; static Runnable NativeClearSessions; /* Key Mappings */ - static const int[][] KeyTable = [ + static final int [][] KeyTable = [ /* Keyboard and Mouse Masks */ - [18, DWT.ALT], - [16, DWT.SHIFT], - [17, DWT.CONTROL], - [224, DWT.COMMAND], + [18, DWT.ALT], + [16, DWT.SHIFT], + [17, DWT.CONTROL], + [224, DWT.COMMAND], /* Literal Keys */ - [65, 'a'], - [66, 'b'], - [67, 'c'], - [68, 'd'], - [69, 'e'], - [70, 'f'], - [71, 'g'], - [72, 'h'], - [73, 'i'], - [74, 'j'], - [75, 'k'], - [76, 'l'], - [77, 'm'], - [78, 'n'], - [79, 'o'], - [80, 'p'], - [81, 'q'], - [82, 'r'], - [83, 's'], - [84, 't'], - [85, 'u'], - [86, 'v'], - [87, 'w'], - [88, 'x'], - [89, 'y'], - [90, 'z'], - [48, '0'], - [49, '1'], - [50, '2'], - [51, '3'], - [52, '4'], - [53, '5'], - [54, '6'], - [55, '7'], - [56, '8'], - [57, '9'], - [32, ' '], - [59, ';'], - [61, '='], - [188, ','], - [190, '.'], - [191, '/'], - [219, '['], - [221, ']'], - [222, '\''], - [192, '`'], - [220, '\\'], - [108, '|'], + [65, 'a'], + [66, 'b'], + [67, 'c'], + [68, 'd'], + [69, 'e'], + [70, 'f'], + [71, 'g'], + [72, 'h'], + [73, 'i'], + [74, 'j'], + [75, 'k'], + [76, 'l'], + [77, 'm'], + [78, 'n'], + [79, 'o'], + [80, 'p'], + [81, 'q'], + [82, 'r'], + [83, 's'], + [84, 't'], + [85, 'u'], + [86, 'v'], + [87, 'w'], + [88, 'x'], + [89, 'y'], + [90, 'z'], + [48, '0'], + [49, '1'], + [50, '2'], + [51, '3'], + [52, '4'], + [53, '5'], + [54, '6'], + [55, '7'], + [56, '8'], + [57, '9'], + [32, ' '], + [59, ';'], + [61, '='], + [188, ','], + [190, '.'], + [191, '/'], + [219, '['], + [221, ']'], + [222, '\''], + [192, '`'], + [220, '\\'], + [108, '|'], /* Non-Numeric Keypad Keys */ - [37, DWT.ARROW_LEFT], - [39, DWT.ARROW_RIGHT], - [38, DWT.ARROW_UP], - [40, DWT.ARROW_DOWN], - [45, DWT.INSERT], - [36, DWT.HOME], - [35, DWT.END], - [46, DWT.DEL], - [33, DWT.PAGE_UP], - [34, DWT.PAGE_DOWN], + [37, DWT.ARROW_LEFT], + [39, DWT.ARROW_RIGHT], + [38, DWT.ARROW_UP], + [40, DWT.ARROW_DOWN], + [45, DWT.INSERT], + [36, DWT.HOME], + [35, DWT.END], + [46, DWT.DEL], + [33, DWT.PAGE_UP], + [34, DWT.PAGE_DOWN], /* Virtual and Ascii Keys */ - [8, DWT.BS], - [13, DWT.CR], - [9, DWT.TAB], - [27, DWT.ESC], - [12, DWT.DEL], + [8, DWT.BS], + [13, DWT.CR], + [9, DWT.TAB], + [27, DWT.ESC], + [12, DWT.DEL], /* Functions Keys */ - [112, DWT.F1], - [113, DWT.F2], - [114, DWT.F3], - [115, DWT.F4], - [116, DWT.F5], - [117, DWT.F6], - [118, DWT.F7], - [119, DWT.F8], - [120, DWT.F9], - [121, DWT.F10], - [122, DWT.F11], - [123, DWT.F12], - [124, DWT.F13], - [125, DWT.F14], - [126, DWT.F15], - [127, 0], - [128, 0], - [129, 0], - [130, 0], - [131, 0], - [132, 0], - [133, 0], - [134, 0], - [135, 0], + [112, DWT.F1], + [113, DWT.F2], + [114, DWT.F3], + [115, DWT.F4], + [116, DWT.F5], + [117, DWT.F6], + [118, DWT.F7], + [119, DWT.F8], + [120, DWT.F9], + [121, DWT.F10], + [122, DWT.F11], + [123, DWT.F12], + [124, DWT.F13], + [125, DWT.F14], + [126, DWT.F15], + [127, 0], + [128, 0], + [129, 0], + [130, 0], + [131, 0], + [132, 0], + [133, 0], + [134, 0], + [135, 0], /* Numeric Keypad Keys */ - [96, DWT.KEYPAD_0], - [97, DWT.KEYPAD_1], - [98, DWT.KEYPAD_2], - [99, DWT.KEYPAD_3], - [100, DWT.KEYPAD_4], - [101, DWT.KEYPAD_5], - [102, DWT.KEYPAD_6], - [103, DWT.KEYPAD_7], - [104, DWT.KEYPAD_8], - [105, DWT.KEYPAD_9], - [14, DWT.KEYPAD_CR], - [107, DWT.KEYPAD_ADD], - [109, DWT.KEYPAD_SUBTRACT], - [106, DWT.KEYPAD_MULTIPLY], - [111, DWT.KEYPAD_DIVIDE], - [110, DWT.KEYPAD_DECIMAL], + [96, DWT.KEYPAD_0], + [97, DWT.KEYPAD_1], + [98, DWT.KEYPAD_2], + [99, DWT.KEYPAD_3], + [100, DWT.KEYPAD_4], + [101, DWT.KEYPAD_5], + [102, DWT.KEYPAD_6], + [103, DWT.KEYPAD_7], + [104, DWT.KEYPAD_8], + [105, DWT.KEYPAD_9], + [14, DWT.KEYPAD_CR], + [107, DWT.KEYPAD_ADD], + [109, DWT.KEYPAD_SUBTRACT], + [106, DWT.KEYPAD_MULTIPLY], + [111, DWT.KEYPAD_DIVIDE], + [110, DWT.KEYPAD_DECIMAL], /* Other keys */ - [20, DWT.CAPS_LOCK], - [144, DWT.NUM_LOCK], - [145, DWT.SCROLL_LOCK], - [44, DWT.PRINT_SCREEN], - [6, DWT.HELP], - [19, DWT.PAUSE], - [3, DWT.BREAK], + [20, DWT.CAPS_LOCK], + [144, DWT.NUM_LOCK], + [145, DWT.SCROLL_LOCK], + [44, DWT.PRINT_SCREEN], + [6, DWT.HELP], + [19, DWT.PAUSE], + [3, DWT.BREAK], /* Safari-specific */ - [186, ';'], - [187, '='], - [189, '-'] - , ]; + [186, ';'], + [187, '='], + [189, '-'], + ]; - public void addCloseWindowListener (CloseWindowListener listener) { - CloseWindowListener[] newCloseWindowListeners = new CloseWindowListener[closeWindowListeners.length + 1]; - System.arraycopy(closeWindowListeners, 0, newCloseWindowListeners, 0, closeWindowListeners.length); - closeWindowListeners = newCloseWindowListeners; - closeWindowListeners[closeWindowListeners.length - 1] = listener; - } +public void addCloseWindowListener (CloseWindowListener listener) { + //CloseWindowListener[] newCloseWindowListeners = new CloseWindowListener[closeWindowListeners.length + 1]; + //System.arraycopy(closeWindowListeners, 0, newCloseWindowListeners, 0, closeWindowListeners.length); + //closeWindowListeners = newCloseWindowListeners; + closeWindowListeners ~= listener; +} - public void addLocationListener (LocationListener listener) { - LocationListener[] newLocationListeners = new LocationListener[locationListeners.length + 1]; - System.arraycopy(locationListeners, 0, newLocationListeners, 0, locationListeners.length); - locationListeners = newLocationListeners; - locationListeners[locationListeners.length - 1] = listener; - } +public void addLocationListener (LocationListener listener) { + //LocationListener[] newLocationListeners = new LocationListener[locationListeners.length + 1]; + //System.arraycopy(locationListeners, 0, newLocationListeners, 0, locationListeners.length); + //locationListeners = newLocationListeners; + locationListeners ~= listener; +} - public void addOpenWindowListener (OpenWindowListener listener) { - OpenWindowListener[] newOpenWindowListeners = new OpenWindowListener[openWindowListeners.length + 1]; - System.arraycopy(openWindowListeners, 0, newOpenWindowListeners, 0, openWindowListeners.length); - openWindowListeners = newOpenWindowListeners; - openWindowListeners[openWindowListeners.length - 1] = listener; - } +public void addOpenWindowListener (OpenWindowListener listener) { + //OpenWindowListener[] newOpenWindowListeners = new OpenWindowListener[openWindowListeners.length + 1]; + //System.arraycopy(openWindowListeners, 0, newOpenWindowListeners, 0, openWindowListeners.length); + //openWindowListeners = newOpenWindowListeners; + openWindowListeners ~= listener; +} - public void addProgressListener (ProgressListener listener) { - ProgressListener[] newProgressListeners = new ProgressListener[progressListeners.length + 1]; - System.arraycopy(progressListeners, 0, newProgressListeners, 0, progressListeners.length); - progressListeners = newProgressListeners; - progressListeners[progressListeners.length - 1] = listener; - } +public void addProgressListener (ProgressListener listener) { + //ProgressListener[] newProgressListeners = new ProgressListener[progressListeners.length + 1]; + //System.arraycopy(progressListeners, 0, newProgressListeners, 0, progressListeners.length); + //progressListeners = newProgressListeners; + progressListeners ~= listener; +} - public void addStatusTextListener (StatusTextListener listener) { - StatusTextListener[] newStatusTextListeners = new StatusTextListener[statusTextListeners.length + 1]; - System.arraycopy(statusTextListeners, 0, newStatusTextListeners, 0, statusTextListeners.length); - statusTextListeners = newStatusTextListeners; - statusTextListeners[statusTextListeners.length - 1] = listener; - } +public void addStatusTextListener (StatusTextListener listener) { + //StatusTextListener[] newStatusTextListeners = new StatusTextListener[statusTextListeners.length + 1]; + //System.arraycopy(statusTextListeners, 0, newStatusTextListeners, 0, statusTextListeners.length); + //statusTextListeners = newStatusTextListeners; + statusTextListeners ~= listener; +} - public void addTitleListener (TitleListener listener) { - TitleListener[] newTitleListeners = new TitleListener[titleListeners.length + 1]; - System.arraycopy(titleListeners, 0, newTitleListeners, 0, titleListeners.length); - titleListeners = newTitleListeners; - titleListeners[titleListeners.length - 1] = listener; - } +public void addTitleListener (TitleListener listener) { + //TitleListener[] newTitleListeners = new TitleListener[titleListeners.length + 1]; + //System.arraycopy(titleListeners, 0, newTitleListeners, 0, titleListeners.length); + //titleListeners = newTitleListeners; + titleListeners ~= listener; +} - public void addVisibilityWindowListener (VisibilityWindowListener listener) { - VisibilityWindowListener[] newVisibilityWindowListeners = new VisibilityWindowListener[visibilityWindowListeners.length + 1]; - System.arraycopy(visibilityWindowListeners, 0, newVisibilityWindowListeners, 0, visibilityWindowListeners.length); - visibilityWindowListeners = newVisibilityWindowListeners; - visibilityWindowListeners[visibilityWindowListeners.length - 1] = listener; - } +public void addVisibilityWindowListener (VisibilityWindowListener listener) { + //VisibilityWindowListener[] newVisibilityWindowListeners = new VisibilityWindowListener[visibilityWindowListeners.length + 1]; + //System.arraycopy(visibilityWindowListeners, 0, newVisibilityWindowListeners, 0, visibilityWindowListeners.length); + //visibilityWindowListeners = newVisibilityWindowListeners; + visibilityWindowListeners ~= listener; +} - public abstract bool back (); - - public static void clearSessions () { - if (NativeClearSessions !is null) - NativeClearSessions.run(); - if (MozillaClearSessions !is null) - MozillaClearSessions.run(); - } +public abstract bool back (); - public abstract void create (Composite parent, int style); - - public abstract bool execute (String script); - - public abstract bool forward (); +public static void clearSessions () { + if (NativeClearSessions !is null) NativeClearSessions.run (); + if (MozillaClearSessions !is null) MozillaClearSessions.run (); +} -public abstract String getBrowserType (); +public abstract void create (Composite parent, int style); + +public abstract bool execute (String script); - public abstract String getText (); +public abstract bool forward (); - public abstract String getUrl (); +public abstract String getText (); - public Object getWebBrowser () { - return null; - } +public abstract String getUrl (); - public abstract bool isBackEnabled (); +public Object getWebBrowser () { + return null; +} - public bool isFocusControl () { - return false; - } +public abstract bool isBackEnabled (); - public abstract bool isForwardEnabled (); +public bool isFocusControl () { + return false; +} - public abstract void refresh (); +public abstract bool isForwardEnabled (); - public void removeCloseWindowListener (CloseWindowListener listener) { - if (closeWindowListeners.length is 0) - return; - int index = -1; - for (int i = 0; i < closeWindowListeners.length; i++) { - if (listener is closeWindowListeners[i]) { - index = i; - break; - } - } - if (index is -1) - return; - if (closeWindowListeners.length is 1) { - closeWindowListeners = new CloseWindowListener[0]; - return; +public abstract void refresh (); + +public void removeCloseWindowListener (CloseWindowListener listener) { + if (closeWindowListeners.length is 0) return; + int index = -1; + for (int i = 0; i < closeWindowListeners.length; i++) { + if (listener is closeWindowListeners[i]){ + index = i; + break; } - CloseWindowListener[] newCloseWindowListeners = new CloseWindowListener[closeWindowListeners.length - 1]; - System.arraycopy(closeWindowListeners, 0, newCloseWindowListeners, 0, index); - System.arraycopy(closeWindowListeners, index + 1, newCloseWindowListeners, index, closeWindowListeners.length - index - 1); - closeWindowListeners = newCloseWindowListeners; + } + if (index is -1) return; + if (closeWindowListeners.length is 1) { + closeWindowListeners = new CloseWindowListener[0]; + return; } + //CloseWindowListener[] newCloseWindowListeners = new CloseWindowListener[closeWindowListeners.length - 1]; + //System.arraycopy (closeWindowListeners, 0, newCloseWindowListeners, 0, index); + //System.arraycopy (closeWindowListeners, index + 1, newCloseWindowListeners, index, closeWindowListeners.length - index - 1); + closeWindowListeners = closeWindowListeners[0..index] ~ closeWindowListeners[index+1..$]; +} - public void removeLocationListener (LocationListener listener) { - if (locationListeners.length is 0) - return; - int index = -1; - for (int i = 0; i < locationListeners.length; i++) { - if (listener is locationListeners[i]) { - index = i; - break; - } - } - if (index is -1) - return; - if (locationListeners.length is 1) { - locationListeners = new LocationListener[0]; - return; +public void removeLocationListener (LocationListener listener) { + if (locationListeners.length is 0) return; + int index = -1; + for (int i = 0; i < locationListeners.length; i++) { + if (listener is locationListeners[i]){ + index = i; + break; } - LocationListener[] newLocationListeners = new LocationListener[locationListeners.length - 1]; - System.arraycopy(locationListeners, 0, newLocationListeners, 0, index); - System.arraycopy(locationListeners, index + 1, newLocationListeners, index, locationListeners.length - index - 1); - locationListeners = newLocationListeners; + } + if (index is -1) return; + if (locationListeners.length is 1) { + locationListeners = new LocationListener[0]; + return; } - - public void removeOpenWindowListener (OpenWindowListener listener) { - if (openWindowListeners.length is 0) - return; - int index = -1; - for (int i = 0; i < openWindowListeners.length; i++) { - if (listener is openWindowListeners[i]) { - index = i; - break; - } - } - if (index is -1) - return; - if (openWindowListeners.length is 1) { - openWindowListeners = new OpenWindowListener[0]; - return; - } - OpenWindowListener[] newOpenWindowListeners = new OpenWindowListener[openWindowListeners.length - 1]; - System.arraycopy(openWindowListeners, 0, newOpenWindowListeners, 0, index); - System.arraycopy(openWindowListeners, index + 1, newOpenWindowListeners, index, openWindowListeners.length - index - 1); - openWindowListeners = newOpenWindowListeners; - } + //LocationListener[] newLocationListeners = new LocationListener[locationListeners.length - 1]; + //System.arraycopy (locationListeners, 0, newLocationListeners, 0, index); + //System.arraycopy (locationListeners, index + 1, newLocationListeners, index, locationListeners.length - index - 1); + locationListeners = locationListeners[0..index] ~ locationListeners[index+1..$]; +} - public void removeProgressListener (ProgressListener listener) { - if (progressListeners.length is 0) - return; - int index = -1; - for (int i = 0; i < progressListeners.length; i++) { - if (listener is progressListeners[i]) { - index = i; - break; - } - } - if (index is -1) - return; - if (progressListeners.length is 1) { - progressListeners = new ProgressListener[0]; - return; +public void removeOpenWindowListener (OpenWindowListener listener) { + if (openWindowListeners.length is 0) return; + int index = -1; + for (int i = 0; i < openWindowListeners.length; i++) { + if (listener is openWindowListeners[i]){ + index = i; + break; } - ProgressListener[] newProgressListeners = new ProgressListener[progressListeners.length - 1]; - System.arraycopy(progressListeners, 0, newProgressListeners, 0, index); - System.arraycopy(progressListeners, index + 1, newProgressListeners, index, progressListeners.length - index - 1); - progressListeners = newProgressListeners; + } + if (index is -1) return; + if (openWindowListeners.length is 1) { + openWindowListeners = new OpenWindowListener[0]; + return; } + //OpenWindowListener[] newOpenWindowListeners = new OpenWindowListener[openWindowListeners.length - 1]; + //System.arraycopy (openWindowListeners, 0, newOpenWindowListeners, 0, index); + //System.arraycopy (openWindowListeners, index + 1, newOpenWindowListeners, index, openWindowListeners.length - index - 1); + openWindowListeners = openWindowListeners[0..index] ~ openWindowListeners[index+1..$]; +} - public void removeStatusTextListener (StatusTextListener listener) { - if (statusTextListeners.length is 0) - return; - int index = -1; - for (int i = 0; i < statusTextListeners.length; i++) { - if (listener is statusTextListeners[i]) { - index = i; - break; - } +public void removeProgressListener (ProgressListener listener) { + if (progressListeners.length is 0) return; + int index = -1; + for (int i = 0; i < progressListeners.length; i++) { + if (listener is progressListeners[i]){ + index = i; + break; } - if (index is -1) - return; - if (statusTextListeners.length is 1) { - statusTextListeners = new StatusTextListener[0]; - return; + } + if (index is -1) return; + if (progressListeners.length is 1) { + progressListeners = new ProgressListener[0]; + return; + } + //ProgressListener[] newProgressListeners = new ProgressListener[progressListeners.length - 1]; + //System.arraycopy (progressListeners, 0, newProgressListeners, 0, index); + //System.arraycopy (progressListeners, index + 1, newProgressListeners, index, progressListeners.length - index - 1); + progressListeners = progressListeners[0..index] ~ progressListeners[index+1..$]; +} + +public void removeStatusTextListener (StatusTextListener listener) { + if (statusTextListeners.length is 0) return; + int index = -1; + for (int i = 0; i < statusTextListeners.length; i++) { + if (listener is statusTextListeners[i]){ + index = i; + break; } - StatusTextListener[] newStatusTextListeners = new StatusTextListener[statusTextListeners.length - 1]; - System.arraycopy(statusTextListeners, 0, newStatusTextListeners, 0, index); - System.arraycopy(statusTextListeners, index + 1, newStatusTextListeners, index, statusTextListeners.length - index - 1); - statusTextListeners = newStatusTextListeners; + } + if (index is -1) return; + if (statusTextListeners.length is 1) { + statusTextListeners = new StatusTextListener[0]; + return; } + //StatusTextListener[] newStatusTextListeners = new StatusTextListener[statusTextListeners.length - 1]; + //System.arraycopy (statusTextListeners, 0, newStatusTextListeners, 0, index); + //System.arraycopy (statusTextListeners, index + 1, newStatusTextListeners, index, statusTextListeners.length - index - 1); + statusTextListeners = statusTextListeners[0..index] ~ statusTextListeners[index+1..$]; +} - public void removeTitleListener (TitleListener listener) { - if (titleListeners.length is 0) - return; - int index = -1; - for (int i = 0; i < titleListeners.length; i++) { - if (listener is titleListeners[i]) { - index = i; - break; - } +public void removeTitleListener (TitleListener listener) { + if (titleListeners.length is 0) return; + int index = -1; + for (int i = 0; i < titleListeners.length; i++) { + if (listener is titleListeners[i]){ + index = i; + break; } - if (index is -1) - return; - if (titleListeners.length is 1) { - titleListeners = new TitleListener[0]; - return; - } - TitleListener[] newTitleListeners = new TitleListener[titleListeners.length - 1]; - System.arraycopy(titleListeners, 0, newTitleListeners, 0, index); - System.arraycopy(titleListeners, index + 1, newTitleListeners, index, titleListeners.length - index - 1); - titleListeners = newTitleListeners; + } + if (index is -1) return; + if (titleListeners.length is 1) { + titleListeners = new TitleListener[0]; + return; } + TitleListener[] newTitleListeners = new TitleListener[titleListeners.length - 1]; + //System.arraycopy (titleListeners, 0, newTitleListeners, 0, index); + //System.arraycopy (titleListeners, index + 1, newTitleListeners, index, titleListeners.length - index - 1); + titleListeners = titleListeners[0..index] ~ titleListeners[index+1..$]; +} - public void removeVisibilityWindowListener (VisibilityWindowListener listener) { - if (visibilityWindowListeners.length is 0) - return; - int index = -1; - for (int i = 0; i < visibilityWindowListeners.length; i++) { - if (listener is visibilityWindowListeners[i]) { - index = i; - break; - } - } - if (index is -1) - return; - if (visibilityWindowListeners.length is 1) { - visibilityWindowListeners = new VisibilityWindowListener[0]; - return; +public void removeVisibilityWindowListener (VisibilityWindowListener listener) { + if (visibilityWindowListeners.length is 0) return; + int index = -1; + for (int i = 0; i < visibilityWindowListeners.length; i++) { + if (listener is visibilityWindowListeners[i]){ + index = i; + break; } - VisibilityWindowListener[] newVisibilityWindowListeners = new VisibilityWindowListener[visibilityWindowListeners.length - 1]; - System.arraycopy(visibilityWindowListeners, 0, newVisibilityWindowListeners, 0, index); - System.arraycopy(visibilityWindowListeners, index + 1, newVisibilityWindowListeners, index, visibilityWindowListeners.length - index - 1); - visibilityWindowListeners = newVisibilityWindowListeners; + } + if (index is -1) return; + if (visibilityWindowListeners.length is 1) { + visibilityWindowListeners = new VisibilityWindowListener[0]; + return; } - - public void setBrowser (Browser browser) { - this.browser = browser; - } - - public abstract bool setText (String html); + //VisibilityWindowListener[] newVisibilityWindowListeners = new VisibilityWindowListener[visibilityWindowListeners.length - 1]; + //System.arraycopy (visibilityWindowListeners, 0, newVisibilityWindowListeners, 0, index); + //System.arraycopy (visibilityWindowListeners, index + 1, newVisibilityWindowListeners, index, visibilityWindowListeners.length - index - 1); + visibilityWindowListeners = visibilityWindowListeners[0..index] ~ visibilityWindowListeners[index+1..$]; +} - public abstract bool setUrl (String url); +public void setBrowser (Browser browser) { + this.browser = browser; +} - public abstract void stop (); +public abstract bool setText (String html); + +public abstract bool setUrl (String url); - int translateKey (int key) { - for (int i = 0; i < KeyTable.length; i++) { - if (KeyTable[i][0] is key) - return KeyTable[i][1]; - } - return 0; +public abstract void stop (); + +int translateKey (int key) { + for (int i = 0; i < KeyTable.length; i++) { + if (KeyTable[i][0] is key) return KeyTable[i][1]; } + return 0; } +}
--- a/dwt/browser/WindowCreator2.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/WindowCreator2.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * 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 @@ -7,6 +7,8 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Port to the D programming language: + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.WindowCreator2; @@ -14,10 +16,12 @@ import dwt.DWT; import dwt.graphics.Point; -import dwt.internal.C; + import dwt.internal.Platform; -import dwt.internal.mozilla.XPCOM; -import dwt.internal.mozilla.XPCOMObject; +import dwt.internal.mozilla.Common; + +import XPCOM = dwt.internal.mozilla.XPCOM; + import dwt.internal.mozilla.nsIBaseWindow; import dwt.internal.mozilla.nsID; import dwt.internal.mozilla.nsISupports; @@ -26,137 +30,102 @@ import dwt.internal.mozilla.nsIWebBrowserChrome; import dwt.internal.mozilla.nsIWindowCreator; import dwt.internal.mozilla.nsIWindowCreator2; +import dwt.internal.mozilla.nsStringAPI; +import dwt.internal.mozilla.nsEmbedString; + import dwt.layout.FillLayout; import dwt.widgets.Shell; -class WindowCreator2 { - XPCOMObject supports; - XPCOMObject windowCreator; - XPCOMObject windowCreator2; +import dwt.browser.Browser; +import dwt.browser.Mozilla; +import dwt.browser.VisibilityWindowListener; +import dwt.browser.CloseWindowListener; +import dwt.browser.WindowEvent; + +class WindowCreator2 : nsIWindowCreator2 { int refCount = 0; -this () { - createCOMInterfaces (); -} +this () {} -int AddRef () { +extern(System) +nsrefcnt 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], cast(int)/*64*/args[1], args[2]);} - }; - - windowCreator2 = new XPCOMObject (new int[] {2, 0, 0, 3, 6}) { - 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], cast(int)/*64*/args[1], args[2]);} - public int /*long*/ method4 (int /*long*/[] args) {return CreateChromeWindow2 (args[0], cast(int)/*64*/args[1], cast(int)/*64*/args[2], args[3], args[4], args[5]);} - }; -} - -void disposeCOMInterfaces () { - if (supports !is null) { - supports.dispose (); - supports = null; - } - if (windowCreator !is null) { - windowCreator.dispose (); - windowCreator = null; - } - - if (windowCreator2 !is null) { - windowCreator2.dispose (); - windowCreator2 = null; - } -} - -int /*long*/ getAddress () { - return windowCreator.getAddress (); -} - -int QueryInterface (int /*long*/ riid, int /*long*/ ppvObject) { - if (riid is 0 || ppvObject is 0) return XPCOM.NS_ERROR_NO_INTERFACE; - nsID guid = new nsID (); - XPCOM.memmove (guid, riid, nsID.sizeof); +extern(System) +nsresult QueryInterface (nsID* riid, void** ppvObject) { + if (riid is null || ppvObject is null) 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); + if (*riid == nsISupports.IID) { + *ppvObject = cast(void*)cast(nsISupports)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIWindowCreator.NS_IWINDOWCREATOR_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {windowCreator.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIWindowCreator.IID) { + *ppvObject = cast(void*)cast(nsIWindowCreator)this; AddRef (); return XPCOM.NS_OK; } - if (guid.Equals (nsIWindowCreator2.NS_IWINDOWCREATOR2_IID)) { - XPCOM.memmove (ppvObject, new int /*long*/[] {windowCreator2.getAddress ()}, C.PTR_SIZEOF); + if (*riid == nsIWindowCreator2.IID) { + *ppvObject = cast(void*)cast(nsIWindowCreator2)this; AddRef (); return XPCOM.NS_OK; } - XPCOM.memmove (ppvObject, new int /*long*/[] {0}, C.PTR_SIZEOF); + *ppvObject = null; return XPCOM.NS_ERROR_NO_INTERFACE; } - -int Release () { + +extern(System) +nsresult Release () { refCount--; - if (refCount is 0) disposeCOMInterfaces (); + //if (refCount is 0) disposeCOMInterfaces (); return refCount; } - + /* nsIWindowCreator */ -int CreateChromeWindow (int /*long*/ parent, int chromeFlags, int /*long*/ _retval) { - return CreateChromeWindow2 (parent, chromeFlags, 0, 0, 0, _retval); +extern(System) +nsresult CreateChromeWindow (nsIWebBrowserChrome parent, PRUint32 chromeFlags, nsIWebBrowserChrome* _retval) { + return CreateChromeWindow2 (parent, chromeFlags, 0, null, null, _retval); } /* nsIWindowCreator2 */ -int CreateChromeWindow2 (int /*long*/ parent, int chromeFlags, int contextFlags, int /*long*/ uri, int /*long*/ cancel, int /*long*/ _retval) { - if (parent is 0 && (chromeFlags & nsIWebBrowserChrome.CHROME_OPENAS_CHROME) is 0) { +extern(System) +nsresult CreateChromeWindow2 (nsIWebBrowserChrome parent, PRUint32 chromeFlags, PRUint32 contextFlags, nsIURI uri, PRBool* cancel, nsIWebBrowserChrome* _retval) { + if (parent is null && (chromeFlags & nsIWebBrowserChrome.CHROME_OPENAS_CHROME) is 0) { return XPCOM.NS_ERROR_NOT_IMPLEMENTED; } Browser src = null; - if (parent !is 0) { - nsIWebBrowserChrome browserChromeParent = new nsIWebBrowserChrome (parent); - int /*long*/[] aWebBrowser = new int /*long*/[1]; - int rc = browserChromeParent.GetWebBrowser (aWebBrowser); + if (parent !is null) { + //nsIWebBrowserChrome browserChromeParent = new nsIWebBrowserChrome (parent); + nsIWebBrowser webBrowser; + int rc = parent.GetWebBrowser (&webBrowser); if (rc !is XPCOM.NS_OK) Mozilla.error (rc); - if (aWebBrowser[0] is 0) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE); + if (webBrowser is null) 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); + //nsIWebBrowser webBrowser = new nsIWebBrowser (aWebBrowser[0]); + nsIBaseWindow baseWindow; + rc = webBrowser.QueryInterface (&nsIBaseWindow.IID, cast(void**)&baseWindow); if (rc !is XPCOM.NS_OK) Mozilla.error (rc); - if (result[0] is 0) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE); + if (baseWindow is null) 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); + //nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); + //result[0] = 0; + nativeWindow aParentNativeWindow; // nativeWindow is "void*" (represents GtkWidget*) + rc = baseWindow.GetParentNativeWindow (&aParentNativeWindow); if (rc !is XPCOM.NS_OK) Mozilla.error (rc); - if (aParentNativeWindow[0] is 0) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE); + if (aParentNativeWindow is null) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE); baseWindow.Release (); - src = Mozilla.findBrowser (aParentNativeWindow[0]); + src = Mozilla.findBrowser (aParentNativeWindow); } - final Browser browser; + Browser browser; bool doit = true; if ((chromeFlags & nsIWebBrowserChrome.CHROME_OPENAS_CHROME) !is 0) { /* @@ -166,41 +135,45 @@ */ int style = DWT.DIALOG_TRIM; if ((chromeFlags & nsIWebBrowserChrome.CHROME_MODAL) !is 0) style |= DWT.APPLICATION_MODAL; - final Shell shell = src is null ? + Shell shell = src is null ? new Shell (style) : new Shell (src.getShell(), style); shell.setLayout (new FillLayout ()); browser = new Browser (shell, src is null ? DWT.MOZILLA : src.getStyle () & DWT.MOZILLA); - browser.addVisibilityWindowListener (new VisibilityWindowListener () { + browser.addVisibilityWindowListener (new class(shell) VisibilityWindowListener { + Shell sh; + this (Shell shell) { this.sh = shell; } public void hide (WindowEvent event) { } public void show (WindowEvent event) { - if (event.location !is null) shell.setLocation (event.location); + if (event.location !is null) sh.setLocation (event.location); if (event.size !is null) { Point size = event.size; - shell.setSize (shell.computeSize (size.x, size.y)); + sh.setSize (sh.computeSize (size.x, size.y)); } shell.open (); } }); - browser.addCloseWindowListener (new CloseWindowListener () { + browser.addCloseWindowListener (new class(shell) CloseWindowListener { + Shell sh; + this (Shell shell) { this.sh = shell; } public void close (WindowEvent event) { - shell.close (); + sh.close (); } }); - if (uri !is 0) { - nsIURI location = new nsIURI (uri); - int /*long*/ aSpec = XPCOM.nsEmbedCString_new (); - if (location.GetSpec (aSpec) is XPCOM.NS_OK) { - int length = XPCOM.nsEmbedCString_Length (aSpec); - if (length > 0) { - int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec); - byte[] dest = new byte[length]; - XPCOM.memmove (dest, buffer, length); - browser.setUrl (new String (dest)); + if (uri !is null) { + //nsIURI location = new nsIURI (uri); + scope auto aSpec = new nsEmbedCString; + if (uri.GetSpec (cast(nsACString*)aSpec) is XPCOM.NS_OK) { + int span = aSpec.toString().length; + if (span > 0) { + //int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec); + // byte[] dest = new byte[length]; + //XPCOM.memmove (dest, buffer, length); + browser.setUrl (aSpec.toString); } } - XPCOM.nsEmbedCString_delete (aSpec); + //XPCOM.nsEmbedCString_delete (aSpec); } } else { WindowEvent event = new WindowEvent (src); @@ -216,21 +189,31 @@ doit = browser !is null && !browser.isDisposed (); if (doit) { String platform = Platform.PLATFORM; - bool isMozillaNativePlatform = platform.equals ("gtk") || platform.equals ("motif"); //$NON-NLS-1$ //$NON-NLS-2$ + bool isMozillaNativePlatform = platform == "gtk" || platform == "motif"; //$NON-NLS-1$ //$NON-NLS-2$ doit = isMozillaNativePlatform || (browser.getStyle () & DWT.MOZILLA) !is 0; } } if (doit) { + // STRANGE but TRUE: browser.webBrowser is always instantiated as Mozilla (on this platform), + // so it can be cast back to the subclass Mozilla safely. Looks very dangerous, though... + // considering the next few lines of code that cast the Mozilla class to the interface, + // nsIWebBrowserChrome. + // This is an ugly D conversion hack because interfaces are implemented differently than + // in the Java SWT version. Watch this code section carefully for errors/bugs. -JJR Mozilla mozilla = cast(Mozilla)browser.webBrowser; mozilla.isChild = true; - int /*long*/ chromePtr = mozilla.webBrowserChrome.getAddress (); - nsIWebBrowserChrome webBrowserChrome = new nsIWebBrowserChrome (chromePtr); - webBrowserChrome.SetChromeFlags (chromeFlags); - webBrowserChrome.AddRef (); - XPCOM.memmove (_retval, new int /*long*/[] {chromePtr}, C.PTR_SIZEOF); + // And since Mozilla class implements the nsIWebBrowserChrome interface.... + nsIWebBrowserChrome chrome; + nsresult rc = mozilla.QueryInterface( &nsIWebBrowserChrome.IID, cast(void**)&chrome); + if (rc !is XPCOM.NS_OK) Mozilla.error (rc); + //nsIWebBrowserChrome webBrowserChrome = new nsIWebBrowserChrome (chromePtr); + chrome.SetChromeFlags (chromeFlags); + //chrome.AddRef (); + //XPCOM.memmove (_retval, new int /*long*/[] {chromePtr}, C.PTR_SIZEOF); + *_retval = chrome; } else { - if (cancel !is 0) { - C.memmove (cancel, new int[] {1}, 4); /* PRBool */ + if (cancel !is null) { + *cancel = 1; /* PRBool */ } } return doit ? XPCOM.NS_OK : XPCOM.NS_ERROR_NOT_IMPLEMENTED;
--- a/dwt/browser/WindowEvent.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/browser/WindowEvent.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,5 +1,5 @@ -/******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. +/******************************************************************************* + * 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 @@ -7,17 +7,19 @@ * * Contributors: * IBM Corporation - initial API and implementation - * * Port to the D programming language: - * Jacob Carlborg <doob@me.com> + * John Reimer <terminal.node@gmail.com> *******************************************************************************/ module dwt.browser.WindowEvent; -import dwt.browser.Browser; +import tango.text.convert.Format; + import dwt.dwthelper.utils; + import dwt.events.TypedEvent; import dwt.graphics.Point; import dwt.widgets.Widget; +import dwt.browser.Browser; /** * A <code>WindowEvent</code> is sent by a {@link Browser} when @@ -66,12 +68,12 @@ * }); * browser.addVisibilityWindowListener(new VisibilityWindowListener() { * public void hide(WindowEvent event) { - * Browser browser = cast(Browser)event.widget; + * Browser browser = (Browser)event.widget; * Shell shell = browser.getShell(); * shell.setVisible(false); * } * public void show(WindowEvent event) { - * Browser browser = cast(Browser)event.widget; + * Browser browser = (Browser)event.widget; * Shell shell = browser.getShell(); * if (event.location !is null) shell.setLocation(event.location); * if (event.size !is null) { @@ -88,7 +90,7 @@ * }); * browser.addCloseWindowListener(new CloseWindowListener() { * public void close(WindowEvent event) { - * Browser browser = cast(Browser)event.widget; + * Browser browser = (Browser)event.widget; * Shell shell = browser.getShell(); * shell.close(); * } @@ -123,7 +125,6 @@ * @see CloseWindowListener * @see OpenWindowListener * @see VisibilityWindowListener - * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> * * @since 3.0 */ @@ -136,7 +137,8 @@ * @since 3.1 */ public bool required; - + + /** * <code>Browser</code> provided by the application. */ @@ -154,7 +156,7 @@ * It is <code>null</code> if no size has been requested. */ public Point size; - + /** * Specifies whether the <code>Shell</code> hosting the <code>Browser</code> should * display an address bar. @@ -170,7 +172,7 @@ * @since 3.1 */ public bool menuBar; - + /** * Specifies whether the <code>Shell</code> hosting the <code>Browser</code> should * display a status bar. @@ -178,7 +180,7 @@ * @since 3.1 */ public bool statusBar; - + /** * Specifies whether the <code>Shell</code> hosting the <code>Browser</code> should * display a tool bar. @@ -186,22 +188,25 @@ * @since 3.1 */ public bool toolBar; - + static final long serialVersionUID = 3617851997387174969L; - - this (Widget w) { - super(w); - } + +this(Widget w) { + super(w); +} - /** - * Returns a String containing a concise, human-readable - * description of the receiver. - * - * @return a String representation of the event - */ - public String toString () { - String str = super.toString(); - return str.substring(0, str.length() - 1) // remove trailing '}' - + " required=" + required + " browser=" + browser + " location=" + location + " size=" + size + " addressBar=" + addressBar + " menuBar=" + menuBar + " statusBar=" + statusBar + " toolBar=" + toolBar + "}"; - } +/** + * Returns a string containing a concise, human-readable + * description of the receiver. + * + * @return a string representation of the event + */ + +public String toString() { + return Format( "{} {required = {}, browser = {}, location = {}, size = {}, addressbar = {}, menubar = {}, statusbar = {}, toolbar = {}}", + super.toString[1 .. $-2], + required, browser, + location, size, addressBar, + menuBar, statusBar, toolBar ); } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/Common.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,105 @@ +module dwt.internal.mozilla.Common; + +version(Windows) { + const NS_WIN32 = 1; +} +version(linux) { + const NS_UNIX = 1; +} + +alias uint nsresult; +alias uint nsrefcnt; + +const nsnull = 0; + +/****************************************************************************** + + prtypes + +******************************************************************************/ + +extern (System): + +alias ubyte PRUint8; +alias byte PRInt8; + +const PR_INT8_MAX = 127; +const PR_UINT8_MAX = 255U; + +alias ushort PRUint16; +alias short PRInt16; + +const PR_INT16_MAX = 32767; +const PR_UINT16_MAX = 65535U; + +alias uint PRUint32; +alias int PRInt32; + +alias long PRInt64; +alias ulong PRUint64; + +alias int PRIntn; +alias uint PRUintn; + +alias double PRFloat64; +alias size_t PRSize; + +alias PRInt32 PROffset32; +alias PRInt64 PROffset64; + +alias ptrdiff_t PRPtrdiff; +alias uint PRUptrdiff; + +alias PRIntn PRBool; + +const PR_TRUE = 1; +const PR_FALSE = 0; + +alias PRUint8 PRPackedBool; + +enum +{ + PR_FAILURE = -1, + PR_SUCCESS, +} + +alias int PRStatus; + +alias wchar PRUnichar; + +alias int PRWord; +alias uint PRUword; + +/****************************************************************************** + + nscommon + +******************************************************************************/ + +alias void* nsIWidget; +alias void* nsILayoutHistoryState; +alias void* nsIDeviceContext; +alias void* nsPresContext; +alias void* nsEvent; +alias void* nsEventStatus; +alias void* nsIPresShell; +alias void* JSContext; + +alias void* PRThread; +alias void* PLEvent; +alias void* PLEventQueue; +alias void* PLHandleEventProc; +alias void* PLDestroyEventProc; + +/****************************************************************************** + + gfxtypes + +******************************************************************************/ + +alias PRUint32 gfx_color; +alias PRUint16 gfx_depth; +alias PRInt32 gfx_format; + +alias void* nsIntRect; +alias void* nsRect; \ No newline at end of file
--- a/dwt/internal/mozilla/XPCOM.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/XPCOM.d Fri Jan 16 12:49:08 2009 +0100 @@ -23,1710 +23,180 @@ * IBM * - Binding to permit interfacing between Mozilla and DWT * - Copyright (C) 2003, 2006 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ + * Port to the D programming language: + * John Reimer <terminal.node@gmail.com> + *******************************************************************************/ + module dwt.internal.mozilla.XPCOM; -import dwt.dwthelper.utils; - -import dwt.internal.C; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsStringAPI; +import dwt.internal.mozilla.nsIModule; +import dwt.internal.mozilla.nsIComponentManager; +import dwt.internal.mozilla.nsIComponentRegistrar; +import dwt.internal.mozilla.nsIServiceManager; +import dwt.internal.mozilla.nsIFile; +import dwt.internal.mozilla.nsILocalFile; +import dwt.internal.mozilla.nsIDirectoryService; +import dwt.internal.mozilla.nsIMemory; +import dwt.internal.mozilla.nsIDebug; +import dwt.internal.mozilla.nsITraceRefcnt; -/** @jniclass flags=cpp */ -public class XPCOM extends C { - public static final String MOZILLA_FIVE_HOME = "MOZILLA_FIVE_HOME"; //$NON-NLS-1$ - public static final String MOZILLA_PLUGIN_PATH = "MOZ_PLUGIN_PATH"; //$NON-NLS-1$ - public static final String CONTENT_MAYBETEXT = "application/x-vnd.mozilla.maybe-text"; //$NON-NLS-1$ - public static final String CONTENT_MULTIPART = "multipart/x-mixed-replace"; //$NON-NLS-1$ - public static final String DOMEVENT_FOCUS = "focus"; //$NON-NLS-1$ - public static final String DOMEVENT_UNLOAD = "unload"; //$NON-NLS-1$ - public static final String DOMEVENT_MOUSEDOWN = "mousedown"; //$NON-NLS-1$ - public static final String DOMEVENT_MOUSEUP = "mouseup"; //$NON-NLS-1$ - public static final String DOMEVENT_MOUSEMOVE = "mousemove"; //$NON-NLS-1$ - public static final String DOMEVENT_MOUSEDRAG = "draggesture"; //$NON-NLS-1$ - public static final String DOMEVENT_MOUSEWHEEL = "DOMMouseScroll"; //$NON-NLS-1$ - public static final String DOMEVENT_MOUSEOVER = "mouseover"; //$NON-NLS-1$ - public static final String DOMEVENT_MOUSEOUT = "mouseout"; //$NON-NLS-1$ - public static final String DOMEVENT_KEYUP = "keyup"; //$NON-NLS-1$ - public static final String DOMEVENT_KEYDOWN = "keydown"; //$NON-NLS-1$ - public static final String DOMEVENT_KEYPRESS = "keypress"; //$NON-NLS-1$ - - /* CID constants */ - public static final nsID NS_APPSHELL_CID = new nsID("2d96b3df-c051-11d1-a827-0040959a28c9"); //$NON-NLS-1$ - public static final nsID NS_CATEGORYMANAGER_CID = new nsID("16d222a6-1dd2-11b2-b693-f38b02c021b2"); //$NON-NLS-1$ - public static final nsID NS_DOWNLOAD_CID = new nsID("e3fa9D0a-1dd1-11b2-bdef-8c720b597445"); //$NON-NLS-1$ - public static final nsID NS_FILEPICKER_CID = new nsID("54ae32f8-1dd2-11b2-a209-df7c505370f8"); //$NON-NLS-1$ - public static final nsID NS_HELPERAPPLAUNCHERDIALOG_CID = new nsID("f68578eb-6ec2-4169-ae19-8c6243f0abe1"); //$NON-NLS-1$ - public static final nsID NS_INPUTSTREAMCHANNEL_CID = new nsID("6ddb050c-0d04-11d4-986e-00c04fa0cf4a"); //$NON-NLS-1$ - public static final nsID NS_IOSERVICE_CID = new nsID("9ac9e770-18bc-11d3-9337-00104ba0fd40"); //$NON-NLS-1$ - public static final nsID NS_LOADGROUP_CID = new nsID("e1c61582-2a84-11d3-8cce-0060b0fc14a3"); //$NON-NLS-1$ - public static final nsID NS_PROMPTSERVICE_CID = new nsID("a2112d6a-0e28-421f-b46a-25c0b308cbd0"); //$NON-NLS-1$ +private import dwt.dwthelper.utils; - public static final String NS_CONTEXTSTACK_CONTRACTID = "@mozilla.org/js/xpc/ContextStack;1"; //$NON-NLS-1$ - public static final String NS_COOKIEMANAGER_CONTRACTID = "@mozilla.org/cookiemanager;1"; //$NON-NLS-1$ - public static final String NS_DIRECTORYSERVICE_CONTRACTID = "@mozilla.org/file/directory_service;1"; //$NON-NLS-1$ - public static final String NS_DOMSERIALIZER_CONTRACTID = "@mozilla.org/xmlextras/xmlserializer;1"; //$NON-NLS-1$ - public static final String NS_DOWNLOAD_CONTRACTID = "@mozilla.org/download;1"; //$NON-NLS-1$ - public static final String NS_FILEPICKER_CONTRACTID = "@mozilla.org/filepicker;1"; //$NON-NLS-1$ - public static final String NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID = "@mozilla.org/helperapplauncherdialog;1"; //$NON-NLS-1$ - public static final String NS_MEMORY_CONTRACTID = "@mozilla.org/xpcom/memory-service;1"; //$NON-NLS-1$ - public static final String NS_OBSERVER_CONTRACTID = "@mozilla.org/observer-service;1"; //$NON-NLS-1$ - public static final String NS_PREFLOCALIZEDSTRING_CONTRACTID = "@mozilla.org/pref-localizedstring;1"; //$NON-NLS-1$ - public static final String NS_PREFSERVICE_CONTRACTID = "@mozilla.org/preferences-service;1"; //$NON-NLS-1$ - public static final String NS_PROMPTSERVICE_CONTRACTID = "@mozilla.org/embedcomp/prompt-service;1"; //$NON-NLS-1$ - public static final String NS_TRANSFER_CONTRACTID = "@mozilla.org/transfer;1"; //$NON-NLS-1$ - public static final String NS_WEBNAVIGATIONINFO_CONTRACTID = "@mozilla.org/webnavigation-info;1"; //$NON-NLS-1$ - public static final String NS_WINDOWWATCHER_CONTRACTID = "@mozilla.org/embedcomp/window-watcher;1"; //$NON-NLS-1$ +/****************************************************************************** + + Original SWT XPCOM constant declarations for XPCOM - /* directory service constants */ - public static final String NS_APP_APPLICATION_REGISTRY_DIR = "AppRegD"; //$NON-NLS-1$ - public static final String NS_APP_CACHE_PARENT_DIR = "cachePDir"; //$NON-NLS-1$ - public static final String NS_APP_HISTORY_50_FILE = "UHist"; //$NON-NLS-1$ - public static final String NS_APP_LOCALSTORE_50_FILE = "LclSt"; //$NON-NLS-1$ - public static final String NS_APP_PLUGINS_DIR_LIST = "APluginsDL"; //$NON-NLS-1$ - public static final String NS_APP_PREF_DEFAULTS_50_DIR = "PrfDef"; //$NON-NLS-1$ - public static final String NS_APP_PREFS_50_DIR = "PrefD"; //$NON-NLS-1$ - public static final String NS_APP_PREFS_50_FILE = "PrefF"; //$NON-NLS-1$ - public static final String NS_APP_USER_CHROME_DIR = "UChrm"; //$NON-NLS-1$ - public static final String NS_APP_USER_MIMETYPES_50_FILE = "UMimTyp"; //$NON-NLS-1$ - public static final String NS_APP_USER_PROFILE_50_DIR = "ProfD"; //$NON-NLS-1$ - public static final String NS_GRE_COMPONENT_DIR = "GreComsD"; //$NON-NLS-1$ - public static final String NS_GRE_DIR = "GreD"; //$NON-NLS-1$ - public static final String NS_OS_CURRENT_PROCESS_DIR = "CurProcD"; //$NON-NLS-1$ - public static final String NS_OS_HOME_DIR = "Home"; //$NON-NLS-1$ - public static final String NS_OS_TEMP_DIR = "TmpD"; //$NON-NLS-1$ - public static final String NS_XPCOM_COMPONENT_DIR = "ComsD"; //$NON-NLS-1$ - public static final String NS_XPCOM_CURRENT_PROCESS_DIR = "XCurProcD"; //$NON-NLS-1$ - public static final String NS_XPCOM_INIT_CURRENT_PROCESS_DIR = "MozBinD"; //$NON-NLS-1$ +******************************************************************************/ + +const String MOZILLA_FIVE_HOME = "MOZILLA_FIVE_HOME"; //$NON-NLS-1$ +const String MOZILLA_PLUGIN_PATH = "MOZ_PLUGIN_PATH"; //$NON-NLS-1$ +const String CONTENT_MAYBETEXT = "application/x-vnd.mozilla.maybe-text"; //$NON-NLS-1$ +const String CONTENT_MULTIPART = "multipart/x-mixed-replace"; //$NON-NLS-1$ +const String DOMEVENT_FOCUS = "focus"; //$NON-NLS-1$ +const String DOMEVENT_UNLOAD = "unload"; //$NON-NLS-1$ +const String DOMEVENT_MOUSEDOWN = "mousedown"; //$NON-NLS-1$ +const String DOMEVENT_MOUSEUP = "mouseup"; //$NON-NLS-1$ +const String DOMEVENT_MOUSEMOVE = "mousemove"; //$NON-NLS-1$ +const String DOMEVENT_MOUSEDRAG = "draggesture"; //$NON-NLS-1$ +const String DOMEVENT_MOUSEWHEEL = "DOMMouseScroll"; //$NON-NLS-1$ +const String DOMEVENT_MOUSEOVER = "mouseover"; //$NON-NLS-1$ +const String DOMEVENT_MOUSEOUT = "mouseout"; //$NON-NLS-1$ +const String DOMEVENT_KEYUP = "keyup"; //$NON-NLS-1$ +const String DOMEVENT_KEYDOWN = "keydown"; //$NON-NLS-1$ +const String DOMEVENT_KEYPRESS = "keypress"; //$NON-NLS-1$ - /* XPCOM constants */ - public static final int NS_OK = 0; - public static final int NS_COMFALSE = 1; - public static final int NS_BINDING_ABORTED = 0x804B0002; - public static final int NS_ERROR_BASE = 0xc1f30000; - public static final int NS_ERROR_NOT_INITIALIZED = NS_ERROR_BASE + 1; - public static final int NS_ERROR_ALREADY_INITIALIZED = NS_ERROR_BASE + 2; - public static final int NS_ERROR_NOT_IMPLEMENTED = 0x80004001; - public static final int NS_NOINTERFACE = 0x80004002; - public static final int NS_ERROR_NO_INTERFACE = NS_NOINTERFACE; - public static final int NS_ERROR_INVALID_POINTER = 0x80004003; - public static final int NS_ERROR_NULL_POINTER = NS_ERROR_INVALID_POINTER; - public static final int NS_ERROR_ABORT = 0x80004004; - public static final int NS_ERROR_FAILURE = 0x80004005; - public static final int NS_ERROR_UNEXPECTED = 0x8000ffff; - public static final int NS_ERROR_OUT_OF_MEMORY = 0x8007000e; - public static final int NS_ERROR_ILLEGAL_VALUE = 0x80070057; - public static final int NS_ERROR_INVALID_ARG = NS_ERROR_ILLEGAL_VALUE; - public static final int NS_ERROR_NO_AGGREGATION = 0x80040110; - public static final int NS_ERROR_NOT_AVAILABLE = 0x80040111; - public static final int NS_ERROR_FACTORY_NOT_REGISTERED = 0x80040154; - public static final int NS_ERROR_FACTORY_REGISTER_AGAIN = 0x80040155; - public static final int NS_ERROR_FACTORY_NOT_LOADED = 0x800401f8; - public static final int NS_ERROR_FACTORY_NO_SIGNATURE_SUPPORT = NS_ERROR_BASE + 0x101; - public static final int NS_ERROR_FACTORY_EXISTS = NS_ERROR_BASE + 0x100; - public static final int NS_ERROR_HTMLPARSER_UNRESOLVEDDTD = 0x804e03f3; - public static final int NS_ERROR_FILE_NOT_FOUND = 0x80520012; - public static final int NS_ERROR_FILE_UNRECOGNIZED_PATH = 0x80520001; - -/** - * @param dest cast=(void *) - * @param src cast=(const void *) - * @param nbytes cast=(size_t) - */ -public static final native void memmove(nsID dest, int /*long*/ src, int nbytes); -/** - * @param dest cast=(void *) - * @param src cast=(const void *) - * @param nbytes cast=(size_t) - */ -public static final native void memmove(int /*long*/ dest, nsID src, int nbytes); -/** @method flags=no_gen */ -public static final native int strlen_PRUnichar(int /*long*/ s); +/* CID constants */ +const nsID NS_APPSHELL_CID = { 0x2d96b3df, 0xc051, 0x11d1, [0xa8,0x27,0x00,0x40,0x95,0x9a,0x28, 0xc9]}; //$NON-NLS-1$ +const nsID NS_CATEGORYMANAGER_CID = { 0x16d222a6, 0x1dd2, 0x11b2, [0xb6,0x93,0xf3,0x8b,0x02,0xc0,0x21,0xb2]}; //$NON-NLS-1$ +const nsID NS_DOWNLOAD_CID = { 0xe3fa9D0a, 0x1dd1, 0x11b2, [0xbd,0xef,0x8c,0x72,0x0b,0x59,0x74,0x45]}; //$NON-NLS-1$ +const nsID NS_FILEPICKER_CID = { 0x54ae32f8, 0x1dd2, 0x11b2, [0xa2,0x09,0xdf,0x7c,0x50,0x53,0x70,0xf8]}; //$NON-NLS-1$ +const nsID NS_HELPERAPPLAUNCHERDIALOG_CID = {0xf68578eb,0x6ec2,0x4169,[0xae,0x19,0x8c,0x62,0x43,0xf0,0xab,0xe1]}; //$NON-NLS-1$ +const nsID NS_INPUTSTREAMCHANNEL_CID = {0x6ddb050c,0x0d04,0x11d4,[0x98,0x6e,0x00,0xc0,0x4f,0xa0,0xcf,0x4a]}; //$NON-NLS-1$ +const nsID NS_IOSERVICE_CID = {0x9ac9e770,0x18bc,0x11d3,[0x93,0x37,0x00,0x10,0x4b,0xa0,0xfd,0x40]}; //$NON-NLS-1$ +const nsID NS_LOADGROUP_CID = {0xe1c61582,0x2a84,0x11d3,[0x8c,0xce,0x00,0x60,0xb0,0xfc,0x14,0xa3]}; //$NON-NLS-1$ +const nsID NS_PROMPTSERVICE_CID = {0xa2112d6a,0x0e28,0x421f,[0xb4,0x6a,0x25,0xc0,0xb3,0x08,0xcb,0xd0]}; //$NON-NLS-1$ -/** @param result cast=(nsIComponentManager**) */ -public static final native int _NS_GetComponentManager(int /*long*/[] result); -public static final int NS_GetComponentManager(int /*long*/[] result) { - lock.lock(); - try { - return _NS_GetComponentManager(result); - } finally { - lock.unlock(); - } -} -/** @param result cast=(nsIServiceManager**) */ -public static final native int _NS_GetServiceManager(int /*long*/[] result); -public static final int NS_GetServiceManager(int /*long*/[] result) { - lock.lock(); - try { - return _NS_GetServiceManager(result); - } finally { - lock.unlock(); - } -} -/** - * @param result cast=(nsIServiceManager **) - * @param binDirectory cast=(nsIFile *) - * @param appFileLocationProvider cast=(nsIDirectoryServiceProvider *) - */ -public static final native int _NS_InitXPCOM2(int /*long*/ result, int /*long*/ binDirectory, int /*long*/ appFileLocationProvider); -public static final int NS_InitXPCOM2(int /*long*/ result, int /*long*/ binDirectory, int /*long*/ appFileLocationProvider) { - lock.lock(); - try { - return _NS_InitXPCOM2(result, binDirectory, appFileLocationProvider); - } finally { - lock.unlock(); - } -} -/** - * @param path cast=(nsAString *),flags=struct - * @param result cast=(nsILocalFile**) - */ -public static final native int _NS_NewLocalFile(int /*long*/ path, int followLinks, int /*long*/[] result); -public static final int NS_NewLocalFile(int /*long*/ path, int followLinks, int /*long*/[] result) { - lock.lock(); - try { - return _NS_NewLocalFile(path, followLinks, result); - } finally { - lock.unlock(); - } -} -/** @method flags=new */ -public static final native int /*long*/ _nsEmbedCString_new(); -public static final int /*long*/ nsEmbedCString_new() { - lock.lock(); - try { - return _nsEmbedCString_new(); - } finally { - lock.unlock(); - } -} -/** - * @method flags=new - * @param aString cast=(const char *) - */ -public static final native int /*long*/ _nsEmbedCString_new(byte[] aString, int length); -public static final int /*long*/ nsEmbedCString_new(byte[] aString, int length) { - lock.lock(); - try { - return _nsEmbedCString_new(aString, length); - } finally { - lock.unlock(); - } -} -/** - * @method flags=new - * @param aString cast=(const char *) - */ -public static final native int /*long*/ _nsEmbedCString_new(int /*long*/ aString, int length); -public static final int /*long*/ nsEmbedCString_new(int /*long*/ aString, int length) { - lock.lock(); - try { - return _nsEmbedCString_new(aString, length); - } finally { - lock.unlock(); - } -} -/** - * @method flags=delete - * @param ptr cast=(nsEmbedCString *) - */ -public static final native void _nsEmbedCString_delete(int /*long*/ ptr); -public static final void nsEmbedCString_delete(int /*long*/ ptr) { - lock.lock(); - try { - _nsEmbedCString_delete(ptr); - } finally { - lock.unlock(); - } -} -/** - * @method flags=cpp - * @param ptr cast=(nsEmbedCString *) - */ -public static final native int _nsEmbedCString_Length(int /*long*/ ptr); -public static final int nsEmbedCString_Length(int /*long*/ ptr) { - lock.lock(); - try { - return _nsEmbedCString_Length(ptr); - } finally { - lock.unlock(); - } -} -/** - * @method flags=cpp - * @param ptr cast=(nsEmbedCString *) - */ -public static final native int /*long*/ _nsEmbedCString_get(int /*long*/ ptr); -public static final int /*long*/ nsEmbedCString_get(int /*long*/ ptr) { - lock.lock(); - try { - return _nsEmbedCString_get(ptr); - } finally { - lock.unlock(); - } -} -/** - * @method flags=delete - * @param ptr cast=(nsID *) - */ -public static final native void _nsID_delete(int /*long*/ ptr); -public static final void nsID_delete(int /*long*/ ptr) { - lock.lock(); - try { - _nsID_delete(ptr); - } finally { - lock.unlock(); - } -} -/** @method flags=new */ -public static final native int /*long*/ _nsID_new(); -public static final int /*long*/ nsID_new() { - lock.lock(); - try { - return _nsID_new(); - } finally { - lock.unlock(); - } -} -/** - * @method flags=cpp - * @param ptr cast=(nsID *) - * @param other cast=(nsID *),flags=struct - */ -public static final native int _nsID_Equals(int /*long*/ ptr, int /*long*/ other); -public static final int nsID_Equals(int /*long*/ ptr, int /*long*/ other) { - lock.lock(); - try { - return _nsID_Equals(ptr, other); - } finally { - lock.unlock(); - } -} -/** @method flags=new */ -public static final native int /*long*/ _nsEmbedString_new(); -public static final int /*long*/ nsEmbedString_new() { - lock.lock(); - try { - return _nsEmbedString_new(); - } finally { - lock.unlock(); - } -} -/** - * @method flags=new - * @param aString cast=(PRUnichar *) - */ -public static final native int /*long*/ _nsEmbedString_new(char[] aString); -public static final int /*long*/ nsEmbedString_new(char[] aString) { - lock.lock(); - try { - return _nsEmbedString_new(aString); - } finally { - lock.unlock(); - } -} -/** - * @method flags=delete - * @param ptr cast=(nsEmbedString *) - */ -public static final native void _nsEmbedString_delete(int /*long*/ ptr); -public static final void nsEmbedString_delete(int /*long*/ ptr) { - lock.lock(); - try { - _nsEmbedString_delete(ptr); - } finally { - lock.unlock(); - } -} -/** - * @method flags=cpp - * @param ptr cast=(nsEmbedString *) - */ -public static final native int _nsEmbedString_Length(int /*long*/ ptr); -public static final int nsEmbedString_Length(int /*long*/ ptr) { - lock.lock(); - try { - return _nsEmbedString_Length(ptr); - } finally { - lock.unlock(); - } -} -/** - * @method flags=cpp - * @param ptr cast=(nsEmbedString *) - */ -public static final native int /*long*/ _nsEmbedString_get(int /*long*/ ptr); -public static final int /*long*/ nsEmbedString_get(int /*long*/ ptr) { - lock.lock(); - try { - return _nsEmbedString_get(ptr); - } finally { - lock.unlock(); - } -} -/** @param place cast=(const char *) */ -public static final native int _XPCOMGlueStartup(byte[] place); -public static final int XPCOMGlueStartup(byte[] place) { - lock.lock(); - try { - return _XPCOMGlueStartup(place); - } finally { - lock.unlock(); - } -} -public static final native int _XPCOMGlueShutdown(); -public static final int XPCOMGlueShutdown() { - lock.lock(); - try { - return _XPCOMGlueShutdown(); - } finally { - lock.unlock(); - } -} - -/** - * @param ptr cast=(nsWriteSegmentFun) - * @param aInStream cast=(nsIInputStream *) - * @param aClosure cast=(void *) - * @param aFromSegment cast=(const char *) - * @param aWriteCount cast=(PRUint32 *) - */ -public static final native int /*long*/ _Call(int /*long*/ ptr, int /*long*/ aInStream, int /*long*/ aClosure, byte[] aFromSegment, int aToOffset, int aCount, int[] aWriteCount); -public static final int /*long*/ Call(int /*long*/ ptr, int /*long*/ aInStream, int /*long*/ aClosure, byte[] aFromSegment, int aToOffset, int aCount, int[] aWriteCount) { - lock.lock(); - try { - return _Call(ptr, aInStream, aClosure, aFromSegment, aToOffset, aCount, aWriteCount); - } finally { - lock.unlock(); - } -} - -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl); - } finally { - lock.unlock(); - } -} +const String NS_CONTEXTSTACK_CONTRACTID = "@mozilla.org/js/xpc/ContextStack;1"; //$NON-NLS-1$ +const String NS_COOKIEMANAGER_CONTRACTID = "@mozilla.org/cookiemanager;1"; //$NON-NLS-1$ +const String NS_DIRECTORYSERVICE_CONTRACTID = "@mozilla.org/file/directory_service;1"; //$NON-NLS-1$ +const String NS_DOMSERIALIZER_CONTRACTID = "@mozilla.org/xmlextras/xmlserializer;1"; //$NON-NLS-1$ +const String NS_DOWNLOAD_CONTRACTID = "@mozilla.org/download;1"; //$NON-NLS-1$ +const String NS_FILEPICKER_CONTRACTID = "@mozilla.org/filepicker;1"; //$NON-NLS-1$ +const String NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID = "@mozilla.org/helperapplauncherdialog;1"; //$NON-NLS-1$ +const String NS_MEMORY_CONTRACTID = "@mozilla.org/xpcom/memory-service;1"; //$NON-NLS-1$ +const String NS_OBSERVER_CONTRACTID = "@mozilla.org/observer-service;1"; //$NON-NLS-1$ +const String NS_PREFLOCALIZEDSTRING_CONTRACTID = "@mozilla.org/pref-localizedstring;1"; //$NON-NLS-1$ +const String NS_PREFSERVICE_CONTRACTID = "@mozilla.org/preferences-service;1"; //$NON-NLS-1$ +const String NS_PROMPTSERVICE_CONTRACTID = "@mozilla.org/embedcomp/prompt-service;1"; //$NON-NLS-1$ +const String NS_TRANSFER_CONTRACTID = "@mozilla.org/transfer;1"; //$NON-NLS-1$ +const String NS_WEBNAVIGATIONINFO_CONTRACTID = "@mozilla.org/webnavigation-info;1"; //$NON-NLS-1$ +const String NS_WINDOWWATCHER_CONTRACTID = "@mozilla.org/embedcomp/window-watcher;1"; //$NON-NLS-1$ -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, char[] arg0); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, char[] arg0) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, float arg0); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, float arg0) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, float[] arg0); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, float[] arg0) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int[] arg0); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int[] arg0) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long[] arg0); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long[] arg0) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, short[] arg0); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, short[] arg0) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0); - } finally { - lock.unlock(); - } -} +/* directory service constants */ +const String NS_APP_APPLICATION_REGISTRY_DIR = "AppRegD"; //$NON-NLS-1$ +const String NS_APP_CACHE_PARENT_DIR = "cachePDir"; //$NON-NLS-1$ +const String NS_APP_HISTORY_50_FILE = "UHist"; //$NON-NLS-1$ +const String NS_APP_LOCALSTORE_50_FILE = "LclSt"; //$NON-NLS-1$ +const String NS_APP_PLUGINS_DIR_LIST = "APluginsDL"; //$NON-NLS-1$ +const String NS_APP_PREF_DEFAULTS_50_DIR = "PrfDef"; //$NON-NLS-1$ +const String NS_APP_PREFS_50_DIR = "PrefD"; //$NON-NLS-1$ +const String NS_APP_PREFS_50_FILE = "PrefF"; //$NON-NLS-1$ +const String NS_APP_USER_CHROME_DIR = "UChrm"; //$NON-NLS-1$ +const String NS_APP_USER_MIMETYPES_50_FILE = "UMimTyp"; //$NON-NLS-1$ +const String NS_APP_USER_PROFILE_50_DIR = "ProfD"; //$NON-NLS-1$ +const String NS_GRE_COMPONENT_DIR = "GreComsD"; //$NON-NLS-1$ +const String NS_GRE_DIR = "GreD"; //$NON-NLS-1$ +const String NS_OS_CURRENT_PROCESS_DIR = "CurProcD"; //$NON-NLS-1$ +const String NS_OS_HOME_DIR = "Home"; //$NON-NLS-1$ +const String NS_OS_TEMP_DIR = "TmpD"; //$NON-NLS-1$ +const String NS_XPCOM_COMPONENT_DIR = "ComsD"; //$NON-NLS-1$ +const String NS_XPCOM_CURRENT_PROCESS_DIR = "XCurProcD"; //$NON-NLS-1$ +const String NS_XPCOM_INIT_CURRENT_PROCESS_DIR = "MozBinD"; //$NON-NLS-1$ -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, int arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, int arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int[] arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int[] arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long [] arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long [] arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, int[] arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, int[] arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int[] arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int[] arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, long[] arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, long[] arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, long arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, long arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, nsID arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, nsID arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, nsID arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, nsID arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, char[] arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, char[] arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int[] arg0, int[] arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int[] arg0, int[] arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int[] arg0, long[] arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int[] arg0, long[] arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, int arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, int arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, long arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, long arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, int[] arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, int[] arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, long[] arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, long[] arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, char[] arg0, char[] arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, char[] arg0, char[] arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, byte[] arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, byte[] arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, byte[] arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, byte[] arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, byte[] arg1); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, byte[] arg1) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1); - } finally { - lock.unlock(); - } +/* XPCOM constants */ +const int NS_OK = 0; +const int NS_COMFALSE = 1; +const int NS_BINDING_ABORTED = 0x804B0002; +const int NS_ERROR_BASE = 0xc1f30000; +const int NS_ERROR_NOT_INITIALIZED = NS_ERROR_BASE + 1; +const int NS_ERROR_ALREADY_INITIALIZED = NS_ERROR_BASE + 2; +const int NS_ERROR_NOT_IMPLEMENTED = 0x80004001; +const int NS_NOINTERFACE = 0x80004002; +const int NS_ERROR_NO_INTERFACE = NS_NOINTERFACE; +const int NS_ERROR_INVALID_POINTER = 0x80004003; +const int NS_ERROR_NULL_POINTER = NS_ERROR_INVALID_POINTER; +const int NS_ERROR_ABORT = 0x80004004; +const int NS_ERROR_FAILURE = 0x80004005; +const int NS_ERROR_UNEXPECTED = 0x8000ffff; +const int NS_ERROR_OUT_OF_MEMORY = 0x8007000e; +const int NS_ERROR_ILLEGAL_VALUE = 0x80070057; +const int NS_ERROR_INVALID_ARG = NS_ERROR_ILLEGAL_VALUE; +const int NS_ERROR_NO_AGGREGATION = 0x80040110; +const int NS_ERROR_NOT_AVAILABLE = 0x80040111; +const int NS_ERROR_FACTORY_NOT_REGISTERED = 0x80040154; +const int NS_ERROR_FACTORY_REGISTER_AGAIN = 0x80040155; +const int NS_ERROR_FACTORY_NOT_LOADED = 0x800401f8; +const int NS_ERROR_FACTORY_NO_SIGNATURE_SUPPORT = NS_ERROR_BASE + 0x101; +const int NS_ERROR_FACTORY_EXISTS = NS_ERROR_BASE + 0x100; +const int NS_ERROR_HTMLPARSER_UNRESOLVEDDTD = 0x804e03f3; +const int NS_ERROR_FILE_NOT_FOUND = 0x80520012; +const int NS_ERROR_FILE_UNRECOGNIZED_PATH = 0x80520001; + +public nsresult NS_FAILED( nsresult result ) { + return result & 0x80000000; } -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, char[] arg1, int arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, char[] arg1, int arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, char[] arg1, int arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, char[] arg1, int arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int[] arg0, int[] arg1, int[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int[] arg0, int[] arg1, int[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long [] arg0, long [] arg1, long [] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long [] arg0, long [] arg1, long [] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int[] arg0, long[] arg1, int[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int[] arg0, long[] arg1, int[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int[] arg0, long[] arg1, long [] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int[] arg0, long[] arg1, long [] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int arg1, int[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int arg1, int[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, nsID arg1, long [] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, nsID arg1, long [] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, nsID arg1, int[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, nsID arg1, int[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, char[] arg0, int arg1, int[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, char[] arg0, int arg1, int[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } +public nsresult NS_SUCCEEDED( nsresult result ) { + return !(result & 0x80000000); } -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, char[] arg0, long arg1, long [] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, char[] arg0, long arg1, long [] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, char[] arg1, char[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, char[] arg1, char[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, char[] arg1, char[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, char[] arg1, char[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, int arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, int arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, long arg1, long arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, long arg1, long arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, long[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, long[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, int arg1, long [] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, int arg1, long [] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } + +public PRUint32 strlen_PRUnichar ( PRUnichar* str ) +{ + PRUint32 len = 0; + if (str !is null) + while (*(str++) != 0) len++; + return len; } -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, int[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, int[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, nsID arg1, int[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, nsID arg1, int[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, nsID arg1, long [] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, nsID arg1, long [] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, char[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, char[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, nsID arg1, long[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, nsID arg1, long[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, nsID arg1, int[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, nsID arg1, int[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, byte[] arg1, int[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, byte[] arg1, int[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, byte[] arg1, long[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, byte[] arg1, long[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int[] arg1, int[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int[] arg1, int[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int[] arg1, long[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int[] arg1, long[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, long[] arg1, int[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, long[] arg1, int[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, nsID arg1, int arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, nsID arg1, int arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, nsID arg1, long arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, nsID arg1, long arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, byte[] arg1, char[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, byte[] arg1, char[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, byte[] arg1, char[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, byte[] arg1, char[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, byte[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, byte[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, byte[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, byte[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, byte[] arg1, int arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, byte[] arg1, int arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, byte[] arg1, int[] arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, byte[] arg1, int[] arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, byte[] arg1, int arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, byte[] arg1, int arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, byte[] arg1, int arg2); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, byte[] arg1, int arg2) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2); - } finally { - lock.unlock(); - } + +/****************************************************************************** + + XPCOM Startup functions + +******************************************************************************/ + +extern (System): + +struct nsStaticModuleInfo +{ + char *name; + nsGetModuleProc getModule; } -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int arg1, nsID arg2, int[] arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int arg1, nsID arg2, int[] arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, long arg1, nsID arg2, long[] arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, long arg1, nsID arg2, long[] arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, byte[] arg1, int arg2, int[] arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, byte[] arg1, int arg2, int[] arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, byte[] arg1, long arg2, long[] arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, byte[] arg1, long arg2, long[] arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, char[] arg1, char[] arg2, int[] arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, char[] arg1, char[] arg2, int[] arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, char[] arg1, char[] arg2, long [] arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, char[] arg1, char[] arg2, long [] arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, char[] arg1, char[] arg2, int[] arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, char[] arg1, char[] arg2, int[] arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, char[] arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, char[] arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, int arg2, char[] arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, int arg2, char[] arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, int arg2, int arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, int arg2, int arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long arg2, int arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long arg2, int arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int[] arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int[] arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, int arg2, int[] arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, int arg2, int[] arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int[] arg0, int[] arg1, int[] arg2, int[] arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int[] arg0, int[] arg1, int[] arg2, int[] arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, byte[] arg1, byte[] arg2, int arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, byte[] arg1, byte[] arg2, int arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, byte[] arg1, byte[] arg2, long arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, byte[] arg1, byte[] arg2, long arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, int arg1, nsID arg2, int[] arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, int arg1, nsID arg2, int[] arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, long arg1, nsID arg2, long [] arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, long arg1, nsID arg2, long [] arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int arg1, int[] arg2, int[] arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int arg1, int[] arg2, int[] arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int arg1, long [] arg2, int[] arg3); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int arg1, long [] arg2, int[] arg3) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3); - } finally { - lock.unlock(); - } -} +alias nsresult function (nsIComponentManager, nsIFile, nsIModule*) nsGetModuleProc; + +/****************************************************************************** + +******************************************************************************/ -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, char[] arg0, int arg1, int arg2, int arg3, int arg4); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, char[] arg0, int arg1, int arg2, int arg3, int arg4) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, char[] arg0, int arg1, long arg2, long arg3, long arg4); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, char[] arg0, int arg1, long arg2, long arg3, long arg4) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long arg2, long arg3, long arg4); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long arg2, long arg3, long arg4) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3, int arg4); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3, int arg4) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int[] arg1, int[] arg2, int[] arg3, int[] arg4); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int[] arg1, int[] arg2, int[] arg3, int[] arg4) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, char[] arg1, char[] arg2, char[] arg3, int[] arg4); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, char[] arg1, char[] arg2, char[] arg3, int[] arg4) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, char[] arg1, char[] arg2, char[] arg3, int[] arg4); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, char[] arg1, char[] arg2, char[] arg3, int[] arg4) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int arg1, int arg2, int[] arg3, int[] arg4); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int arg1, int arg2, int[] arg3, int[] arg4) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int arg1, long arg2, long [] arg3, int[] arg4); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, int arg1, long arg2, long [] arg3, int[] arg4) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4); - } finally { - lock.unlock(); - } -} +nsresult NS_InitXPCOM2( nsIServiceManager *result, nsIFile binDirectory, + nsIDirectoryServiceProvider appFileLocationProvider ); +nsresult NS_InitXPCOM3( nsIServiceManager *result, nsIFile binDirectory, + nsIDirectoryServiceProvider appFileLocationProvider, + nsStaticModuleInfo* staticComponents, + PRUint32 componentCount ); -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, byte[] arg1, byte[] arg2, byte[] arg3, int arg4, int[] arg5); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, byte[] arg1, byte[] arg2, byte[] arg3, int arg4, int[] arg5) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, byte[] arg1, byte[] arg2, byte[] arg3, long arg4, long[] arg5); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, byte[] arg1, byte[] arg2, byte[] arg3, long arg4, long[] arg5) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, char[] arg2, int arg3, long arg4, int arg5); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, char[] arg2, int arg3, long arg4, int arg5) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, char[] arg2, int arg3, long arg4, int arg5); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, char[] arg2, int arg3, long arg4, int arg5) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, char[] arg2, long arg3, long arg4, long arg5); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, char[] arg2, long arg3, long arg4, long arg5) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, char[] arg2, long arg3, long arg4, long arg5); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, char[] arg2, long arg3, long arg4, long arg5) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, int arg2, int arg3, int arg4, int arg5); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, int arg2, int arg3, int arg4, int arg5) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, byte[] arg1, byte[] arg2, int arg3, byte[] arg4, byte[] arg5); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, byte[] arg1, byte[] arg2, int arg3, byte[] arg4, byte[] arg5) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, byte[] arg1, byte[] arg2, long arg3, byte[] arg4, byte[] arg5); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, nsID arg0, byte[] arg1, byte[] arg2, long arg3, byte[] arg4, byte[] arg5) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, long arg2, long arg3, long arg4, long arg5); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, long arg2, long arg3, long arg4, long arg5) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long arg2, long arg3, long arg4, long arg5); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long arg2, long arg3, long arg4, long arg5) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, char[] arg1, char[] arg2, char[] arg3, int[] arg4, int[] arg5); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, char[] arg1, char[] arg2, char[] arg3, int[] arg4, int[] arg5) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, char[] arg1, char[] arg2, char[] arg3, int[] arg4, int[] arg5); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, char[] arg1, char[] arg2, char[] arg3, int[] arg4, int[] arg5) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, byte[] arg1, byte[] arg2, int arg3, int arg4, int[] arg5); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, byte[] arg1, byte[] arg2, int arg3, int arg4, int[] arg5) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, byte[] arg1, byte[] arg2, int arg3, int arg4, long[] arg5); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, byte[] arg0, byte[] arg1, byte[] arg2, int arg3, int arg4, long[] arg5) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3, int[] arg4, int[] arg5); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3, int[] arg4, int[] arg5) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, int arg1, int arg2, long arg3, int[] arg4, long [] arg5); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, int arg1, int arg2, long arg3, int[] arg4, long [] arg5) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, char[] arg2, char[] arg3, int arg4, int [] arg5); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, char[] arg2, char[] arg3, int arg4, int [] arg5) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, char[] arg2, char[] arg3, int arg4, long[] arg5); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, char[] arg2, char[] arg3, int arg4, long[] arg5) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5); - } finally { - lock.unlock(); - } -} - -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, char[] arg1, char[] arg2, int arg3, int[] arg4, int[] arg5, int[] arg6); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, char[] arg1, char[] arg2, int arg3, int[] arg4, int[] arg5, int[] arg6) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6); - } finally { - lock.unlock(); - } -} - -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, char[] arg1, char[] arg2, int arg3, long[] arg4, int[] arg5, int[] arg6); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, char[] arg1, char[] arg2, int arg3, long[] arg4, int[] arg5, int[] arg6) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6); - } finally { - lock.unlock(); - } -} - -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, char[] arg1, char[] arg2, int[] arg3, char[] arg4, int[] arg5, int[] arg6); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, char[] arg1, char[] arg2, int[] arg3, char[] arg4, int[] arg5, int[] arg6) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6); - } finally { - lock.unlock(); - } -} - -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, char[] arg1, char[] arg2, long[] arg3, char[] arg4, int[] arg5, int[] arg6); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, char[] arg1, char[] arg2, long[] arg3, char[] arg4, int[] arg5, int[] arg6) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6); - } finally { - lock.unlock(); - } -} - -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3, char[] arg4, int[] arg5, int[] arg6); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3, char[] arg4, int[] arg5, int[] arg6) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6); - } finally { - lock.unlock(); - } -} - -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, int arg2, long arg3, char[] arg4, int[] arg5, int[] arg6); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, int arg2, long arg3, char[] arg4, int[] arg5, int[] arg6) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6); - } finally { - lock.unlock(); - } -} - -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3, long arg4, int arg5, int arg6); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3, long arg4, int arg5, int arg6) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6); - } finally { - lock.unlock(); - } -} - -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long arg2, long arg3, long arg4, long arg5, long arg6); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long arg2, long arg3, long arg4, long arg5, long arg6) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6); - } finally { - lock.unlock(); - } -} - -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, char[] arg1, char[] arg2, int[] arg3, int[] arg4, char[] arg5, int[] arg6, int[] arg7); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, char[] arg1, char[] arg2, int[] arg3, int[] arg4, char[] arg5, int[] arg6, int[] arg7) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, char[] arg1, char[] arg2, long[] arg3, long [] arg4, char[] arg5, int[] arg6, int[] arg7); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, char[] arg1, char[] arg2, long[] arg3, long [] arg4, char[] arg5, int[] arg6, int[] arg7) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, char[] arg6, int[] arg7, int[] arg8); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, char[] arg6, int[] arg7, int[] arg8) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long arg2, long arg3, int arg4, long arg5, char[] arg6, int[] arg7, long [] arg8); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long arg2, long arg3, int arg4, long arg5, char[] arg6, int[] arg7, long [] arg8) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, int arg1, int arg2, long arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, int arg1, int arg2, long arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, char[] arg1, char[] arg2, int arg3, char[] arg4, char[] arg5, char[] arg6, char[] arg7, int[] arg8, int[] arg9); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, char[] arg1, char[] arg2, int arg3, char[] arg4, char[] arg5, char[] arg6, char[] arg7, int[] arg8, int[] arg9) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, char[] arg1, char[] arg2, int arg3, char[] arg4, char[] arg5, char[] arg6, char[] arg7, int[] arg8, int[] arg9); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, char[] arg1, char[] arg2, int arg3, char[] arg4, char[] arg5, char[] arg6, char[] arg7, int[] arg8, int[] arg9) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3, char[] arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int[] arg10, int[] arg11); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3, char[] arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int[] arg10, int[] arg11) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long arg2, int arg3, char[] arg4, long arg5, long arg6, int arg7, long arg8, int arg9, long [] arg10, long [] arg11); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long arg2, int arg3, char[] arg4, long arg5, long arg6, int arg7, long arg8, int arg9, long [] arg10, long [] arg11) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3, char[] arg4, byte[] arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int[] arg11, int[] arg12); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3, char[] arg4, byte[] arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int[] arg11, int[] arg12) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long arg2, int arg3, char[] arg4, byte[] arg5, long arg6, long arg7, int arg8, long arg9, int arg10, long [] arg11, long [] arg12); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, long arg1, long arg2, int arg3, char[] arg4, byte[] arg5, long arg6, long arg7, int arg8, long arg9, int arg10, long [] arg11, long [] arg12) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11, int arg12, short arg13, int arg14); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11, int arg12, short arg13, int arg14) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); - } finally { - lock.unlock(); - } -} -static final native int _VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, int arg1, int arg2, long arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11, int arg12, short arg13, long arg14); -static final int VtblCall(int fnNumber, int /*long*/ ppVtbl, long arg0, int arg1, int arg2, long arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11, int arg12, short arg13, long arg14) { - lock.lock(); - try { - return _VtblCall(fnNumber, ppVtbl, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); - } finally { - lock.unlock(); - } -} -} +nsresult NS_ShutdownXPCOM(nsIServiceManager servMgr); +nsresult NS_GetServiceManager(nsIServiceManager *result); +nsresult NS_GetComponentManager(nsIComponentManager *result); +nsresult NS_GetComponentRegistrar(nsIComponentRegistrar *result); +nsresult NS_GetMemoryManager(nsIMemory *result); +nsresult NS_NewLocalFile(nsAString* path, PRBool followLinks, nsILocalFile* result); +nsresult NS_NewNativeLocalFile(nsACString* path, PRBool followLinks, nsILocalFile* result); +void * NS_Alloc(PRSize size); +void * NS_Realloc(void *ptr, PRSize size); +void NS_Free(void *ptr); +nsresult NS_GetDebug(nsIDebug *result); +nsresult NS_GetTraceRefcnt(nsITraceRefcnt *result);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/XPCOMInit.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,57 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by Netscape are Copyright (C) 1998-1999 + * Netscape Communications Corporation. All Rights Reserved. + * + * Contributor(s): + * + * IBM + * - Binding to permit interfacing between Mozilla and DWT + * - Copyright (C) 2003, 2006 IBM Corp. All Rights Reserved. + * + * Port to the D programming language: + * John Reimer <terminal.node@gmail.com> + *******************************************************************************/ +module dwt.internal.mozilla.XPCOMInit; + +import dwt.internal.mozilla.Common; + +extern(System) { + + align(4): + + struct GREVersionRange { + char *lower; + int lowerInclusive; + char *upper; + int upperInclusive; + } + + struct GREProperty { + char *property; + char *value; + } +} + +const int PATH_MAX = 4096; + +extern(System): + +nsresult GRE_GetGREPathWithProperties(GREVersionRange *versions, PRUint32 versionsLength, GREProperty *properties, PRUint32 propertiesLength, char *buffer, PRUint32 buflen); +nsresult XPCOMGlueStartup(char* xpcomFile); +nsresult XPCOMGlueShutdown ();
--- a/dwt/internal/mozilla/XPCOMObject.d Fri Jan 16 12:19:08 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1029 +0,0 @@ -/******************************************************************************* - * 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 - *******************************************************************************/ -module dwt.internal.mozilla.XPCOMObject; - -import dwt.dwthelper.utils; - -import java.util.Hashtable; - -import dwt.DWT; -import dwt.internal.C; -import dwt.internal.Callback; -import dwt.internal.LONG; - -public class XPCOMObject { - - private int /*long*/ 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 /*long*/[] callbackAddresses = new int /*long*/[argCounts.length]; - synchronized (Callbacks) { - for (int i = 0, length = argCounts.length; i < length; i++){ - if ((Callbacks[i][argCounts[i]]) is null) { - Callbacks[i][argCounts[i]] = new Callback (getClass (), "callback"+i, argCounts[i] + 1, true, XPCOM.NS_ERROR_FAILURE); //$NON-NLS-1$ - } - callbackAddresses[i] = Callbacks[i][argCounts[i]].getAddress (); - if (callbackAddresses[i] is 0) DWT.error (DWT.ERROR_NO_MORE_CALLBACKS); - } - } - - 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) { - // find the object on which this call was invoked - int /*long*/ address = callbackArgs[0]; - Object object = ObjectMap.get (new LONG (address)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} -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)); - if (object is 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); -} - -public void dispose() { - // free the memory for this reference - int /*long*/[] pVtable = new int /*long*/[1]; - 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)); - - ppVtable = 0; -} - -public int /*long*/ getAddress () { - return ppVtable; -} - -public int /*long*/ method0 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method1 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method10 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method11 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method12 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method13 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method14 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method15 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method16 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method17 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method18 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method19 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method2 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method20 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method21 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method22 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method23 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method24 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method25 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method26 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method27 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method28 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method29 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method3 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method30 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method31 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method32 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method33 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method34 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method35 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method36 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method37 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method38 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method39 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method4 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method40 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method41 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method42 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method43 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method44 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method45 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method46 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method47 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method48 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method49 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method5 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method50 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method51 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method52 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method53 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method54 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method55 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method56 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method57 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method58 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method59 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method6 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method60 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method61 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method62 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method63 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method64 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method65 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method66 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method67 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method68 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method69 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method7 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method70 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method71 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method72 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method73 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method74 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method75 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method76 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method77 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method78 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method79 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method8 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -public int /*long*/ method9 (int /*long*/[] args) { - return XPCOM.NS_ERROR_NOT_IMPLEMENTED; -} -} -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/gfxIImageFrame.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,52 @@ +module dwt.internal.mozilla.gfxIImageFrame; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +const char[] GFXIIMAGEFRAME_IID_STR = "f6d00ee7-defc-4101-b2dc-e72cf4c37c3c"; + +const nsIID GFXIIMAGEFRAME_IID= + {0xf6d00ee7, 0xdefc, 0x4101, + [ 0xb2, 0xdc, 0xe7, 0x2c, 0xf4, 0xc3, 0x7c, 0x3c ]}; + +interface gfxIImageFrame : nsISupports { + + + static const char[] IID_STR = GFXIIMAGEFRAME_IID_STR; + static const nsIID IID = GFXIIMAGEFRAME_IID; + +extern(System): + + nsresult Init(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, gfx_format aFormat, gfx_depth aDepth); + nsresult GetMutable(PRBool *aMutable); + nsresult SetMutable(PRBool aMutable); + nsresult GetX(PRInt32 *aX); + nsresult GetY(PRInt32 *aY); + nsresult GetWidth(PRInt32 *aWidth); + nsresult GetHeight(PRInt32 *aHeight); + nsresult GetRect(nsIntRect * rect); + nsresult GetFormat(gfx_format *aFormat); + nsresult GetNeedsBackground(PRBool *aNeedsBackground); + nsresult GetImageBytesPerRow(PRUint32 *aImageBytesPerRow); + nsresult GetImageDataLength(PRUint32 *aImageDataLength); + nsresult GetImageData(PRUint8 **bits, PRUint32 *length); + nsresult SetImageData(PRUint8 *data, PRUint32 length, PRInt32 offset); + nsresult LockImageData(); + nsresult UnlockImageData(); + nsresult GetAlphaBytesPerRow(PRUint32 *aAlphaBytesPerRow); + nsresult GetAlphaDataLength(PRUint32 *aAlphaDataLength); + nsresult GetAlphaData(PRUint8 **bits, PRUint32 *length); + nsresult SetAlphaData(PRUint8 *data, PRUint32 length, PRInt32 offset); + nsresult LockAlphaData(); + nsresult UnlockAlphaData(); + nsresult DrawTo(gfxIImageFrame aDst, PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight); + nsresult GetTimeout(PRInt32 *aTimeout); + nsresult SetTimeout(PRInt32 aTimeout); + nsresult GetFrameDisposalMethod(PRInt32 *aFrameDisposalMethod); + nsresult SetFrameDisposalMethod(PRInt32 aFrameDisposalMethod); + nsresult GetBackgroundColor(gfx_color *aBackgroundColor); + nsresult SetBackgroundColor(gfx_color aBackgroundColor); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/imgIContainer.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,49 @@ +module dwt.internal.mozilla.imgIContainer; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.gfxIImageFrame; +import dwt.internal.mozilla.imgIContainerObserver; + +const char[] IMGICONTAINER_IID_STR = "1a6290e6-8285-4e10-963d-d001f8d327b8"; + +const nsIID IMGICONTAINER_IID= + {0x1a6290e6, 0x8285, 0x4e10, + [ 0x96, 0x3d, 0xd0, 0x01, 0xf8, 0xd3, 0x27, 0xb8 ]}; + + +interface imgIContainer : nsISupports { + + static const char[] IID_STR = IMGICONTAINER_IID_STR; + static const nsIID IID = IMGICONTAINER_IID; + +extern(System): + nsresult Init(PRInt32 aWidth, PRInt32 aHeight, imgIContainerObserver aObserver); + nsresult GetPreferredAlphaChannelFormat(gfx_format *aPreferredAlphaChannelFormat); + nsresult GetWidth(PRInt32 *aWidth); + nsresult GetHeight(PRInt32 *aHeight); + nsresult GetCurrentFrame(gfxIImageFrame *aCurrentFrame); + nsresult GetNumFrames(PRUint32 *aNumFrames); + + enum { kNormalAnimMode = 0 }; + enum { kDontAnimMode = 1 }; + enum { kLoopOnceAnimMode = 2 }; + + nsresult GetAnimationMode(PRUint16 *aAnimationMode); + nsresult SetAnimationMode(PRUint16 aAnimationMode); + nsresult GetFrameAt(PRUint32 index, gfxIImageFrame *_retval); + nsresult AppendFrame(gfxIImageFrame item); + nsresult RemoveFrame(gfxIImageFrame item); + nsresult EndFrameDecode(PRUint32 framenumber, PRUint32 timeout); + nsresult DecodingComplete(); + nsresult Clear(); + nsresult StartAnimation(); + nsresult StopAnimation(); + nsresult ResetAnimation(); + nsresult GetLoopCount(PRInt32 *aLoopCount); + nsresult SetLoopCount(PRInt32 aLoopCount); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/imgIContainerObserver.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,25 @@ +module dwt.internal.mozilla.imgIContainerObserver; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.imgIContainer; +import dwt.internal.mozilla.gfxIImageFrame; + +const char[] IMGICONTAINEROBSERVER_IID_STR = "53102f15-0f53-4939-957e-aea353ad2700"; + +const nsIID IMGICONTAINEROBSERVER_IID= + {0x53102f15, 0x0f53, 0x4939, + [ 0x95, 0x7e, 0xae, 0xa3, 0x53, 0xad, 0x27, 0x00 ]}; + +interface imgIContainerObserver : nsISupports { + + static const char[] IID_STR = IMGICONTAINEROBSERVER_IID_STR; + static const nsIID IID = IMGICONTAINEROBSERVER_IID; + +extern(System): + nsresult FrameChanged(imgIContainer aContainer, gfxIImageFrame aFrame, nsIntRect * aDirtyRect); + +} +
--- a/dwt/internal/mozilla/init/GREVersionRange.d Fri Jan 16 12:19:08 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/******************************************************************************* - * 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 - *******************************************************************************/ -module dwt.internal.mozilla.init.GREVersionRange; - -import dwt.dwthelper.utils; - -/** @jniclass flags=cpp */ -public class GREVersionRange { - /** @field cast=(const char *) */ - public int /*long*/ lower; - public bool lowerInclusive; - /** @field cast=(const char *) */ - public int /*long*/ upper; - public bool upperInclusive; - public static final int sizeof = XPCOMInit.GREVersionRange_sizeof(); -}
--- a/dwt/internal/mozilla/init/XPCOMInit.d Fri Jan 16 12:19:08 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2006 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ -module dwt.internal.mozilla.init.XPCOMInit; - -import dwt.dwthelper.utils; - -import dwt.internal.Platform; - -/** @jniclass flags=cpp */ -public class XPCOMInit extends Platform { - public static final int PATH_MAX = 4096; - -public static final native int GREVersionRange_sizeof (); - -/** - * @param versions cast=(const GREVersionRange *) - * @param properties cast=(const GREProperty *) - * @param buffer cast=(char *) - */ -public static final native int _GRE_GetGREPathWithProperties (GREVersionRange versions, int versionsLength, int /*long*/ properties, int propertiesLength, int /*long*/ buffer, int buflen); -public static final int GRE_GetGREPathWithProperties (GREVersionRange versions, int versionsLength, int /*long*/ properties, int propertiesLength, int /*long*/ buffer, int buflen) { - lock.lock(); - try { - return _GRE_GetGREPathWithProperties(versions, versionsLength, properties, propertiesLength, buffer, buflen); - } finally { - lock.unlock(); - } -} -/** @param place cast=(const char *) */ -public static final native int _XPCOMGlueStartup (byte[] place); -public static final int XPCOMGlueStartup (byte[] place) { - lock.lock(); - try { - return _XPCOMGlueStartup(place); - } finally { - lock.unlock(); - } -} -public static final native int _XPCOMGlueShutdown (); -public static final int XPCOMGlueShutdown () { - lock.lock(); - try { - return _XPCOMGlueShutdown(); - } finally { - lock.unlock(); - } -} -}
--- a/dwt/internal/mozilla/nsEmbedString.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsEmbedString.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,65 +1,91 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2004 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsEmbedString; -import dwt.dwthelper.utils; +import Utf = tango.text.convert.Utf; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsStringAPI; +import XPCOM = dwt.internal.mozilla.XPCOM; + +scope class nsEmbedString +{ + this(wchar[] s) + { + nsresult result; + result = NS_StringContainerInit2(&str, s.ptr, s.length, 0); + if (XPCOM.NS_FAILED(result)) + throw new Exception("Init string container fail"); + } -public class nsEmbedString { - int /*long*/ handle; + this() + { + nsresult result; + result = NS_StringContainerInit(&str); + if (XPCOM.NS_FAILED(result)) + throw new Exception("Init string container fail"); + } + + nsAString* opCast() + { + return cast(nsAString*)&str; + } + + wchar[] toString16() + { + wchar* buffer = null; + PRBool terminated; + uint len = NS_StringGetData(cast(nsAString*)&str, &buffer, &terminated); + return buffer[0 .. len].dup; + } -public nsEmbedString() { - handle = XPCOM.nsEmbedString_new(); -} - -public nsEmbedString(String string) { - if (string !is null) { - char[] aString = new char[string.length() + 1]; - string.getChars(0, string.length(), aString, 0); - handle = XPCOM.nsEmbedString_new(aString); - } + char[] toString() + { + return Utf.toString(this.toString16()); + } + ~this() + { + NS_StringContainerFinish(&str); + } +private: + nsStringContainer str; } -public int /*long*/ getAddress() { - return handle; -} - -public String toString() { - if (handle is 0) return null; - int length = XPCOM.nsEmbedString_Length(handle); - int /*long*/ buffer = XPCOM.nsEmbedString_get(handle); - char[] dest = new char[length]; - XPCOM.memmove(dest, buffer, length * 2); - return new String(dest); -} - -public void dispose() { - if (handle is 0) return; - XPCOM.nsEmbedString_delete(handle); - handle = 0; -} + +scope class nsEmbedCString +{ + this(char[] s) + { + nsresult result; + result = NS_CStringContainerInit2(&str, s.ptr, s.length, 0); + if (XPCOM.NS_FAILED(result)) + throw new Exception("Init string container fail"); + } + + this() + { + nsresult result; + result = NS_CStringContainerInit(&str); + if (XPCOM.NS_FAILED(result)) + throw new Exception("Init string container fail"); + } + + nsACString* opCast() + { + return cast(nsACString*)&str; + } + + char[] toString() + { + char* buffer = null; + PRBool terminated; + uint len = NS_CStringGetData(cast(nsACString*)&str, &buffer, &terminated); + return buffer[0 .. len].dup; + } + + ~this() + { + NS_CStringContainerFinish(&str); + } +private: + nsCStringContainer str; } +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsError.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,67 @@ +module dwt.internal.mozilla.nsError; + +import dwt.internal.mozilla.Common; + +/** + * @name Standard Module Offset Code. Each Module should identify a unique number + * and then all errors associated with that module become offsets from the + * base associated with that module id. There are 16 bits of code bits for + * each module. + */ + +enum { + NS_ERROR_MODULE_XPCOM = 1, + NS_ERROR_MODULE_BASE = 2, + NS_ERROR_MODULE_GFX = 3, + NS_ERROR_MODULE_WIDGET = 4, + NS_ERROR_MODULE_CALENDAR = 5, + NS_ERROR_MODULE_NETWORK = 6, + NS_ERROR_MODULE_PLUGINS = 7, + NS_ERROR_MODULE_LAYOUT = 8, + NS_ERROR_MODULE_HTMLPARSER = 9, + NS_ERROR_MODULE_RDF = 10, + NS_ERROR_MODULE_UCONV = 11, + NS_ERROR_MODULE_REG = 12, + NS_ERROR_MODULE_FILES = 13, + NS_ERROR_MODULE_DOM = 14, + NS_ERROR_MODULE_IMGLIB = 15, + NS_ERROR_MODULE_MAILNEWS = 16, + NS_ERROR_MODULE_EDITOR = 17, + NS_ERROR_MODULE_XPCONNECT = 18, + NS_ERROR_MODULE_PROFILE = 19, + NS_ERROR_MODULE_LDAP = 20, + NS_ERROR_MODULE_SECURITY = 21, + NS_ERROR_MODULE_DOM_XPATH = 22, + NS_ERROR_MODULE_DOM_RANGE = 23, + NS_ERROR_MODULE_URILOADER = 24, + NS_ERROR_MODULE_CONTENT = 25, + NS_ERROR_MODULE_PYXPCOM = 26, + NS_ERROR_MODULE_XSLT = 27, + NS_ERROR_MODULE_IPC = 28, + NS_ERROR_MODULE_SVG = 29, + NS_ERROR_MODULE_STORAGE = 30, + NS_ERROR_MODULE_SCHEMA = 31, + NS_ERROR_MODULE_GENERAL = 51, + NS_ERROR_SEVERITY_ERROR = 1, + NS_ERROR_MODULE_BASE_OFFSET = 0x45, +} + +const nsresult NS_OK = cast(nsresult)0; +const nsresult NS_ERROR_BASE = cast(nsresult) 0xC1F30000; +const nsresult NS_ERROR_NOT_INITIALIZED = cast(nsresult)(NS_ERROR_BASE + 1); +const nsresult NS_ERROR_ALREADY_INITIALIZED = cast(nsresult)(NS_ERROR_BASE + 2); +const nsresult NS_NOINTERFACE = cast(nsresult)0x80004002L; + +alias NS_NOINTERFACE NS_ERROR_NO_INTERFACE; + +const nsresult NS_ERROR_INVALID_POINTER = cast(nsresult)0x80004003L; + +alias NS_ERROR_INVALID_POINTER NS_ERROR_NULL_POINTER; + +const nsresult NS_ERROR_ABORT = cast(nsresult)0x80004004L; +const nsresult NS_ERROR_FAILURE = cast(nsresult)0x80004005L; +const nsresult NS_ERROR_UNEXPECTED = cast(nsresult)0x8000ffffL; +const nsresult NS_ERROR_OUT_OF_MEMORY = cast(nsresult) 0x8007000eL; +const nsresult NS_ERROR_ILLEGAL_VALUE = cast(nsresult) 0x80070057L; + +alias NS_ERROR_ILLEGAL_VALUE NS_ERROR_INVALID_ARG;
--- a/dwt/internal/mozilla/nsIAppShell.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIAppShell.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,77 +1,28 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIAppShell; -import dwt.dwthelper.utils; - -public class nsIAppShell extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 8; - - public static final String NS_IAPPSHELL_IID_STR = - "a0757c31-eeac-11d1-9ec1-00aa002fb821"; - - public static final nsID NS_IAPPSHELL_IID = - new nsID(NS_IAPPSHELL_IID_STR); +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIEventQueue; - public nsIAppShell(int /*long*/ address) { - super(address); - } +const char[] NS_IAPPSHELL_IID_STR = "a0757c31-eeac-11d1-9ec1-00aa002fb821"; - public int Create(int /*long*/ argc, int /*long*/[] argv) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), argc, argv); - } - - public int Run() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress()); - } +const nsIID NS_IAPPSHELL_IID= + {0xa0757c31, 0xeeac, 0x11d1, + [ 0x9e, 0xc1, 0x00, 0xaa, 0x00, 0x2f, 0xb8, 0x21 ]}; - public int Spinup() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress()); - } - - public int Spindown() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress()); - } - - public int ListenToEventQueue(int /*long*/ aQueue, int aListen) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aQueue, aListen); - } +interface nsIAppShell : nsISupports { + static const char[] IID_STR = NS_IAPPSHELL_IID_STR; + static const nsIID IID = NS_IAPPSHELL_IID; - public int GetNativeEvent(int /*long*/ aRealEvent, int /*long*/[] aEvent) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aRealEvent, aEvent); - } +extern(System): + nsresult Create(int *argc, char **argv); + nsresult Run(); + nsresult Spinup(); + nsresult Spindown(); + nsresult ListenToEventQueue(nsIEventQueue * aQueue, PRBool aListen); + nsresult GetNativeEvent(PRBool * aRealEvent, void * * aEvent); + nsresult DispatchNativeEvent(PRBool aRealEvent, void * aEvent); + nsresult Exit(); +} - public int DispatchNativeEvent(int aRealEvent, int /*long*/ aEvent) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aRealEvent, aEvent); - } - - public int Exit() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress()); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIAtom.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,28 @@ +module dwt.internal.mozilla.nsIAtom; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsStringAPI; + +const char[] NS_IATOM_IID_STR = "3d1b15b0-93b4-11d1-895b-006008911b81"; + +const nsIID NS_IATOM_IID= + {0x3d1b15b0, 0x93b4, 0x11d1, + [ 0x89, 0x5b, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81 ]}; + +interface nsIAtom : nsISupports { + + static const char[] IID_STR = NS_IATOM_IID_STR; + static const nsIID IID = NS_IATOM_IID; + +extern(System): + nsresult ToString(nsAString * _retval); + nsresult ToUTF8String(nsACString * _retval); + nsresult GetUTF8String(char **aResult); + nsresult Equals(nsAString * aString, PRBool *_retval); + nsresult EqualsUTF8(nsACString * aString, PRBool *_retval); + +} +
--- a/dwt/internal/mozilla/nsIAuthInformation.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIAuthInformation.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,89 +1,35 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIAuthInformation; -import dwt.dwthelper.utils; - -public class nsIAuthInformation extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 9; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsStringAPI; - public static final String NS_IAUTHINFORMATION_IID_STR = - "0d73639c-2a92-4518-9f92-28f71fea5f20"; - - public static final nsID NS_IAUTHINFORMATION_IID = - new nsID(NS_IAUTHINFORMATION_IID_STR); +const char[] NS_IAUTHINFORMATION_IID_STR = "0d73639c-2a92-4518-9f92-28f71fea5f20"; - public nsIAuthInformation(int /*long*/ address) { - super(address); - } - - public static final int AUTH_HOST = 1; - - public static final int AUTH_PROXY = 2; +const nsIID NS_IAUTHINFORMATION_IID = + {0x0d73639c, 0x2a92, 0x4518, + [ 0x9f, 0x92, 0x28, 0xf7, 0x1f, 0xea, 0x5f, 0x20 ] }; - public static final int NEED_DOMAIN = 4; - - public static final int ONLY_PASSWORD = 8; +interface nsIAuthInformation : nsISupports { - public int GetFlags(int[] aFlags) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aFlags); - } + static const char[] IID_STR = NS_IAUTHINFORMATION_IID_STR; + static const nsIID IID = NS_IAUTHINFORMATION_IID; - public int GetRealm(int /*long*/ aRealm) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aRealm); - } - - public int GetAuthenticationScheme(int /*long*/ aAuthenticationScheme) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aAuthenticationScheme); - } - - public int GetUsername(int /*long*/ aUsername) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aUsername); - } - - public int SetUsername(int /*long*/ aUsername) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aUsername); - } + enum { AUTH_HOST = 1U } + enum { AUTH_PROXY = 2U } + enum { NEED_DOMAIN = 4U } + enum { ONLY_PASSWORD = 8U } - public int GetPassword(int /*long*/ aPassword) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aPassword); - } - - public int SetPassword(int /*long*/ aPassword) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aPassword); - } +extern(System): + nsresult GetFlags(PRUint32 *aFlags); + nsresult GetRealm(nsAString * aRealm);; + nsresult GetAuthenticationScheme(nsACString * aAuthenticationScheme); + nsresult GetUsername(nsAString * aUsername); + nsresult SetUsername(nsAString * aUsername); + nsresult GetPassword(nsAString * aPassword); + nsresult SetPassword(nsAString * aPassword); + nsresult GetDomain(nsAString * aDomain); + nsresult SetDomain(nsAString * aDomain); - public int GetDomain(int /*long*/ aDomain) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aDomain); - } - - public int SetDomain(int /*long*/ aDomain) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aDomain); - } -} +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIAuthPrompt.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,30 @@ +module dwt.internal.mozilla.nsIAuthPrompt; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +// import dwt.internal.mozilla.nsIPrompt; + +const char[] NS_IAUTHPROMPT_IID_STR = "2f977d45-5485-11d4-87e2-0010a4e75ef2"; + +const nsIID NS_IAUTHPROMPT_IID= + {0x2f977d45, 0x5485, 0x11d4, + [ 0x87, 0xe2, 0x00, 0x10, 0xa4, 0xe7, 0x5e, 0xf2 ]}; + +interface nsIAuthPrompt : nsISupports { + + static const char[] IID_STR = NS_IAUTHPROMPT_IID_STR; + static const nsIID IID = NS_IAUTHPROMPT_IID; + + enum { SAVE_PASSWORD_NEVER = 0U }; + enum { SAVE_PASSWORD_FOR_SESSION = 1U }; + enum { SAVE_PASSWORD_PERMANENTLY = 2U }; + +extern(System): + nsresult Prompt(PRUnichar *dialogTitle, PRUnichar *text, PRUnichar *passwordRealm, PRUint32 savePassword, PRUnichar *defaultText, PRUnichar **result, PRBool *_retval); + nsresult PromptUsernameAndPassword(PRUnichar *dialogTitle, PRUnichar *text, PRUnichar *passwordRealm, PRUint32 savePassword, PRUnichar **user, PRUnichar **pwd, PRBool *_retval); + nsresult PromptPassword(PRUnichar *dialogTitle, PRUnichar *text, PRUnichar *passwordRealm, PRUint32 savePassword, PRUnichar **pwd, PRBool *_retval); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIAuthPromptCallback.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,22 @@ +module dwt.internal.mozilla.nsIAuthPromptCallback; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIAuthInformation; + +const char[] NS_IAUTHPROMPTCALLBACK_IID_STR = "bdc387d7-2d29-4cac-92f1-dd75d786631d"; + +const nsIID NS_IAUTHPROMPTCALLBACK_IID= + {0xbdc387d7, 0x2d29, 0x4cac, + [ 0x92, 0xf1, 0xdd, 0x75, 0xd7, 0x86, 0x63, 0x1d ]}; + +interface nsIAuthPromptCallback : nsISupports { + + static const char[] IID_STR = NS_IAUTHPROMPTCALLBACK_IID_STR; + static const nsIID IID = NS_IAUTHPROMPTCALLBACK_IID; + +extern(System): + nsresult OnAuthAvailable(nsISupports aContext, nsIAuthInformation aAuthInfo); + nsresult OnAuthCancelled(nsISupports aContext, PRBool userCancel); +}
--- a/dwt/internal/mozilla/nsIBaseWindow.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIBaseWindow.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,141 +1,47 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIBaseWindow; -import dwt.dwthelper.utils; - -public class nsIBaseWindow extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 24; - - public static final String NS_IBASEWINDOW_IID_STR = - "046bc8a0-8015-11d3-af70-00a024ffc08c"; - - public static final nsID NS_IBASEWINDOW_IID = - new nsID(NS_IBASEWINDOW_IID_STR); +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public nsIBaseWindow(int /*long*/ address) { - super(address); - } - - public int InitWindow(int /*long*/ parentNativeWindow, int /*long*/ parentWidget, int x, int y, int cx, int cy) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), parentNativeWindow, parentWidget, x, y, cx, cy); - } +alias void * nativeWindow; - public int Create() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress()); - } - - public int Destroy() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress()); - } +const char[] NS_IBASEWINDOW_IID_STR = "046bc8a0-8015-11d3-af70-00a024ffc08c"; - public int SetPosition(int x, int y) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), x, y); - } - - public int GetPosition(int[] x, int[] y) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), x, y); - } - - public int SetSize(int cx, int cy, int fRepaint) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), cx, cy, fRepaint); - } +const nsIID NS_IBASEWINDOW_IID= + {0x046bc8a0, 0x8015, 0x11d3, + [ 0xaf, 0x70, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c ]}; - public int GetSize(int[] cx, int[] cy) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), cx, cy); - } - - public int SetPositionAndSize(int x, int y, int cx, int cy, int fRepaint) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), x, y, cx, cy, fRepaint); - } +interface nsIBaseWindow : nsISupports { - public int GetPositionAndSize(int[] x, int[] y, int[] cx, int[] cy) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), x, y, cx, cy); - } - - public int Repaint(int force) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), force); - } + static const char[] IID_STR = NS_IBASEWINDOW_IID_STR; + static const nsIID IID = NS_IBASEWINDOW_IID; - public int GetParentWidget(int /*long*/[] aParentWidget) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 11, getAddress(), aParentWidget); - } - - public int SetParentWidget(int /*long*/ aParentWidget) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 12, getAddress(), aParentWidget); - } - - public int GetParentNativeWindow(int /*long*/[] aParentNativeWindow) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 13, getAddress(), aParentNativeWindow); - } - - public int SetParentNativeWindow(int /*long*/ aParentNativeWindow) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 14, getAddress(), aParentNativeWindow); - } - - public int GetVisibility(int[] aVisibility) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 15, getAddress(), aVisibility); - } - - public int SetVisibility(int aVisibility) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 16, getAddress(), aVisibility); - } - - public int GetEnabled(int[] aEnabled) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 17, getAddress(), aEnabled); - } +extern(System): + nsresult InitWindow(nativeWindow parentNativeWindow, nsIWidget * parentWidget, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy); + nsresult Create(); + nsresult Destroy(); + nsresult SetPosition(PRInt32 x, PRInt32 y); + nsresult GetPosition(PRInt32 *x, PRInt32 *y); + nsresult SetSize(PRInt32 cx, PRInt32 cy, PRBool fRepaint); + nsresult GetSize(PRInt32 *cx, PRInt32 *cy); + nsresult SetPositionAndSize(PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy, PRBool fRepaint); + nsresult GetPositionAndSize(PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy); + nsresult Repaint(PRBool force); + nsresult GetParentWidget(nsIWidget * *aParentWidget); + nsresult SetParentWidget(nsIWidget * aParentWidget); + nsresult GetParentNativeWindow(nativeWindow *aParentNativeWindow); + nsresult SetParentNativeWindow(nativeWindow aParentNativeWindow); + nsresult GetVisibility(PRBool *aVisibility); + nsresult SetVisibility(PRBool aVisibility); + nsresult GetEnabled(PRBool *aEnabled); + nsresult SetEnabled(PRBool aEnabled); + nsresult GetBlurSuppression(PRBool *aBlurSuppression); + nsresult SetBlurSuppression(PRBool aBlurSuppression); + nsresult GetMainWidget(nsIWidget * *aMainWidget); + nsresult SetFocus(); + nsresult GetTitle(PRUnichar * *aTitle); + nsresult SetTitle(PRUnichar * aTitle); - public int SetEnabled(int aEnabled) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 18, getAddress(), aEnabled); - } - - public int GetBlurSuppression(int[] aBlurSuppression) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 19, getAddress(), aBlurSuppression); - } - - public int SetBlurSuppression(int aBlurSuppression) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 20, getAddress(), aBlurSuppression); - } +} - public int GetMainWidget(int /*long*/[] aMainWidget) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 21, getAddress(), aMainWidget); - } - - public int SetFocus() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 22, getAddress()); - } - - public int GetTitle(int /*long*/[] aTitle) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 23, getAddress(), aTitle); - } - - public int SetTitle(char[] aTitle) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 24, getAddress(), aTitle); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIBinaryInputStream.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,36 @@ +module dwt.internal.mozilla.nsIBinaryInputStream; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIInputStream; +import dwt.internal.mozilla.nsStringAPI; + +const char[] NS_IBINARYINPUTSTREAM_IID_STR = "7b456cb0-8772-11d3-90cf-0040056a906e"; + +const nsIID NS_IBINARYINPUTSTREAM_IID= + {0x7b456cb0, 0x8772, 0x11d3, + [ 0x90, 0xcf, 0x00, 0x40, 0x05, 0x6a, 0x90, 0x6e ]}; + +interface nsIBinaryInputStream : nsIInputStream { + + static const char[] IID_STR = NS_IBINARYINPUTSTREAM_IID_STR; + static const nsIID IID = NS_IBINARYINPUTSTREAM_IID; + +extern(System): + nsresult SetInputStream(nsIInputStream aInputStream); + nsresult ReadBoolean(PRBool *_retval); + nsresult Read8(PRUint8 *_retval); + nsresult Read16(PRUint16 *_retval); + nsresult Read32(PRUint32 *_retval); + nsresult Read64(PRUint64 *_retval); + nsresult ReadFloat(float *_retval); + nsresult ReadDouble(double *_retval); + nsresult ReadCString(nsACString * _retval); + nsresult ReadString(nsAString * _retval); + nsresult ReadBytes(PRUint32 aLength, char **aString); + nsresult ReadByteArray(PRUint32 aLength, PRUint8 **aBytes); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIBinaryOutputStream.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,36 @@ +module dwt.internal.mozilla.nsIBinaryOutputStream; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIOutputStream; + +const char[] NS_IBINARYOUTPUTSTREAM_IID_STR = "204ee610-8765-11d3-90cf-0040056a906e"; + +const nsIID NS_IBINARYOUTPUTSTREAM_IID= + {0x204ee610, 0x8765, 0x11d3, + [ 0x90, 0xcf, 0x00, 0x40, 0x05, 0x6a, 0x90, 0x6e ]}; + +interface nsIBinaryOutputStream : nsIOutputStream { + + static const char[] IID_STR = NS_IBINARYOUTPUTSTREAM_IID_STR; + static const nsIID IID = NS_IBINARYOUTPUTSTREAM_IID; + +extern(System): + nsresult SetOutputStream(nsIOutputStream aOutputStream); + nsresult WriteBoolean(PRBool aBoolean); + nsresult Write8(PRUint8 aByte); + nsresult Write16(PRUint16 a16); + nsresult Write32(PRUint32 a32); + nsresult Write64(PRUint64 a64); + nsresult WriteFloat(float aFloat); + nsresult WriteDouble(double aDouble); + nsresult WriteStringZ(char *aString); + nsresult WriteWStringZ(PRUnichar *aString); + nsresult WriteUtf8Z(PRUnichar *aString); + nsresult WriteBytes(char *aString, PRUint32 aLength); + nsresult WriteByteArray(PRUint8 *aBytes, PRUint32 aLength); + +} +
--- a/dwt/internal/mozilla/nsICancelable.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsICancelable.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,49 +1,21 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsICancelable; -import dwt.dwthelper.utils; - -public class nsICancelable extends nsISupports { +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 1; +const char[] NS_ICANCELABLE_IID_STR = "d94ac0a0-bb18-46b8-844e-84159064b0bd"; - public static final String NS_ICANCELABLE_IID_STR = - "d94ac0a0-bb18-46b8-844e-84159064b0bd"; +const nsIID NS_ICANCELABLE_IID= + {0xd94ac0a0, 0xbb18, 0x46b8, + [ 0x84, 0x4e, 0x84, 0x15, 0x90, 0x64, 0xb0, 0xbd ]}; - public static final nsID NS_ICANCELABLE_IID = - new nsID(NS_ICANCELABLE_IID_STR); +interface nsICancelable : nsISupports { + + static const char[] IID_STR = NS_ICANCELABLE_IID_STR; + static const nsIID IID = NS_ICANCELABLE_IID; - public nsICancelable(int /*long*/ address) { - super(address); - } +extern(System): + nsresult Cancel(nsresult aReason); +} - public int Cancel(int aReason) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aReason); - } -}
--- a/dwt/internal/mozilla/nsICategoryManager.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsICategoryManager.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,69 +1,27 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsICategoryManager; -import dwt.dwthelper.utils; - -public class nsICategoryManager extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 6; - - public static final String NS_ICATEGORYMANAGER_IID_STR = - "3275b2cd-af6d-429a-80d7-f0c5120342ac"; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsISimpleEnumerator; - public static final nsID NS_ICATEGORYMANAGER_IID = - new nsID(NS_ICATEGORYMANAGER_IID_STR); +const char[] NS_ICATEGORYMANAGER_IID_STR = "3275b2cd-af6d-429a-80d7-f0c5120342ac"; - public nsICategoryManager(int /*long*/ address) { - super(address); - } +const nsIID NS_ICATEGORYMANAGER_IID= + {0x3275b2cd, 0xaf6d, 0x429a, + [ 0x80, 0xd7, 0xf0, 0xc5, 0x12, 0x03, 0x42, 0xac ]}; - public int GetCategoryEntry(byte[] aCategory, byte[] aEntry, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aCategory, aEntry, _retval); - } +interface nsICategoryManager : nsISupports { - public int AddCategoryEntry(byte[] aCategory, byte[] aEntry, byte[] aValue, int aPersist, int aReplace, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aCategory, aEntry, aValue, aPersist, aReplace, _retval); - } - - public int DeleteCategoryEntry(byte[] aCategory, byte[] aEntry, int aPersist) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aCategory, aEntry, aPersist); - } + static const char[] IID_STR = NS_ICATEGORYMANAGER_IID_STR; + static const nsIID IID = NS_ICATEGORYMANAGER_IID; - public int DeleteCategory(byte[] aCategory) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aCategory); - } +extern(System): + nsresult GetCategoryEntry(char *aCategory, char *aEntry, char **_retval); + nsresult AddCategoryEntry(char *aCategory, char *aEntry, char *aValue, PRBool aPersist, PRBool aReplace, char **_retval); + nsresult DeleteCategoryEntry(char *aCategory, char *aEntry, PRBool aPersist); + nsresult DeleteCategory(char *aCategory); + nsresult EnumerateCategory(char *aCategory, nsISimpleEnumerator *_retval); + nsresult EnumerateCategories(nsISimpleEnumerator *_retval); +} - public int EnumerateCategory(byte[] aCategory, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aCategory, _retval); - } - - public int EnumerateCategories(int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), _retval); - } -}
--- a/dwt/internal/mozilla/nsIChannel.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIChannel.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,121 +1,50 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIChannel; -import dwt.dwthelper.utils; - -public class nsIChannel extends nsIRequest { - - static final int LAST_METHOD_ID = nsIRequest.LAST_METHOD_ID + 16; - - public static final String NS_ICHANNEL_IID_STR = - "c63a055a-a676-4e71-bf3c-6cfa11082018"; - - public static final nsID NS_ICHANNEL_IID = - new nsID(NS_ICHANNEL_IID_STR); - - public nsIChannel(int /*long*/ address) { - super(address); - } - - public int GetOriginalURI(int /*long*/[] aOriginalURI) { - return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 1, getAddress(), aOriginalURI); - } +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public int SetOriginalURI(int /*long*/ aOriginalURI) { - return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 2, getAddress(), aOriginalURI); - } - - public int GetURI(int /*long*/[] aURI) { - return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 3, getAddress(), aURI); - } - - public int GetOwner(int /*long*/[] aOwner) { - return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 4, getAddress(), aOwner); - } +import dwt.internal.mozilla.nsIRequest; +import dwt.internal.mozilla.nsIURI; +import dwt.internal.mozilla.nsIInterfaceRequestor; +import dwt.internal.mozilla.nsIInputStream; +import dwt.internal.mozilla.nsIStreamListener; +import dwt.internal.mozilla.nsStringAPI; - public int SetOwner(int /*long*/ aOwner) { - return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 5, getAddress(), aOwner); - } +const char[] NS_ICHANNEL_IID_STR = "c63a055a-a676-4e71-bf3c-6cfa11082018"; +const nsIID NS_ICHANNEL_IID= + {0xc63a055a, 0xa676, 0x4e71, + [ 0xbf, 0x3c, 0x6c, 0xfa, 0x11, 0x08, 0x20, 0x18 ]}; - public int GetNotificationCallbacks(int /*long*/[] aNotificationCallbacks) { - return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 6, getAddress(), aNotificationCallbacks); - } +interface nsIChannel : nsIRequest { - public int SetNotificationCallbacks(int /*long*/ aNotificationCallbacks) { - return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 7, getAddress(), aNotificationCallbacks); - } + static const char[] IID_STR = NS_ICHANNEL_IID_STR; + static const nsIID IID = NS_ICHANNEL_IID; - public int GetSecurityInfo(int /*long*/[] aSecurityInfo) { - return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 8, getAddress(), aSecurityInfo); - } - - public int GetContentType(int /*long*/ aContentType) { - return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 9, getAddress(), aContentType); - } - - public int SetContentType(int /*long*/ aContentType) { - return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 10, getAddress(), aContentType); - } - - public int GetContentCharset(int /*long*/ aContentCharset) { - return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 11, getAddress(), aContentCharset); - } - - public int SetContentCharset(int /*long*/ aContentCharset) { - return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 12, getAddress(), aContentCharset); - } - - public int GetContentLength(int[] aContentLength) { - return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 13, getAddress(), aContentLength); - } +extern(System): + nsresult GetOriginalURI(nsIURI *aOriginalURI); + nsresult SetOriginalURI(nsIURI aOriginalURI); + nsresult GetURI(nsIURI *aURI); + nsresult GetOwner(nsISupports *aOwner); + nsresult SetOwner(nsISupports aOwner); - public int SetContentLength(int aContentLength) { - return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 14, getAddress(), aContentLength); - } - - public int Open(int /*long*/[] _retval) { - return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 15, getAddress(), _retval); - } - - public int AsyncOpen(int /*long*/ aListener, int /*long*/ aContext) { - return XPCOM.VtblCall(nsIRequest.LAST_METHOD_ID + 16, getAddress(), aListener, aContext); - } + nsresult GetNotificationCallbacks(nsIInterfaceRequestor *aNotificationCallbacks); + nsresult SetNotificationCallbacks(nsIInterfaceRequestor aNotificationCallbacks); + nsresult GetSecurityInfo(nsISupports *aSecurityInfo); + nsresult GetContentType(nsACString * aContentType); + nsresult SetContentType(nsACString * aContentType); + nsresult GetContentCharset(nsACString * aContentCharset); + nsresult SetContentCharset(nsACString * aContentCharset); + nsresult GetContentLength(PRInt32 *aContentLength); + nsresult SetContentLength(PRInt32 aContentLength); + nsresult Open(nsIInputStream *_retval); + nsresult AsyncOpen(nsIStreamListener aListener, nsISupports aContext); - public static final int LOAD_DOCUMENT_URI = 65536; - - public static final int LOAD_RETARGETED_DOCUMENT_URI = 131072; - - public static final int LOAD_REPLACE = 262144; + enum { LOAD_DOCUMENT_URI = 65536U }; + enum { LOAD_RETARGETED_DOCUMENT_URI = 131072U }; + enum { LOAD_REPLACE = 262144U }; + enum { LOAD_INITIAL_DOCUMENT_URI = 524288U }; + enum { LOAD_TARGETED = 1048576U }; + enum { LOAD_CALL_CONTENT_SNIFFERS = 2097152U }; +} - public static final int LOAD_INITIAL_DOCUMENT_URI = 524288; - - public static final int LOAD_TARGETED = 1048576; - - public static final int LOAD_CALL_CONTENT_SNIFFERS = 2097152; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIChromeEventHandler.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,24 @@ +module dwt.internal.mozilla.nsIChromeEventHandler; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIDOMEvent; + +const char[] NS_ICHROMEEVENTHANDLER_IID_STR = "7bc08970-9e6c-11d3-afb2-00a024ffc08c"; + +const nsIID NS_ICHROMEEVENTHANDLER_IID= + {0x7bc08970, 0x9e6c, 0x11d3, + [ 0xaf, 0xb2, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c ]}; + +interface nsIChromeEventHandler : nsISupports { + + static const char[] IID_STR = NS_ICHROMEEVENTHANDLER_IID_STR; + static const nsIID IID = NS_ICHROMEEVENTHANDLER_IID; + +extern(System): + nsresult HandleChromeEvent(nsPresContext * aPresContext, nsEvent * aEvent, nsIDOMEvent *aDOMEvent, PRUint32 aFlags, nsEventStatus *aStatus); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsICollection.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,32 @@ +module dwt.internal.mozilla.nsICollection; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsISerializable; +import dwt.internal.mozilla.nsIEnumerator; + +const char[] NS_ICOLLECTION_IID_STR = "83b6019c-cbc4-11d2-8cca-0060b0fc14a3"; + +const nsIID NS_ICOLLECTION_IID= + {0x83b6019c, 0xcbc4, 0x11d2, + [ 0x8c, 0xca, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3 ]}; + +interface nsICollection : nsISerializable { + + static const char[] IID_STR = NS_ICOLLECTION_IID_STR; + static const nsIID IID = NS_ICOLLECTION_IID; + +extern(System): + nsresult Count(PRUint32 *_retval); + nsresult GetElementAt(PRUint32 index, nsISupports *_retval); + nsresult QueryElementAt(PRUint32 index, nsIID * uuid, void * *result); + nsresult SetElementAt(PRUint32 index, nsISupports item); + nsresult AppendElement(nsISupports item); + nsresult RemoveElement(nsISupports item); + nsresult Enumerate(nsIEnumerator *_retval); + nsresult Clear(); + +} +
--- a/dwt/internal/mozilla/nsIComponentManager.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIComponentManager.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,61 +1,24 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2005 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIComponentManager; -import dwt.dwthelper.utils; - -public class nsIComponentManager extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 4; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIFactory; - public static final String NS_ICOMPONENTMANAGER_IID_STR = - "a88e5a60-205a-4bb1-94e1-2628daf51eae"; +const char[] NS_ICOMPONENTMANAGER_IID_STR = "a88e5a60-205a-4bb1-94e1-2628daf51eae"; - public static final nsID NS_ICOMPONENTMANAGER_IID = - new nsID(NS_ICOMPONENTMANAGER_IID_STR); - - public nsIComponentManager(int /*long*/ address) { - super(address); - } +const nsIID NS_ICOMPONENTMANAGER_IID= + {0xa88e5a60, 0x205a, 0x4bb1, + [ 0x94, 0xe1, 0x26, 0x28, 0xda, 0xf5, 0x1e, 0xae ]}; - public int GetClassObject(nsID aClass, nsID aIID, int /*long*/[] result) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aClass, aIID, result); - } - - public int GetClassObjectByContractID(byte[] aContractID, nsID aIID, int /*long*/[] result) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aContractID, aIID, result); - } +interface nsIComponentManager : nsISupports { + static const char[] IID_STR = NS_ICOMPONENTMANAGER_IID_STR; + static const nsIID IID = NS_ICOMPONENTMANAGER_IID; - public int CreateInstance(nsID aClass, int /*long*/ aDelegate, nsID aIID, int /*long*/[] result) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aClass, aDelegate, aIID, result); - } +extern(System): + nsresult GetClassObject(nsCID * aClass, nsIID * aIID, void * *result); + nsresult GetClassObjectByContractID(char *aContractID, nsIID * aIID, void * *result); + nsresult CreateInstance(nsCID * aClass, nsISupports aDelegate, nsIID * aIID, void * *result); + nsresult CreateInstanceByContractID(char *aContractID, nsISupports aDelegate, nsIID * aIID, void * *result); +} - public int CreateInstanceByContractID(byte[] aContractID, int /*long*/ aDelegate, nsID aIID, int /*long*/[] result) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aContractID, aDelegate, aIID, result); - } -}
--- a/dwt/internal/mozilla/nsIComponentRegistrar.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIComponentRegistrar.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,93 +1,34 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIComponentRegistrar; -import dwt.dwthelper.utils; - -public class nsIComponentRegistrar extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 12; - - public static final String NS_ICOMPONENTREGISTRAR_IID_STR = - "2417cbfe-65ad-48a6-b4b6-eb84db174392"; - - public static final nsID NS_ICOMPONENTREGISTRAR_IID = - new nsID(NS_ICOMPONENTREGISTRAR_IID_STR); - - public nsIComponentRegistrar(int /*long*/ address) { - super(address); - } +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIFile; +import dwt.internal.mozilla.nsIFactory; +import dwt.internal.mozilla.nsISimpleEnumerator; - public int AutoRegister(int /*long*/ aSpec) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aSpec); - } - - public int AutoUnregister(int /*long*/ aSpec) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aSpec); - } +const char[] NS_ICOMPONENTREGISTRAR_IID_STR = "2417cbfe-65ad-48a6-b4b6-eb84db174392"; - public int RegisterFactory(nsID aClass, byte[] aClassName, byte[] aContractID, int /*long*/ aFactory) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aClass, aClassName, aContractID, aFactory); - } - - public int UnregisterFactory(nsID aClass, int /*long*/ aFactory) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aClass, aFactory); - } +const nsIID NS_ICOMPONENTREGISTRAR_IID= + {0x2417cbfe, 0x65ad, 0x48a6, + [ 0xb4, 0xb6, 0xeb, 0x84, 0xdb, 0x17, 0x43, 0x92 ]}; - public int RegisterFactoryLocation(nsID aClass, byte[] aClassName, byte[] aContractID, int /*long*/ aFile, byte[] aLoaderStr, byte[] aType) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aClass, aClassName, aContractID, aFile, aLoaderStr, aType); - } - - public int UnregisterFactoryLocation(nsID aClass, int /*long*/ aFile) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aClass, aFile); - } - - public int IsCIDRegistered(nsID aClass, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aClass, _retval); - } - - public int IsContractIDRegistered(byte[] aContractID, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aContractID, _retval); - } +interface nsIComponentRegistrar : nsISupports { + static const char[] IID_STR = NS_ICOMPONENTREGISTRAR_IID_STR; + static const nsIID IID = NS_ICOMPONENTREGISTRAR_IID; - public int EnumerateCIDs(int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), _retval); - } - - public int EnumerateContractIDs(int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), _retval); - } +extern(System): + nsresult AutoRegister(nsIFile aSpec); + nsresult AutoUnregister(nsIFile aSpec); + nsresult RegisterFactory(nsCID * aClass, char *aClassName, char *aContractID, nsIFactory aFactory); + nsresult UnregisterFactory(nsCID * aClass, nsIFactory aFactory); + nsresult RegisterFactoryLocation(nsCID * aClass, char *aClassName, char *aContractID, nsIFile aFile, char *aLoaderStr, char *aType); + nsresult UnregisterFactoryLocation(nsCID * aClass, nsIFile aFile); + nsresult IsCIDRegistered(nsCID * aClass, PRBool *_retval); + nsresult IsContractIDRegistered(char *aContractID, PRBool *_retval); + nsresult EnumerateCIDs(nsISimpleEnumerator *_retval); + nsresult EnumerateContractIDs(nsISimpleEnumerator *_retval); + nsresult CIDToContractID(nsCID * aClass, char **_retval); + nsresult ContractIDToCID(char *aContractID, nsCID * *_retval); +} - public int CIDToContractID(nsID aClass, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 11, getAddress(), aClass, _retval); - } - - public int ContractIDToCID(byte[] aContractID, int /*long*/ _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 12, getAddress(), aContractID, _retval); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIContentViewer.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,74 @@ +module dwt.internal.mozilla.nsIContentViewer; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIDOMDocument; +import dwt.internal.mozilla.nsISHEntry; + +/****************************************************************************** + +******************************************************************************/ + +const char[] NS_ICONTENTVIEWER_IID_STR = "6a7ddb40-8a9e-4576-8ad1-71c5641d8780"; + +const nsIID NS_ICONTENTVIEWER_IID= + {0x6a7ddb40, 0x8a9e, 0x4576, + [ 0x8a, 0xd1, 0x71, 0xc5, 0x64, 0x1d, 0x87, 0x80 ]}; + +interface nsIContentViewer : nsISupports { + + static const char[] IID_STR = NS_ICONTENTVIEWER_IID_STR; + static const nsIID IID = NS_ICONTENTVIEWER_IID; + +extern(System): + nsresult Init(nsIWidget * aParentWidget, nsIDeviceContext * aDeviceContext, nsRect * aBounds); + nsresult GetContainer(nsISupports *aContainer); + nsresult SetContainer(nsISupports aContainer); + nsresult LoadStart(nsISupports aDoc); + nsresult LoadComplete(PRUint32 aStatus); + nsresult PermitUnload(PRBool *_retval); + nsresult PageHide(PRBool isUnload); + nsresult Close(nsISHEntry historyEntry); + nsresult Destroy(); + nsresult Stop(); + nsresult GetDOMDocument(nsIDOMDocument *aDOMDocument); + nsresult SetDOMDocument(nsIDOMDocument aDOMDocument); + nsresult GetBounds(nsRect * aBounds); + nsresult SetBounds(nsRect * aBounds); + nsresult GetPreviousViewer(nsIContentViewer *aPreviousViewer); + nsresult SetPreviousViewer(nsIContentViewer aPreviousViewer); + nsresult Move(PRInt32 aX, PRInt32 aY); + nsresult Show(); + nsresult Hide(); + nsresult GetEnableRendering(PRBool *aEnableRendering); + nsresult SetEnableRendering(PRBool aEnableRendering); + nsresult GetSticky(PRBool *aSticky); + nsresult SetSticky(PRBool aSticky); + nsresult RequestWindowClose(PRBool *_retval); + nsresult Open(nsISupports aState); + nsresult ClearHistoryEntry(); + +} + +/****************************************************************************** + +******************************************************************************/ + +const char[] NS_ICONTENTVIEWER_MOZILLA_1_8_BRANCH_IID_STR = "51341ed4-a3bf-4fd5-ae17-5fd3ec59dcab"; + +const nsIID NS_ICONTENTVIEWER_MOZILLA_1_8_BRANCH_IID= + {0x51341ed4, 0xa3bf, 0x4fd5, + [ 0xae, 0x17, 0x5f, 0xd3, 0xec, 0x59, 0xdc, 0xab ]}; + +interface nsIContentViewer_MOZILLA_1_8_BRANCH : nsISupports { + + static const char[] IID_STR = NS_ICONTENTVIEWER_MOZILLA_1_8_BRANCH_IID_STR; + static const nsIID IID = NS_ICONTENTVIEWER_MOZILLA_1_8_BRANCH_IID; + +extern(System): + nsresult OpenWithEntry(nsISupports aState, nsISHEntry aSHEntry); + +} +
--- a/dwt/internal/mozilla/nsIContextMenuListener.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIContextMenuListener.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,61 +1,30 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2005 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIContextMenuListener; -import dwt.dwthelper.utils; - -public class nsIContextMenuListener extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 1; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIDOMEvent; +import dwt.internal.mozilla.nsIDOMNode; - public static final String NS_ICONTEXTMENULISTENER_IID_STR = - "3478b6b0-3875-11d4-94ef-0020183bf181"; +const char[] NS_ICONTEXTMENULISTENER_IID_STR = "3478b6b0-3875-11d4-94ef-0020183bf181"; - public static final nsID NS_ICONTEXTMENULISTENER_IID = - new nsID(NS_ICONTEXTMENULISTENER_IID_STR); +const nsIID NS_ICONTEXTMENULISTENER_IID= + {0x3478b6b0, 0x3875, 0x11d4, + [ 0x94, 0xef, 0x00, 0x20, 0x18, 0x3b, 0xf1, 0x81 ]}; - public nsIContextMenuListener(int /*long*/ address) { - super(address); - } +interface nsIContextMenuListener : nsISupports { - public static final int CONTEXT_NONE = 0; - - public static final int CONTEXT_LINK = 1; - - public static final int CONTEXT_IMAGE = 2; - - public static final int CONTEXT_DOCUMENT = 4; + static const char[] IID_STR = NS_ICONTEXTMENULISTENER_IID_STR; + static const nsIID IID = NS_ICONTEXTMENULISTENER_IID; - public static final int CONTEXT_TEXT = 8; - - public static final int CONTEXT_INPUT = 16; +extern(System): + enum { CONTEXT_NONE = 0U }; + enum { CONTEXT_LINK = 1U }; + enum { CONTEXT_IMAGE = 2U }; + enum { CONTEXT_DOCUMENT = 4U }; + enum { CONTEXT_TEXT = 8U }; + enum { CONTEXT_INPUT = 16U }; - public int OnShowContextMenu(int aContextFlags, int /*long*/ aEvent, int /*long*/ aNode) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aContextFlags, aEvent, aNode); - } + nsresult OnShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent aEvent, nsIDOMNode aNode); } +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIContextMenuListener2.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,59 @@ +module dwt.internal.mozilla.nsIContextMenuListener2; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIDOMEvent; +import dwt.internal.mozilla.nsIDOMNode; +import dwt.internal.mozilla.imgIContainer; +import dwt.internal.mozilla.nsIURI; +import dwt.internal.mozilla.nsStringAPI; + +const char[] NS_ICONTEXTMENULISTENER2_IID_STR = "7fb719b3-d804-4964-9596-77cf924ee314"; + +const nsIID NS_ICONTEXTMENULISTENER2_IID= + {0x7fb719b3, 0xd804, 0x4964, + [ 0x95, 0x96, 0x77, 0xcf, 0x92, 0x4e, 0xe3, 0x14 ]}; + +interface nsIContextMenuListener2 : nsISupports { + + static const char[] IID_STR = NS_ICONTEXTMENULISTENER2_IID_STR; + static const nsIID IID = NS_ICONTEXTMENULISTENER2_IID; + + enum { CONTEXT_NONE = 0U }; + enum { CONTEXT_LINK = 1U }; + enum { CONTEXT_IMAGE = 2U }; + enum { CONTEXT_DOCUMENT = 4U }; + enum { CONTEXT_TEXT = 8U }; + enum { CONTEXT_INPUT = 16U }; + enum { CONTEXT_BACKGROUND_IMAGE = 32U }; + +extern(System): + nsresult OnShowContextMenu(PRUint32 aContextFlags, nsIContextMenuInfo aUtils); +} + +/****************************************************************************** + +******************************************************************************/ + +const char[] NS_ICONTEXTMENUINFO_IID_STR = "2f977d56-5485-11d4-87e2-0010a4e75ef2"; + +const nsIID NS_ICONTEXTMENUINFO_IID= + {0x2f977d56, 0x5485, 0x11d4, + [ 0x87, 0xe2, 0x00, 0x10, 0xa4, 0xe7, 0x5e, 0xf2 ]}; + +interface nsIContextMenuInfo : nsISupports { + + static const char[] IID_STR = NS_ICONTEXTMENUINFO_IID_STR; + static const nsIID IID = NS_ICONTEXTMENUINFO_IID; + +extern(System): + nsresult GetMouseEvent(nsIDOMEvent *aMouseEvent); + nsresult GetTargetNode(nsIDOMNode *aTargetNode); + nsresult GetAssociatedLink(nsAString * aAssociatedLink); + nsresult GetImageContainer(imgIContainer *aImageContainer); + nsresult GetImageSrc(nsIURI *aImageSrc); + nsresult GetBackgroundImageContainer(imgIContainer *aBackgroundImageContainer); + nsresult GetBackgroundImageSrc(nsIURI *aBackgroundImageSrc); +} +
--- a/dwt/internal/mozilla/nsICookie.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsICookie.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,103 +1,48 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsICookie; -import dwt.dwthelper.utils; - -public class nsICookie extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 9; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsStringAPI; - public static final String NS_ICOOKIE_IID_STR = - "e9fcb9a4-d376-458f-b720-e65e7df593bc"; - - public static final nsID NS_ICOOKIE_IID = - new nsID(NS_ICOOKIE_IID_STR); - - public nsICookie(int /*long*/ address) { - super(address); - } +alias PRInt32 nsCookieStatus; +alias PRInt32 nsCookiePolicy; - public int GetName(int /*long*/ aName) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aName); - } - - public int GetValue(int /*long*/ aValue) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aValue); - } +const char[] NS_ICOOKIE_IID_STR = "e9fcb9a4-d376-458f-b720-e65e7df593bc"; - public int GetIsDomain(int[] aIsDomain) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aIsDomain); - } +const nsIID NS_ICOOKIE_IID= + {0xe9fcb9a4, 0xd376, 0x458f, + [ 0xb7, 0x20, 0xe6, 0x5e, 0x7d, 0xf5, 0x93, 0xbc ]}; - public int GetHost(int /*long*/ aHost) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aHost); - } +interface nsICookie : nsISupports { - public int GetPath(int /*long*/ aPath) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aPath); - } + static const char[] IID_STR = NS_ICOOKIE_IID_STR; + static const nsIID IID = NS_ICOOKIE_IID; - public int GetIsSecure(int[] aIsSecure) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aIsSecure); - } - - public int GetExpires(long[] aExpires) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aExpires); - } - - public static final int STATUS_UNKNOWN = 0; - - public static final int STATUS_ACCEPTED = 1; - - public static final int STATUS_DOWNGRADED = 2; - - public static final int STATUS_FLAGGED = 3; - - public static final int STATUS_REJECTED = 4; +extern(System): + nsresult GetName(nsACString * aName); + nsresult GetValue(nsACString * aValue); + nsresult GetIsDomain(PRBool *aIsDomain); + nsresult GetHost(nsACString * aHost); + nsresult GetPath(nsACString * aPath); + nsresult GetIsSecure(PRBool *aIsSecure); + nsresult GetExpires(PRUint64 *aExpires); - public int GetStatus(int /*long*/ aStatus) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aStatus); - } + enum { STATUS_UNKNOWN = 0 }; + enum { STATUS_ACCEPTED = 1 }; + enum { STATUS_DOWNGRADED = 2 }; + enum { STATUS_FLAGGED = 3 }; + enum { STATUS_REJECTED = 4 }; - public static final int POLICY_UNKNOWN = 0; - - public static final int POLICY_NONE = 1; - - public static final int POLICY_NO_CONSENT = 2; + nsresult GetStatus(nsCookieStatus *aStatus); - public static final int POLICY_IMPLICIT_CONSENT = 3; - - public static final int POLICY_EXPLICIT_CONSENT = 4; + enum { POLICY_UNKNOWN = 0 }; + enum { POLICY_NONE = 1 }; + enum { POLICY_NO_CONSENT = 2 }; + enum { POLICY_IMPLICIT_CONSENT = 3 }; + enum { POLICY_EXPLICIT_CONSENT = 4 }; + enum { POLICY_NO_II = 5 }; - public static final int POLICY_NO_II = 5; + nsresult GetPolicy(nsCookiePolicy *aPolicy); +} - public int GetPolicy(int /*long*/ aPolicy) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aPolicy); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsICookie2.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,24 @@ +module dwt.internal.mozilla.nsICookie2; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsICookie; +import dwt.internal.mozilla.nsStringAPI; + +const char[] NS_ICOOKIE2_IID_STR = "d3493503-7854-46ed-8284-8af54a847efb"; + +const nsIID NS_ICOOKIE2_IID= + {0xd3493503, 0x7854, 0x46ed, + [ 0x82, 0x84, 0x8a, 0xf5, 0x4a, 0x84, 0x7e, 0xfb ]}; + +interface nsICookie2 : nsICookie { + + static const char[] IID_STR = NS_ICOOKIE2_IID_STR; + static const nsIID IID = NS_ICOOKIE2_IID; + +extern(System): + nsresult GetRawHost(nsACString * aRawHost); + nsresult GetIsSession(PRBool *aIsSession); + nsresult GetExpiry(PRInt64 *aExpiry); +} +
--- a/dwt/internal/mozilla/nsICookieManager.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsICookieManager.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,57 +1,26 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsICookieManager; -import dwt.dwthelper.utils; - -public class nsICookieManager extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 3; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsISimpleEnumerator; +import dwt.internal.mozilla.nsStringAPI; - public static final String NS_ICOOKIEMANAGER_IID_STR = - "aaab6710-0f2c-11d5-a53b-0010a401eb10"; +const char[] NS_ICOOKIEMANAGER_IID_STR = "aaab6710-0f2c-11d5-a53b-0010a401eb10"; - public static final nsID NS_ICOOKIEMANAGER_IID = - new nsID(NS_ICOOKIEMANAGER_IID_STR); +const nsIID NS_ICOOKIEMANAGER_IID= + {0xaaab6710, 0x0f2c, 0x11d5, + [ 0xa5, 0x3b, 0x00, 0x10, 0xa4, 0x01, 0xeb, 0x10 ]}; - public nsICookieManager(int /*long*/ address) { - super(address); - } +interface nsICookieManager : nsISupports { - public int RemoveAll() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress()); - } + static const char[] IID_STR = NS_ICOOKIEMANAGER_IID_STR; + static const nsIID IID = NS_ICOOKIEMANAGER_IID; - public int GetEnumerator(int /*long*/[] aEnumerator) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aEnumerator); - } +extern(System): + nsresult RemoveAll(); + nsresult GetEnumerator(nsISimpleEnumerator *aEnumerator); + nsresult Remove(nsACString * aDomain, nsACString * aName, nsACString * aPath, PRBool aBlocked); - public int Remove(int /*long*/ aDomain, int /*long*/ aName, int /*long*/ aPath, int aBlocked) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aDomain, aName, aPath, aBlocked); - } } +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsICookieManager2.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,24 @@ +module dwt.internal.mozilla.nsICookieManager2; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsICookieManager; +import dwt.internal.mozilla.nsICookie2; +import dwt.internal.mozilla.nsStringAPI; + +const char[] NS_ICOOKIEMANAGER2_IID_STR = "3e73ff5f-154e-494f-b640-3c654ba2cc2b"; + +const nsIID NS_ICOOKIEMANAGER2_IID= + {0x3e73ff5f, 0x154e, 0x494f, + [ 0xb6, 0x40, 0x3c, 0x65, 0x4b, 0xa2, 0xcc, 0x2b ]}; + +interface nsICookieManager2 : nsICookieManager { + + static const char[] IID_STR = NS_ICOOKIEMANAGER2_IID_STR; + static const nsIID IID = NS_ICOOKIEMANAGER2_IID; + +extern(System): + nsresult Add(nsACString * aDomain, nsACString * aPath, nsACString * aName, nsACString * aValue, PRBool aSecure, PRBool aIsSession, PRInt64 aExpiry); + nsresult FindMatchingCookie(nsICookie2 aCookie, PRUint32 *aCountFromHost, PRBool *_retval); +} +
--- a/dwt/internal/mozilla/nsID.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsID.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,79 +1,46 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2004 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.Common; import dwt.dwthelper.utils; -/** @jniclass flags=cpp */ -public class nsID { - - public int m0; - public short m1; - public short m2; - public byte[] m3 = new byte[8]; - public static final int sizeof = 16; +align(1) +struct nsID +{ + PRUint32 m0; + PRUint16 m1; + PRUint16 m2; + PRUint8[8] m3; -public nsID() { -} + static nsID opCall(String aIDStr) + { + nsID id; + if(aIDStr == null) throw new ParseException(); + int i = 0; + with(id) { + for (; i < 8; i++) m0 = (m0 << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16); + if (aIDStr.charAt (i) != '-') throw new ParseException (); + i++; + for (; i < 13; i++) m1 = cast(short)((m1 << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16)); + if (aIDStr.charAt (i) != '-') throw new ParseException (); + i++; + for (; i < 18; i++) m2 = cast(short)((m2 << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16)); + if (aIDStr.charAt (i) != '-') throw new ParseException (); + i++; + for (; i < 21; i++) m3[0] = cast(byte)((m3[0] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16)); + for (; i < 23; i++) m3[1] = cast(byte)((m3[1] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16)); + if (aIDStr.charAt (i) != '-') throw new ParseException (); + i++; + for (; i < 26; i++) m3[2] = cast(byte)((m3[2] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16)); + for (; i < 28; i++) m3[3] = cast(byte)((m3[3] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16)); + for (; i < 30; i++) m3[4] = cast(byte)((m3[4] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16)); + for (; i < 32; i++) m3[5] = cast(byte)((m3[5] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16)); + for (; i < 34; i++) m3[6] = cast(byte)((m3[6] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16)); + for (; i < 36; i++) m3[7] = cast(byte)((m3[7] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16)); + } + return id; + } -public nsID(String id) { - Parse(id); } -public bool Equals(nsID other) { - int /*long*/ ptr = XPCOM.nsID_new (); - XPCOM.memmove (ptr, this, nsID.sizeof); - int /*long*/ otherPtr = XPCOM.nsID_new (); - XPCOM.memmove (otherPtr, other, nsID.sizeof); - bool result = XPCOM.nsID_Equals (ptr, otherPtr) !is 0; - XPCOM.nsID_delete (ptr); - XPCOM.nsID_delete (otherPtr); - return result; -} - -public void Parse (String aIDStr) { - if (aIDStr is 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++) !is '-') throw new Error (); - for (; i < 13; i++) m1 = (short)((m1 << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16)); - if (aIDStr.charAt (i++) !is '-') throw new Error (); - for (; i < 18; i++) m2 = (short)((m2 << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16)); - if (aIDStr.charAt (i++) !is '-') 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++) !is '-') 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)); -} - -} +alias nsID nsCID; +alias nsID nsIID;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMAbstractView.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,26 @@ +module dwt.internal.mozilla.nsIDOMAbstractView; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIDOMDocumentView; + +alias PRUint64 DOMTimeStamp; + +const char[] NS_IDOMABSTRACTVIEW_IID_STR = "f51ebade-8b1a-11d3-aae7-0010830123b4"; + +const nsIID NS_IDOMABSTRACTVIEW_IID= + {0xf51ebade, 0x8b1a, 0x11d3, + [ 0xaa, 0xe7, 0x00, 0x10, 0x83, 0x01, 0x23, 0xb4 ]}; + +interface nsIDOMAbstractView : nsISupports { + + static const char[] IID_STR = NS_IDOMABSTRACTVIEW_IID_STR; + static const nsIID IID = NS_IDOMABSTRACTVIEW_IID; + +extern(System): + nsresult GetDocument(nsIDOMDocumentView *aDocument); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMAttr.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,28 @@ +module dwt.internal.mozilla.nsIDOMAttr; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsIDOMNode; +import dwt.internal.mozilla.nsIDOMElement; +import dwt.internal.mozilla.nsStringAPI; + +const char[] NS_IDOMATTR_IID_STR = "a6cf9070-15b3-11d2-932e-00805f8add32"; + +const nsIID NS_IDOMATTR_IID= + {0xa6cf9070, 0x15b3, 0x11d2, + [ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 ]}; + +interface nsIDOMAttr : nsIDOMNode { + + static const char[] IID_STR = NS_IDOMATTR_IID_STR; + static const nsIID IID = NS_IDOMATTR_IID; + +extern(System): + nsresult GetName(nsAString * aName); + nsresult GetSpecified(PRBool *aSpecified); + nsresult GetValue(nsAString * aValue); + nsresult SetValue(nsAString * aValue); + nsresult GetOwnerElement(nsIDOMElement *aOwnerElement); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMBarProp.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,25 @@ +module dwt.internal.mozilla.nsIDOMBarProp; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +alias PRUint64 DOMTimeStamp; + +const char[] NS_IDOMBARPROP_IID_STR = "9eb2c150-1d56-11d3-8221-0060083a0bcf"; + +const nsIID NS_IDOMBARPROP_IID= + {0x9eb2c150, 0x1d56, 0x11d3, + [ 0x82, 0x21, 0x00, 0x60, 0x08, 0x3a, 0x0b, 0xcf ]}; + +interface nsIDOMBarProp : nsISupports { + + static const char[] IID_STR = NS_IDOMBARPROP_IID_STR; + static const nsIID IID = NS_IDOMBARPROP_IID; + +extern(System): + nsresult GetVisible(PRBool *aVisible); + nsresult SetVisible(PRBool aVisible); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMCDATASection.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,21 @@ +module dwt.internal.mozilla.nsIDOMCDATASection; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; + +import dwt.internal.mozilla.nsIDOMText; + +const char[] NS_IDOMCDATASECTION_IID_STR = "a6cf9071-15b3-11d2-932e-00805f8add32"; + +const nsIID NS_IDOMCDATASECTION_IID= + {0xa6cf9071, 0x15b3, 0x11d2, + [ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 ]}; + +interface nsIDOMCDATASection : nsIDOMText { + +extern(System): + static const char[] IID_STR = NS_IDOMCDATASECTION_IID_STR; + static const nsIID IID = NS_IDOMCDATASECTION_IID; + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMCharacterData.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,31 @@ +module dwt.internal.mozilla.nsIDOMCharacterData; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; + +import dwt.internal.mozilla.nsIDOMNode; +import dwt.internal.mozilla.nsStringAPI; + +const char[] NS_IDOMCHARACTERDATA_IID_STR = "a6cf9072-15b3-11d2-932e-00805f8add32"; + +const nsIID NS_IDOMCHARACTERDATA_IID= + {0xa6cf9072, 0x15b3, 0x11d2, + [ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 ]}; + +interface nsIDOMCharacterData : nsIDOMNode { + + static const char[] IID_STR = NS_IDOMCHARACTERDATA_IID_STR; + static const nsIID IID = NS_IDOMCHARACTERDATA_IID; + +extern(System): + nsresult GetData(nsAString * aData); + nsresult SetData(nsAString * aData); + nsresult GetLength(PRUint32 *aLength); + nsresult SubstringData(PRUint32 offset, PRUint32 count, nsAString * _retval); + nsresult AppendData(nsAString * arg); + nsresult InsertData(PRUint32 offset, nsAString * arg); + nsresult DeleteData(PRUint32 offset, PRUint32 count); + nsresult ReplaceData(PRUint32 offset, PRUint32 count, nsAString * arg); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMComment.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,21 @@ +module dwt.internal.mozilla.nsIDOMComment; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; + +import dwt.internal.mozilla.nsIDOMCharacterData; + +const char[] NS_IDOMCOMMENT_IID_STR = "a6cf9073-15b3-11d2-932e-00805f8add32"; + +const nsIID NS_IDOMCOMMENT_IID= + {0xa6cf9073, 0x15b3, 0x11d2, + [ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 ]}; + +interface nsIDOMComment : nsIDOMCharacterData { + +extern(System): + static const char[] IID_STR = NS_IDOMCOMMENT_IID_STR; + static const nsIID IID = NS_IDOMCOMMENT_IID; + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMDOMImplementation.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,28 @@ +module dwt.internal.mozilla.nsIDOMDOMImplementation; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIDOMDocumentType; +import dwt.internal.mozilla.nsIDOMDocument; +import dwt.internal.mozilla.nsStringAPI; + +const char[] NS_IDOMDOMIMPLEMENTATION_IID_STR = "a6cf9074-15b3-11d2-932e-00805f8add32"; + +const nsIID NS_IDOMDOMIMPLEMENTATION_IID= + {0xa6cf9074, 0x15b3, 0x11d2, + [ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 ]}; + +interface nsIDOMDOMImplementation : nsISupports { + + static const char[] IID_STR = NS_IDOMDOMIMPLEMENTATION_IID_STR; + static const nsIID IID = NS_IDOMDOMIMPLEMENTATION_IID; + +extern(System): + nsresult HasFeature(nsAString * feature, nsAString * version_, PRBool *_retval); + nsresult CreateDocumentType(nsAString * qualifiedName, nsAString * publicId, nsAString * systemId, nsIDOMDocumentType *_retval); + nsresult CreateDocument(nsAString * namespaceURI, nsAString * qualifiedName, nsIDOMDocumentType doctype, nsIDOMDocument *_retval); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMDocument.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,52 @@ +module dwt.internal.mozilla.nsIDOMDocument; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsIDOMNode; +import dwt.internal.mozilla.nsStringAPI; + +import dwt.internal.mozilla.nsIDOMNode; +import dwt.internal.mozilla.nsIDOMNodeList; +import dwt.internal.mozilla.nsIDOMDocumentType; +import dwt.internal.mozilla.nsIDOMElement; +import dwt.internal.mozilla.nsIDOMDocumentFragment; +import dwt.internal.mozilla.nsIDOMText; +import dwt.internal.mozilla.nsIDOMComment; +import dwt.internal.mozilla.nsIDOMCDATASection; +import dwt.internal.mozilla.nsIDOMProcessingInstruction; +import dwt.internal.mozilla.nsIDOMDOMImplementation; +import dwt.internal.mozilla.nsIDOMAttr; +import dwt.internal.mozilla.nsIDOMEntityReference; + +const char[] NS_IDOMDOCUMENT_IID_STR = "a6cf9075-15b3-11d2-932e-00805f8add32"; + +const nsIID NS_IDOMDOCUMENT_IID= + {0xa6cf9075, 0x15b3, 0x11d2, + [ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 ]}; + +interface nsIDOMDocument : nsIDOMNode { + + static const char[] IID_STR = NS_IDOMDOCUMENT_IID_STR; + static const nsIID IID = NS_IDOMDOCUMENT_IID; + +extern(System): + nsresult GetDoctype(nsIDOMDocumentType *aDoctype); + nsresult GetImplementation(nsIDOMDOMImplementation *aImplementation); + nsresult GetDocumentElement(nsIDOMElement *aDocumentElement); + nsresult CreateElement(nsAString * tagName, nsIDOMElement *_retval); + nsresult CreateDocumentFragment(nsIDOMDocumentFragment *_retval); + nsresult CreateTextNode(nsAString * data, nsIDOMText *_retval); + nsresult CreateComment(nsAString * data, nsIDOMComment *_retval); + nsresult CreateCDATASection(nsAString * data, nsIDOMCDATASection *_retval); + nsresult CreateProcessingInstruction(nsAString * target, nsAString * data, nsIDOMProcessingInstruction *_retval); + nsresult CreateAttribute(nsAString * name, nsIDOMAttr *_retval); + nsresult CreateEntityReference(nsAString * name, nsIDOMEntityReference *_retval); + nsresult GetElementsByTagName(nsAString * tagname, nsIDOMNodeList *_retval); + nsresult ImportNode(nsIDOMNode importedNode, PRBool deep, nsIDOMNode *_retval); + nsresult CreateElementNS(nsAString * namespaceURI, nsAString * qualifiedName, nsIDOMElement *_retval); + nsresult CreateAttributeNS(nsAString * namespaceURI, nsAString * qualifiedName, nsIDOMAttr *_retval); + nsresult GetElementsByTagNameNS(nsAString * namespaceURI, nsAString * localName, nsIDOMNodeList *_retval); + nsresult GetElementById(nsAString * elementId, nsIDOMElement *_retval); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMDocumentFragment.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,20 @@ +module dwt.internal.mozilla.nsIDOMDocumentFragment; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; + +import dwt.internal.mozilla.nsIDOMNode; + +const char[] NS_IDOMDOCUMENTFRAGMENT_IID_STR = "a6cf9076-15b3-11d2-932e-00805f8add32"; + +const nsIID NS_IDOMDOCUMENTFRAGMENT_IID= + {0xa6cf9076, 0x15b3, 0x11d2, + [ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 ]}; + +interface nsIDOMDocumentFragment : nsIDOMNode { + static const char[] IID_STR = NS_IDOMDOCUMENTFRAGMENT_IID_STR; + static const nsIID IID = NS_IDOMDOCUMENTFRAGMENT_IID; + +extern(System): +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMDocumentType.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,30 @@ +module dwt.internal.mozilla.nsIDOMDocumentType; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; + +import dwt.internal.mozilla.nsIDOMNode; +import dwt.internal.mozilla.nsIDOMNamedNodeMap; +import dwt.internal.mozilla.nsStringAPI; + +const char[] NS_IDOMDOCUMENTTYPE_IID_STR = "a6cf9077-15b3-11d2-932e-00805f8add32"; + +const nsIID NS_IDOMDOCUMENTTYPE_IID= + {0xa6cf9077, 0x15b3, 0x11d2, + [ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 ]}; + +interface nsIDOMDocumentType : nsIDOMNode { + + static const char[] IID_STR = NS_IDOMDOCUMENTTYPE_IID_STR; + static const nsIID IID = NS_IDOMDOCUMENTTYPE_IID; + +extern(System): + nsresult GetName(nsAString * aName); + nsresult GetEntities(nsIDOMNamedNodeMap *aEntities); + nsresult GetNotations(nsIDOMNamedNodeMap *aNotations); + nsresult GetPublicId(nsAString * aPublicId); + nsresult GetSystemId(nsAString * aSystemId); + nsresult GetInternalSubset(nsAString * aInternalSubset); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMDocumentView.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,26 @@ +module dwt.internal.mozilla.nsIDOMDocumentView; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIDOMAbstractView; + +alias PRUint64 DOMTimeStamp; + +const char[] NS_IDOMDOCUMENTVIEW_IID_STR = "1acdb2ba-1dd2-11b2-95bc-9542495d2569"; + +const nsIID NS_IDOMDOCUMENTVIEW_IID= + {0x1acdb2ba, 0x1dd2, 0x11b2, + [ 0x95, 0xbc, 0x95, 0x42, 0x49, 0x5d, 0x25, 0x69 ]}; + +interface nsIDOMDocumentView : nsISupports { + + static const char[] IID_STR = NS_IDOMDOCUMENTVIEW_IID_STR; + static const nsIID IID = NS_IDOMDOCUMENTVIEW_IID; + +extern(System): + nsresult GetDefaultView(nsIDOMAbstractView *aDefaultView); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMElement.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,41 @@ +module dwt.internal.mozilla.nsIDOMElement; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; + +import dwt.internal.mozilla.nsIDOMNode; +import dwt.internal.mozilla.nsIDOMNodeList; +import dwt.internal.mozilla.nsIDOMAttr; +import dwt.internal.mozilla.nsStringAPI; + +const char[] NS_IDOMELEMENT_IID_STR = "a6cf9078-15b3-11d2-932e-00805f8add32"; + +const nsIID NS_IDOMELEMENT_IID= + {0xa6cf9078, 0x15b3, 0x11d2, + [ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 ]}; + +interface nsIDOMElement : nsIDOMNode { + + static const char[] IID_STR = NS_IDOMELEMENT_IID_STR; + static const nsIID IID = NS_IDOMELEMENT_IID; + +extern(System): + nsresult GetTagName(nsAString * aTagName); + nsresult GetAttribute(nsAString * name, nsAString * _retval); + nsresult SetAttribute(nsAString * name, nsAString * value); + nsresult RemoveAttribute(nsAString * name); + nsresult GetAttributeNode(nsAString * name, nsIDOMAttr *_retval); + nsresult SetAttributeNode(nsIDOMAttr newAttr, nsIDOMAttr *_retval); + nsresult RemoveAttributeNode(nsIDOMAttr oldAttr, nsIDOMAttr *_retval); + nsresult GetElementsByTagName(nsAString * name, nsIDOMNodeList *_retval); + nsresult GetAttributeNS(nsAString * namespaceURI, nsAString * localName, nsAString * _retval); + nsresult SetAttributeNS(nsAString * namespaceURI, nsAString * qualifiedName, nsAString * value); + nsresult RemoveAttributeNS(nsAString * namespaceURI, nsAString * localName); + nsresult GetAttributeNodeNS(nsAString * namespaceURI, nsAString * localName, nsIDOMAttr *_retval); + nsresult SetAttributeNodeNS(nsIDOMAttr newAttr, nsIDOMAttr *_retval); + nsresult GetElementsByTagNameNS(nsAString * namespaceURI, nsAString * localName, nsIDOMNodeList *_retval); + nsresult HasAttribute(nsAString * name, PRBool *_retval); + nsresult HasAttributeNS(nsAString * namespaceURI, nsAString * localName, PRBool *_retval); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMEntityReference.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,21 @@ +module dwt.internal.mozilla.nsIDOMEntityReference; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; + +import dwt.internal.mozilla.nsIDOMNode; + +const char[] NS_IDOMENTITYREFERENCE_IID_STR = "a6cf907a-15b3-11d2-932e-00805f8add32"; + +const nsIID NS_IDOMENTITYREFERENCE_IID= + {0xa6cf907a, 0x15b3, 0x11d2, + [ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 ]}; + +interface nsIDOMEntityReference : nsIDOMNode { + + static const char[] IID_STR = NS_IDOMENTITYREFERENCE_IID_STR; + static const nsIID IID = NS_IDOMENTITYREFERENCE_IID; + +extern(System): +} +
--- a/dwt/internal/mozilla/nsIDOMEvent.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIDOMEvent.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,91 +1,39 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIDOMEvent; -import dwt.dwthelper.utils; - -public class nsIDOMEvent extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 10; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIDOMEventTarget; +import dwt.internal.mozilla.nsStringAPI; - public static final String NS_IDOMEVENT_IID_STR = - "a66b7b80-ff46-bd97-0080-5f8ae38add32"; - - public static final nsID NS_IDOMEVENT_IID = - new nsID(NS_IDOMEVENT_IID_STR); +alias PRUint64 DOMTimeStamp; - public nsIDOMEvent(int /*long*/ address) { - super(address); - } - - public static final int CAPTURING_PHASE = 1; - - public static final int AT_TARGET = 2; +const char[] NS_IDOMEVENT_IID_STR = "a66b7b80-ff46-bd97-0080-5f8ae38add32"; - public static final int BUBBLING_PHASE = 3; +const nsIID NS_IDOMEVENT_IID= + {0xa66b7b80, 0xff46, 0xbd97, + [ 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0x8a, 0xdd, 0x32 ]}; - public int GetType(int /*long*/ aType) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aType); - } +interface nsIDOMEvent : nsISupports { - public int GetTarget(int /*long*/[] aTarget) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aTarget); - } + static const char[] IID_STR = NS_IDOMEVENT_IID_STR; + static const nsIID IID = NS_IDOMEVENT_IID; - public int GetCurrentTarget(int /*long*/[] aCurrentTarget) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aCurrentTarget); - } - - public int GetEventPhase(short[] aEventPhase) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aEventPhase); - } - - public int GetBubbles(int[] aBubbles) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aBubbles); - } - - public int GetCancelable(int[] aCancelable) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aCancelable); - } +extern(System): + enum { CAPTURING_PHASE = 1U }; + enum { AT_TARGET = 2U }; + enum { BUBBLING_PHASE = 3U }; - public int GetTimeStamp(int /*long*/[] aTimeStamp) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aTimeStamp); - } - - public int StopPropagation() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress()); - } + nsresult GetType(nsAString * aType); + nsresult GetTarget(nsIDOMEventTarget *aTarget); + nsresult GetCurrentTarget(nsIDOMEventTarget *aCurrentTarget); + nsresult GetEventPhase(PRUint16 *aEventPhase); + nsresult GetBubbles(PRBool *aBubbles); + nsresult GetCancelable(PRBool *aCancelable); + nsresult GetTimeStamp(DOMTimeStamp *aTimeStamp); + nsresult StopPropagation(); + nsresult PreventDefault(); + nsresult InitEvent(nsAString * eventTypeArg, PRBool canBubbleArg, PRBool cancelableArg); - public int PreventDefault() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress()); - } +} - public int InitEvent(int /*long*/ eventTypeArg, int canBubbleArg, int cancelableArg) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), eventTypeArg, canBubbleArg, cancelableArg); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMEventGroup.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,24 @@ +module dwt.internal.mozilla.nsIDOMEventGroup; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +alias PRUint64 DOMTimeStamp; + +const char[] NS_IDOMEVENTGROUP_IID_STR = "33347bee-6620-4841-8152-36091ae80c7e"; + +const nsIID NS_IDOMEVENTGROUP_IID= + {0x33347bee, 0x6620, 0x4841, + [ 0x81, 0x52, 0x36, 0x09, 0x1a, 0xe8, 0x0c, 0x7e ]}; + +interface nsIDOMEventGroup : nsISupports { + + static const char[] IID_STR = NS_IDOMEVENTGROUP_IID_STR; + static const nsIID IID = NS_IDOMEVENTGROUP_IID; + +extern(System): + nsresult IsSameEventGroup(nsIDOMEventGroup other, PRBool *_retval); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMEventListener.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,23 @@ +module dwt.internal.mozilla.nsIDOMEventListener; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIDOMEvent; + +alias PRUint64 DOMTimeStamp; + +const char[] NS_IDOMEVENTLISTENER_IID_STR = "df31c120-ded6-11d1-bd85-00805f8ae3f4"; +const nsIID NS_IDOMEVENTLISTENER_IID= + {0xdf31c120, 0xded6, 0x11d1, + [ 0xbd, 0x85, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4 ]}; + +interface nsIDOMEventListener : nsISupports { + + static const char[] IID_STR = NS_IDOMEVENTLISTENER_IID_STR; + static const nsIID IID = NS_IDOMEVENTLISTENER_IID; + +extern(System): + nsresult HandleEvent(nsIDOMEvent event); +} +
--- a/dwt/internal/mozilla/nsIDOMEventTarget.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIDOMEventTarget.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,57 +1,31 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIDOMEventTarget; -import dwt.dwthelper.utils; - -public class nsIDOMEventTarget extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 3; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIDOMEvent; +import dwt.internal.mozilla.nsIDOMEventListener; +import dwt.internal.mozilla.nsStringAPI; - public static final String NS_IDOMEVENTTARGET_IID_STR = - "1c773b30-d1cf-11d2-bd95-00805f8ae3f4"; +alias PRUint64 DOMTimeStamp; + +const char[] NS_IDOMEVENTTARGET_IID_STR = "1c773b30-d1cf-11d2-bd95-00805f8ae3f4"; - public static final nsID NS_IDOMEVENTTARGET_IID = - new nsID(NS_IDOMEVENTTARGET_IID_STR); +const nsIID NS_IDOMEVENTTARGET_IID= + {0x1c773b30, 0xd1cf, 0x11d2, + [ 0xbd, 0x95, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4 ]}; - public nsIDOMEventTarget(int /*long*/ address) { - super(address); - } +//extern(System) - public int AddEventListener(int /*long*/ type, int /*long*/ listener, int useCapture) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), type, listener, useCapture); - } +interface nsIDOMEventTarget : nsISupports { + + static const char[] IID_STR = NS_IDOMEVENTTARGET_IID_STR; + static const nsIID IID = NS_IDOMEVENTTARGET_IID; - public int RemoveEventListener(int /*long*/ type, int /*long*/ listener, int useCapture) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), type, listener, useCapture); - } +extern(System): + nsresult AddEventListener(nsAString * type, nsIDOMEventListener listener, PRBool useCapture); + nsresult RemoveEventListener(nsAString * type, nsIDOMEventListener listener, PRBool useCapture); + nsresult DispatchEvent(nsIDOMEvent evt, PRBool *_retval); - public int DispatchEvent(int /*long*/ evt, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), evt, _retval); - } } +
--- a/dwt/internal/mozilla/nsIDOMKeyEvent.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIDOMKeyEvent.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,301 +1,148 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIDOMKeyEvent; -import dwt.dwthelper.utils; - -public class nsIDOMKeyEvent extends nsIDOMUIEvent { - - static final int LAST_METHOD_ID = nsIDOMUIEvent.LAST_METHOD_ID + 7; - - public static final String NS_IDOMKEYEVENT_IID_STR = - "028e0e6e-8b01-11d3-aae7-0010838a3123"; - - public static final nsID NS_IDOMKEYEVENT_IID = - new nsID(NS_IDOMKEYEVENT_IID_STR); - - public nsIDOMKeyEvent(int /*long*/ address) { - super(address); - } - - public static final int DOM_VK_CANCEL = 3; - - public static final int DOM_VK_HELP = 6; - - public static final int DOM_VK_BACK_SPACE = 8; - - public static final int DOM_VK_TAB = 9; - - public static final int DOM_VK_CLEAR = 12; - - public static final int DOM_VK_RETURN = 13; - - public static final int DOM_VK_ENTER = 14; - - public static final int DOM_VK_SHIFT = 16; - - public static final int DOM_VK_CONTROL = 17; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; - public static final int DOM_VK_ALT = 18; - - public static final int DOM_VK_PAUSE = 19; - - public static final int DOM_VK_CAPS_LOCK = 20; - - public static final int DOM_VK_ESCAPE = 27; - - public static final int DOM_VK_SPACE = 32; - - public static final int DOM_VK_PAGE_UP = 33; - - public static final int DOM_VK_PAGE_DOWN = 34; - - public static final int DOM_VK_END = 35; +import dwt.internal.mozilla.nsIDOMUIEvent; +import dwt.internal.mozilla.nsIDOMAbstractView; +import dwt.internal.mozilla.nsStringAPI; - public static final int DOM_VK_HOME = 36; - - public static final int DOM_VK_LEFT = 37; - - public static final int DOM_VK_UP = 38; - - public static final int DOM_VK_RIGHT = 39; - - public static final int DOM_VK_DOWN = 40; - - public static final int DOM_VK_PRINTSCREEN = 44; - - public static final int DOM_VK_INSERT = 45; - - public static final int DOM_VK_DELETE = 46; - - public static final int DOM_VK_0 = 48; +const char[] NS_IDOMKEYEVENT_IID_STR = "028e0e6e-8b01-11d3-aae7-0010838a3123"; - public static final int DOM_VK_1 = 49; - - public static final int DOM_VK_2 = 50; - - public static final int DOM_VK_3 = 51; - - public static final int DOM_VK_4 = 52; - - public static final int DOM_VK_5 = 53; - - public static final int DOM_VK_6 = 54; - - public static final int DOM_VK_7 = 55; - - public static final int DOM_VK_8 = 56; - - public static final int DOM_VK_9 = 57; - - public static final int DOM_VK_SEMICOLON = 59; - - public static final int DOM_VK_EQUALS = 61; - - public static final int DOM_VK_A = 65; - - public static final int DOM_VK_B = 66; - - public static final int DOM_VK_C = 67; - - public static final int DOM_VK_D = 68; - - public static final int DOM_VK_E = 69; - - public static final int DOM_VK_F = 70; +const nsIID NS_IDOMKEYEVENT_IID= + {0x028e0e6e, 0x8b01, 0x11d3, + [ 0xaa, 0xe7, 0x00, 0x10, 0x83, 0x8a, 0x31, 0x23 ]}; - public static final int DOM_VK_G = 71; - - public static final int DOM_VK_H = 72; - - public static final int DOM_VK_I = 73; - - public static final int DOM_VK_J = 74; - - public static final int DOM_VK_K = 75; - - public static final int DOM_VK_L = 76; - - public static final int DOM_VK_M = 77; - - public static final int DOM_VK_N = 78; +interface nsIDOMKeyEvent : nsIDOMUIEvent { - public static final int DOM_VK_O = 79; - - public static final int DOM_VK_P = 80; - - public static final int DOM_VK_Q = 81; - - public static final int DOM_VK_R = 82; - - public static final int DOM_VK_S = 83; - - public static final int DOM_VK_T = 84; - - public static final int DOM_VK_U = 85; - - public static final int DOM_VK_V = 86; - - public static final int DOM_VK_W = 87; + static const char[] IID_STR = NS_IDOMKEYEVENT_IID_STR; + static const nsIID IID = NS_IDOMKEYEVENT_IID; - public static final int DOM_VK_X = 88; - - public static final int DOM_VK_Y = 89; - - public static final int DOM_VK_Z = 90; - - public static final int DOM_VK_NUMPAD0 = 96; - - public static final int DOM_VK_NUMPAD1 = 97; - - public static final int DOM_VK_NUMPAD2 = 98; - - public static final int DOM_VK_NUMPAD3 = 99; - - public static final int DOM_VK_NUMPAD4 = 100; - - public static final int DOM_VK_NUMPAD5 = 101; - - public static final int DOM_VK_NUMPAD6 = 102; - - public static final int DOM_VK_NUMPAD7 = 103; - - public static final int DOM_VK_NUMPAD8 = 104; - - public static final int DOM_VK_NUMPAD9 = 105; - - public static final int DOM_VK_MULTIPLY = 106; - - public static final int DOM_VK_ADD = 107; - - public static final int DOM_VK_SEPARATOR = 108; - - public static final int DOM_VK_SUBTRACT = 109; - - public static final int DOM_VK_DECIMAL = 110; - - public static final int DOM_VK_DIVIDE = 111; - - public static final int DOM_VK_F1 = 112; - - public static final int DOM_VK_F2 = 113; - - public static final int DOM_VK_F3 = 114; - - public static final int DOM_VK_F4 = 115; - - public static final int DOM_VK_F5 = 116; - - public static final int DOM_VK_F6 = 117; - - public static final int DOM_VK_F7 = 118; - - public static final int DOM_VK_F8 = 119; - - public static final int DOM_VK_F9 = 120; - - public static final int DOM_VK_F10 = 121; - - public static final int DOM_VK_F11 = 122; - - public static final int DOM_VK_F12 = 123; - - public static final int DOM_VK_F13 = 124; - - public static final int DOM_VK_F14 = 125; - - public static final int DOM_VK_F15 = 126; +extern(System): + enum { DOM_VK_CANCEL = 3U }; + enum { DOM_VK_HELP = 6U }; + enum { DOM_VK_BACK_SPACE = 8U }; + enum { DOM_VK_TAB = 9U }; + enum { DOM_VK_CLEAR = 12U }; + enum { DOM_VK_RETURN = 13U }; + enum { DOM_VK_ENTER = 14U }; + enum { DOM_VK_SHIFT = 16U }; + enum { DOM_VK_CONTROL = 17U }; + enum { DOM_VK_ALT = 18U }; + enum { DOM_VK_PAUSE = 19U }; + enum { DOM_VK_CAPS_LOCK = 20U }; + enum { DOM_VK_ESCAPE = 27U }; + enum { DOM_VK_SPACE = 32U }; + enum { DOM_VK_PAGE_UP = 33U }; + enum { DOM_VK_PAGE_DOWN = 34U }; + enum { DOM_VK_END = 35U }; + enum { DOM_VK_HOME = 36U }; + enum { DOM_VK_LEFT = 37U }; + enum { DOM_VK_UP = 38U }; + enum { DOM_VK_RIGHT = 39U }; + enum { DOM_VK_DOWN = 40U }; + enum { DOM_VK_PRINTSCREEN = 44U }; + enum { DOM_VK_INSERT = 45U }; + enum { DOM_VK_DELETE = 46U }; + enum { DOM_VK_0 = 48U }; + enum { DOM_VK_1 = 49U }; + enum { DOM_VK_2 = 50U }; + enum { DOM_VK_3 = 51U }; + enum { DOM_VK_4 = 52U }; + enum { DOM_VK_5 = 53U }; + enum { DOM_VK_6 = 54U }; + enum { DOM_VK_7 = 55U }; + enum { DOM_VK_8 = 56U }; + enum { DOM_VK_9 = 57U }; + enum { DOM_VK_SEMICOLON = 59U }; + enum { DOM_VK_EQUALS = 61U }; + enum { DOM_VK_A = 65U }; + enum { DOM_VK_B = 66U }; + enum { DOM_VK_C = 67U }; + enum { DOM_VK_D = 68U }; + enum { DOM_VK_E = 69U }; + enum { DOM_VK_F = 70U }; + enum { DOM_VK_G = 71U }; + enum { DOM_VK_H = 72U }; + enum { DOM_VK_I = 73U }; + enum { DOM_VK_J = 74U }; + enum { DOM_VK_K = 75U }; + enum { DOM_VK_L = 76U }; + enum { DOM_VK_M = 77U }; + enum { DOM_VK_N = 78U }; + enum { DOM_VK_O = 79U }; + enum { DOM_VK_P = 80U }; + enum { DOM_VK_Q = 81U }; + enum { DOM_VK_R = 82U }; + enum { DOM_VK_S = 83U }; + enum { DOM_VK_T = 84U }; + enum { DOM_VK_U = 85U }; + enum { DOM_VK_V = 86U }; + enum { DOM_VK_W = 87U }; + enum { DOM_VK_X = 88U }; + enum { DOM_VK_Y = 89U }; + enum { DOM_VK_Z = 90U }; + enum { DOM_VK_CONTEXT_MENU = 93U }; + enum { DOM_VK_NUMPAD0 = 96U }; + enum { DOM_VK_NUMPAD1 = 97U }; + enum { DOM_VK_NUMPAD2 = 98U }; + enum { DOM_VK_NUMPAD3 = 99U }; + enum { DOM_VK_NUMPAD4 = 100U }; + enum { DOM_VK_NUMPAD5 = 101U }; + enum { DOM_VK_NUMPAD6 = 102U }; + enum { DOM_VK_NUMPAD7 = 103U }; + enum { DOM_VK_NUMPAD8 = 104U }; + enum { DOM_VK_NUMPAD9 = 105U }; + enum { DOM_VK_MULTIPLY = 106U }; + enum { DOM_VK_ADD = 107U }; + enum { DOM_VK_SEPARATOR = 108U }; + enum { DOM_VK_SUBTRACT = 109U }; + enum { DOM_VK_DECIMAL = 110U }; + enum { DOM_VK_DIVIDE = 111U }; + enum { DOM_VK_F1 = 112U }; + enum { DOM_VK_F2 = 113U }; + enum { DOM_VK_F3 = 114U }; + enum { DOM_VK_F4 = 115U }; + enum { DOM_VK_F5 = 116U }; + enum { DOM_VK_F6 = 117U }; + enum { DOM_VK_F7 = 118U }; + enum { DOM_VK_F8 = 119U }; + enum { DOM_VK_F9 = 120U }; + enum { DOM_VK_F10 = 121U }; + enum { DOM_VK_F11 = 122U }; + enum { DOM_VK_F12 = 123U }; + enum { DOM_VK_F13 = 124U }; + enum { DOM_VK_F14 = 125U }; + enum { DOM_VK_F15 = 126U }; + enum { DOM_VK_F16 = 127U }; + enum { DOM_VK_F17 = 128U }; + enum { DOM_VK_F18 = 129U }; + enum { DOM_VK_F19 = 130U }; + enum { DOM_VK_F20 = 131U }; + enum { DOM_VK_F21 = 132U }; + enum { DOM_VK_F22 = 133U }; + enum { DOM_VK_F23 = 134U }; + enum { DOM_VK_F24 = 135U }; + enum { DOM_VK_NUM_LOCK = 144U }; + enum { DOM_VK_SCROLL_LOCK = 145U }; + enum { DOM_VK_COMMA = 188U }; + enum { DOM_VK_PERIOD = 190U }; + enum { DOM_VK_SLASH = 191U }; + enum { DOM_VK_BACK_QUOTE = 192U }; + enum { DOM_VK_OPEN_BRACKET = 219U }; + enum { DOM_VK_BACK_SLASH = 220U }; + enum { DOM_VK_CLOSE_BRACKET = 221U }; + enum { DOM_VK_QUOTE = 222U }; + enum { DOM_VK_META = 224U }; - public static final int DOM_VK_F16 = 127; - - public static final int DOM_VK_F17 = 128; - - public static final int DOM_VK_F18 = 129; - - public static final int DOM_VK_F19 = 130; - - public static final int DOM_VK_F20 = 131; - - public static final int DOM_VK_F21 = 132; - - public static final int DOM_VK_F22 = 133; - - public static final int DOM_VK_F23 = 134; - - public static final int DOM_VK_F24 = 135; - - public static final int DOM_VK_NUM_LOCK = 144; - - public static final int DOM_VK_SCROLL_LOCK = 145; - - public static final int DOM_VK_COMMA = 188; - - public static final int DOM_VK_PERIOD = 190; - - public static final int DOM_VK_SLASH = 191; - - public static final int DOM_VK_BACK_QUOTE = 192; - - public static final int DOM_VK_OPEN_BRACKET = 219; - - public static final int DOM_VK_BACK_SLASH = 220; + nsresult GetCharCode(PRUint32 *aCharCode); + nsresult GetKeyCode(PRUint32 *aKeyCode); + nsresult GetAltKey(PRBool *aAltKey); + nsresult GetCtrlKey(PRBool *aCtrlKey); + nsresult GetShiftKey(PRBool *aShiftKey); + nsresult GetMetaKey(PRBool *aMetaKey); - public static final int DOM_VK_CLOSE_BRACKET = 221; - - public static final int DOM_VK_QUOTE = 222; - - public static final int DOM_VK_META = 224; - - public int GetCharCode(int[] aCharCode) { - return XPCOM.VtblCall(nsIDOMUIEvent.LAST_METHOD_ID + 1, getAddress(), aCharCode); - } - - public int GetKeyCode(int[] aKeyCode) { - return XPCOM.VtblCall(nsIDOMUIEvent.LAST_METHOD_ID + 2, getAddress(), aKeyCode); - } + nsresult InitKeyEvent(nsAString * typeArg, PRBool canBubbleArg, PRBool cancelableArg, nsIDOMAbstractView viewArg, PRBool ctrlKeyArg, PRBool altKeyArg, PRBool shiftKeyArg, PRBool metaKeyArg, PRUint32 keyCodeArg, PRUint32 charCodeArg); - public int GetAltKey(int[] aAltKey) { - return XPCOM.VtblCall(nsIDOMUIEvent.LAST_METHOD_ID + 3, getAddress(), aAltKey); - } - - public int GetCtrlKey(int[] aCtrlKey) { - return XPCOM.VtblCall(nsIDOMUIEvent.LAST_METHOD_ID + 4, getAddress(), aCtrlKey); - } +} - public int GetShiftKey(int[] aShiftKey) { - return XPCOM.VtblCall(nsIDOMUIEvent.LAST_METHOD_ID + 5, getAddress(), aShiftKey); - } - - public int GetMetaKey(int[] aMetaKey) { - return XPCOM.VtblCall(nsIDOMUIEvent.LAST_METHOD_ID + 6, getAddress(), aMetaKey); - } - - public int InitKeyEvent(int /*long*/ typeArg, int canBubbleArg, int cancelableArg, int /*long*/ viewArg, int ctrlKeyArg, int altKeyArg, int shiftKeyArg, int metaKeyArg, int keyCodeArg, int charCodeArg) { - return XPCOM.VtblCall(nsIDOMUIEvent.LAST_METHOD_ID + 7, getAddress(), typeArg, canBubbleArg, cancelableArg, viewArg, ctrlKeyArg, altKeyArg, shiftKeyArg, metaKeyArg, keyCodeArg, charCodeArg); - } -}
--- a/dwt/internal/mozilla/nsIDOMMouseEvent.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIDOMMouseEvent.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,89 +1,36 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIDOMMouseEvent; -import dwt.dwthelper.utils; - -public class nsIDOMMouseEvent extends nsIDOMUIEvent { - - static final int LAST_METHOD_ID = nsIDOMUIEvent.LAST_METHOD_ID + 11; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; - public static final String NS_IDOMMOUSEEVENT_IID_STR = - "ff751edc-8b02-aae7-0010-8301838a3123"; - - public static final nsID NS_IDOMMOUSEEVENT_IID = - new nsID(NS_IDOMMOUSEEVENT_IID_STR); +import dwt.internal.mozilla.nsIDOMUIEvent; +import dwt.internal.mozilla.nsIDOMEventTarget; +import dwt.internal.mozilla.nsIDOMAbstractView; +import dwt.internal.mozilla.nsStringAPI; - public nsIDOMMouseEvent(int /*long*/ address) { - super(address); - } - - public int GetScreenX(int[] aScreenX) { - return XPCOM.VtblCall(nsIDOMUIEvent.LAST_METHOD_ID + 1, getAddress(), aScreenX); - } +const char[] NS_IDOMMOUSEEVENT_IID_STR = "ff751edc-8b02-aae7-0010-8301838a3123"; - public int GetScreenY(int[] aScreenY) { - return XPCOM.VtblCall(nsIDOMUIEvent.LAST_METHOD_ID + 2, getAddress(), aScreenY); - } +const nsIID NS_IDOMMOUSEEVENT_IID= + {0xff751edc, 0x8b02, 0xaae7, + [ 0x00, 0x10, 0x83, 0x01, 0x83, 0x8a, 0x31, 0x23 ]}; - public int GetClientX(int[] aClientX) { - return XPCOM.VtblCall(nsIDOMUIEvent.LAST_METHOD_ID + 3, getAddress(), aClientX); - } +interface nsIDOMMouseEvent : nsIDOMUIEvent { - public int GetClientY(int[] aClientY) { - return XPCOM.VtblCall(nsIDOMUIEvent.LAST_METHOD_ID + 4, getAddress(), aClientY); - } - - public int GetCtrlKey(int[] aCtrlKey) { - return XPCOM.VtblCall(nsIDOMUIEvent.LAST_METHOD_ID + 5, getAddress(), aCtrlKey); - } - - public int GetShiftKey(int[] aShiftKey) { - return XPCOM.VtblCall(nsIDOMUIEvent.LAST_METHOD_ID + 6, getAddress(), aShiftKey); - } - - public int GetAltKey(int[] aAltKey) { - return XPCOM.VtblCall(nsIDOMUIEvent.LAST_METHOD_ID + 7, getAddress(), aAltKey); - } + static const char[] IID_STR = NS_IDOMMOUSEEVENT_IID_STR; + static const nsIID IID = NS_IDOMMOUSEEVENT_IID; - public int GetMetaKey(int[] aMetaKey) { - return XPCOM.VtblCall(nsIDOMUIEvent.LAST_METHOD_ID + 8, getAddress(), aMetaKey); - } - - public int GetButton(short[] aButton) { - return XPCOM.VtblCall(nsIDOMUIEvent.LAST_METHOD_ID + 9, getAddress(), aButton); - } +extern(System): + nsresult GetScreenX(PRInt32 *aScreenX); + nsresult GetScreenY(PRInt32 *aScreenY); + nsresult GetClientX(PRInt32 *aClientX); + nsresult GetClientY(PRInt32 *aClientY); + nsresult GetCtrlKey(PRBool *aCtrlKey); + nsresult GetShiftKey(PRBool *aShiftKey); + nsresult GetAltKey(PRBool *aAltKey); + nsresult GetMetaKey(PRBool *aMetaKey); + nsresult GetButton(PRUint16 *aButton); + nsresult GetRelatedTarget(nsIDOMEventTarget *aRelatedTarget); - public int GetRelatedTarget(int /*long*/[] aRelatedTarget) { - return XPCOM.VtblCall(nsIDOMUIEvent.LAST_METHOD_ID + 10, getAddress(), aRelatedTarget); - } + nsresult InitMouseEvent(nsAString * typeArg, PRBool canBubbleArg, PRBool cancelableArg, nsIDOMAbstractView viewArg, PRInt32 detailArg, PRInt32 screenXArg, PRInt32 screenYArg, PRInt32 clientXArg, PRInt32 clientYArg, PRBool ctrlKeyArg, PRBool altKeyArg, PRBool shiftKeyArg, PRBool metaKeyArg, PRUint16 buttonArg, nsIDOMEventTarget relatedTargetArg); - public int InitMouseEvent(int /*long*/ typeArg, int canBubbleArg, int cancelableArg, int /*long*/ viewArg, int detailArg, int screenXArg, int screenYArg, int clientXArg, int clientYArg, int ctrlKeyArg, int altKeyArg, int shiftKeyArg, int metaKeyArg, short buttonArg, int /*long*/ relatedTargetArg) { - return XPCOM.VtblCall(nsIDOMUIEvent.LAST_METHOD_ID + 11, getAddress(), typeArg, canBubbleArg, cancelableArg, viewArg, detailArg, screenXArg, screenYArg, clientXArg, clientYArg, ctrlKeyArg, altKeyArg, shiftKeyArg, metaKeyArg, buttonArg, relatedTargetArg); - } -} +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMNamedNodeMap.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,34 @@ +module dwt.internal.mozilla.nsIDOMNamedNodeMap; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIDOMNode; +import dwt.internal.mozilla.nsStringAPI; + +alias PRUint64 DOMTimeStamp; + +const char[] NS_IDOMNAMEDNODEMAP_IID_STR = "a6cf907b-15b3-11d2-932e-00805f8add32"; + +const nsIID NS_IDOMNAMEDNODEMAP_IID= + {0xa6cf907b, 0x15b3, 0x11d2, + [ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 ]}; + +interface nsIDOMNamedNodeMap : nsISupports { + + static const char[] IID_STR = NS_IDOMNAMEDNODEMAP_IID_STR; + static const nsIID IID = NS_IDOMNAMEDNODEMAP_IID; + +extern(System): + nsresult GetNamedItem(nsAString * name, nsIDOMNode *_retval); + nsresult SetNamedItem(nsIDOMNode arg, nsIDOMNode *_retval); + nsresult RemoveNamedItem(nsAString * name, nsIDOMNode *_retval); + nsresult Item(PRUint32 index, nsIDOMNode *_retval); + nsresult GetLength(PRUint32 *aLength); + nsresult GetNamedItemNS(nsAString * namespaceURI, nsAString * localName, nsIDOMNode *_retval); + nsresult SetNamedItemNS(nsIDOMNode arg, nsIDOMNode *_retval); + nsresult RemoveNamedItemNS(nsAString * namespaceURI, nsAString * localName, nsIDOMNode *_retval); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMNode.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,66 @@ +module dwt.internal.mozilla.nsIDOMNode; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIDOMNodeList; +import dwt.internal.mozilla.nsIDOMNamedNodeMap; +import dwt.internal.mozilla.nsIDOMDocument; +import dwt.internal.mozilla.nsStringAPI; + +alias PRUint64 DOMTimeStamp; + +const char[] NS_IDOMNODE_IID_STR = "a6cf907c-15b3-11d2-932e-00805f8add32"; + +const nsIID NS_IDOMNODE_IID= + {0xa6cf907c, 0x15b3, 0x11d2, + [ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 ]}; + +interface nsIDOMNode : nsISupports { + + static const char[] IID_STR = NS_IDOMNODE_IID_STR; + static const nsIID IID = NS_IDOMNODE_IID; + +extern(System): + enum { ELEMENT_NODE = 1U }; + enum { ATTRIBUTE_NODE = 2U }; + enum { TEXT_NODE = 3U }; + enum { CDATA_SECTION_NODE = 4U }; + enum { ENTITY_REFERENCE_NODE = 5U }; + enum { ENTITY_NODE = 6U }; + enum { PROCESSING_INSTRUCTION_NODE = 7U }; + enum { COMMENT_NODE = 8U }; + enum { DOCUMENT_NODE = 9U }; + enum { DOCUMENT_TYPE_NODE = 10U }; + enum { DOCUMENT_FRAGMENT_NODE = 11U }; + enum { NOTATION_NODE = 12U }; + + nsresult GetNodeName(nsAString * aNodeName); + nsresult GetNodeValue(nsAString * aNodeValue); + nsresult SetNodeValue(nsAString * aNodeValue); + nsresult GetNodeType(PRUint16 *aNodeType); + nsresult GetParentNode(nsIDOMNode *aParentNode); + nsresult GetChildNodes(nsIDOMNodeList *aChildNodes); + nsresult GetFirstChild(nsIDOMNode *aFirstChild); + nsresult GetLastChild(nsIDOMNode *aLastChild); + nsresult GetPreviousSibling(nsIDOMNode *aPreviousSibling); + nsresult GetNextSibling(nsIDOMNode *aNextSibling); + nsresult GetAttributes(nsIDOMNamedNodeMap *aAttributes); + nsresult GetOwnerDocument(nsIDOMDocument *aOwnerDocument); + nsresult InsertBefore(nsIDOMNode newChild, nsIDOMNode refChild, nsIDOMNode *_retval); + nsresult ReplaceChild(nsIDOMNode newChild, nsIDOMNode oldChild, nsIDOMNode *_retval); + nsresult RemoveChild(nsIDOMNode oldChild, nsIDOMNode *_retval); + nsresult AppendChild(nsIDOMNode newChild, nsIDOMNode *_retval); + nsresult HasChildNodes(PRBool *_retval); + nsresult CloneNode(PRBool deep, nsIDOMNode *_retval); + nsresult Normalize(); + nsresult IsSupported(nsAString * feature, nsAString * version_, PRBool *_retval); + nsresult GetNamespaceURI(nsAString * aNamespaceURI); + nsresult GetPrefix(nsAString * aPrefix); + nsresult SetPrefix(nsAString * aPrefix); + nsresult GetLocalName(nsAString * aLocalName); + nsresult HasAttributes(PRBool *_retval); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMNodeList.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,29 @@ +module dwt.internal.mozilla.nsIDOMNodeList; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIDOMNode; + +alias PRUint64 DOMTimeStamp; + +const char[] NS_IDOMNODELIST_IID_STR = "a6cf907d-15b3-11d2-932e-00805f8add32"; + +const nsIID NS_IDOMNODELIST_IID= + {0xa6cf907d, 0x15b3, 0x11d2, + [ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 ]}; + +//extern(System) + +interface nsIDOMNodeList : nsISupports { + + static const char[] IID_STR = NS_IDOMNODELIST_IID_STR; + static const nsIID IID = NS_IDOMNODELIST_IID; + +extern(System): + nsresult Item(PRUint32 index, nsIDOMNode *_retval); + nsresult GetLength(PRUint32 *aLength); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMProcessingInstruction.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,24 @@ +module dwt.internal.mozilla.nsIDOMProcessingInstruction; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsIDOMNode; +import dwt.internal.mozilla.nsStringAPI; + +const char[] NS_IDOMPROCESSINGINSTRUCTION_IID_STR = "a6cf907f-15b3-11d2-932e-00805f8add32"; + +const nsIID NS_IDOMPROCESSINGINSTRUCTION_IID= + {0xa6cf907f, 0x15b3, 0x11d2, + [ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 ]}; + +interface nsIDOMProcessingInstruction : nsIDOMNode { + + static const char[] IID_STR = NS_IDOMPROCESSINGINSTRUCTION_IID_STR; + static const nsIID IID = NS_IDOMPROCESSINGINSTRUCTION_IID; + + nsresult GetTarget(nsAString * aTarget); + nsresult GetData(nsAString * aData); + nsresult SetData(nsAString * aData); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMRange.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,55 @@ +module dwt.internal.mozilla.nsIDOMRange; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIDOMNode; +import dwt.internal.mozilla.nsIDOMDocumentFragment; +import dwt.internal.mozilla.nsStringAPI; + +const char[] NS_IDOMRANGE_IID_STR = "a6cf90ce-15b3-11d2-932e-00805f8add32"; + +const nsIID NS_IDOMRANGE_IID= + {0xa6cf90ce, 0x15b3, 0x11d2, + [ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 ]}; + +interface nsIDOMRange : nsISupports { + + static const char[] IID_STR = NS_IDOMRANGE_IID_STR; + static const nsIID IID = NS_IDOMRANGE_IID; + +extern(System): + nsresult GetStartContainer(nsIDOMNode *aStartContainer); + nsresult GetStartOffset(PRInt32 *aStartOffset); + nsresult GetEndContainer(nsIDOMNode *aEndContainer); + nsresult GetEndOffset(PRInt32 *aEndOffset); + nsresult GetCollapsed(PRBool *aCollapsed); + nsresult GetCommonAncestorContainer(nsIDOMNode *aCommonAncestorContainer); + nsresult SetStart(nsIDOMNode refNode, PRInt32 offset); + nsresult SetEnd(nsIDOMNode refNode, PRInt32 offset); + nsresult SetStartBefore(nsIDOMNode refNode); + nsresult SetStartAfter(nsIDOMNode refNode); + nsresult SetEndBefore(nsIDOMNode refNode); + nsresult SetEndAfter(nsIDOMNode refNode); + nsresult Collapse(PRBool toStart); + nsresult SelectNode(nsIDOMNode refNode); + nsresult SelectNodeContents(nsIDOMNode refNode); + + enum { START_TO_START = 0U }; + enum { START_TO_END = 1U }; + enum { END_TO_END = 2U }; + enum { END_TO_START = 3U }; + + nsresult CompareBoundaryPoints(PRUint16 how, nsIDOMRange sourceRange, PRInt16 *_retval); + nsresult DeleteContents(); + nsresult ExtractContents(nsIDOMDocumentFragment *_retval); + nsresult CloneContents(nsIDOMDocumentFragment *_retval); + nsresult InsertNode(nsIDOMNode newNode); + nsresult SurroundContents(nsIDOMNode newParent); + nsresult CloneRange(nsIDOMRange *_retval); + nsresult ToString(nsAString * _retval); + nsresult Detach(); + +} +
--- a/dwt/internal/mozilla/nsIDOMSerializer.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIDOMSerializer.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,53 +1,27 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIDOMSerializer; -import dwt.dwthelper.utils; - -public class nsIDOMSerializer extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 2; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIOutputStream; +import dwt.internal.mozilla.nsIDOMNode; +import dwt.internal.mozilla.nsStringAPI; - public static final String NS_IDOMSERIALIZER_IID_STR = - "a6cf9123-15b3-11d2-932e-00805f8add32"; +const char[] NS_IDOMSERIALIZER_IID_STR = "a6cf9123-15b3-11d2-932e-00805f8add32"; - public static final nsID NS_IDOMSERIALIZER_IID = - new nsID(NS_IDOMSERIALIZER_IID_STR); +const nsIID NS_IDOMSERIALIZER_IID= + {0xa6cf9123, 0x15b3, 0x11d2, + [ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 ]}; - public nsIDOMSerializer(int /*long*/ address) { - super(address); - } +interface nsIDOMSerializer : nsISupports { + + static const char[] IID_STR = NS_IDOMSERIALIZER_IID_STR; + static const nsIID IID = NS_IDOMSERIALIZER_IID; - public int SerializeToString(int /*long*/ root, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), root, _retval); - } +extern(System): - public int SerializeToStream(int /*long*/ root, int /*long*/ stream, byte[] charset) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), root, stream, charset); - } + nsresult SerializeToString(nsIDOMNode root, PRUnichar ** _retval); + nsresult SerializeToStream(nsIDOMNode root, nsIOutputStream stream, char* charset); + } +
--- a/dwt/internal/mozilla/nsIDOMSerializer_1_7.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIDOMSerializer_1_7.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,53 +1,26 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIDOMSerializer_1_7; -import dwt.dwthelper.utils; - -public class nsIDOMSerializer_1_7 extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 2; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIOutputStream; +import dwt.internal.mozilla.nsIDOMNode; +import dwt.internal.mozilla.nsStringAPI; - public static final String NS_IDOMSERIALIZER_IID_STR = - "9fd4ba15-e67c-4c98-b52c-7715f62c9196"; - - public static final nsID NS_IDOMSERIALIZER_IID = - new nsID(NS_IDOMSERIALIZER_IID_STR); +const char[] NS_IDOMSERIALIZER_IID_STR = "9fd4ba15-e67c-4c98-b52c-7715f62c9196"; - public nsIDOMSerializer_1_7(int /*long*/ address) { - super(address); - } +const nsIID NS_IDOMSERIALIZER_IID= + {0x9fd4ba15, 0xe67c, 0x4c98, + [ 0xb5, 0x2c, 0x77, 0x15, 0xf6, 0x2c, 0x91, 0x96 ]}; + +interface nsIDOMSerializer_1_7 : nsISupports { - public int SerializeToString(int /*long*/ root, int /*long*/ _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), root, _retval); - } + static const char[] IID_STR = NS_IDOMSERIALIZER_IID_STR; + static const nsIID IID = NS_IDOMSERIALIZER_IID; - public int SerializeToStream(int /*long*/ root, int /*long*/ stream, int /*long*/ charset) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), root, stream, charset); - } +extern(System): + nsresult SerializeToString(nsIDOMNode root, nsAString * _retval); + nsresult SerializeToStream(nsIDOMNode root, nsIOutputStream stream, nsACString * charset); + } +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMStorage.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,31 @@ +module dwt.internal.mozilla.nsIDOMStorage; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsStringAPI; +import dwt.internal.mozilla.nsIDOMStorageItem; + +alias PRUint64 DOMTimeStamp; + +const char[] NS_IDOMSTORAGE_IID_STR = "95cc1383-3b62-4b89-aaef-1004a513ef47"; + +const nsIID NS_IDOMSTORAGE_IID= + {0x95cc1383, 0x3b62, 0x4b89, + [ 0xaa, 0xef, 0x10, 0x04, 0xa5, 0x13, 0xef, 0x47 ]}; + +interface nsIDOMStorage : nsISupports { + + static const char[] IID_STR = NS_IDOMSTORAGE_IID_STR; + static const nsIID IID = NS_IDOMSTORAGE_IID; + +extern(System): + nsresult GetLength(PRUint32 *aLength); + nsresult Key(PRUint32 index, nsAString * _retval); + nsresult GetItem(nsAString * key, nsIDOMStorageItem *_retval); + nsresult SetItem(nsAString * key, nsAString * data); + nsresult RemoveItem(nsAString * key); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMStorageItem.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,29 @@ +module dwt.internal.mozilla.nsIDOMStorageItem; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsStringAPI; + +alias PRUint64 DOMTimeStamp; + +const char[] NS_IDOMSTORAGEITEM_IID_STR = "0cc37c78-4c5f-48e1-adfc-7480b8fe9dc4"; + +const nsIID NS_IDOMSTORAGEITEM_IID= + {0x0cc37c78, 0x4c5f, 0x48e1, + [ 0xad, 0xfc, 0x74, 0x80, 0xb8, 0xfe, 0x9d, 0xc4 ]}; + +interface nsIDOMStorageItem : nsISupports { + + static const char[] IID_STR = NS_IDOMSTORAGEITEM_IID_STR; + static const nsIID IID = NS_IDOMSTORAGEITEM_IID; + +extern(System): + nsresult GetSecure(PRBool *aSecure); + nsresult SetSecure(PRBool aSecure); + nsresult GetValue(nsAString * aValue); + nsresult SetValue(nsAString * aValue); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMText.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,23 @@ +module dwt.internal.mozilla.nsIDOMText; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; + +import dwt.internal.mozilla.nsIDOMCharacterData; + +const char[] NS_IDOMTEXT_IID_STR = "a6cf9082-15b3-11d2-932e-00805f8add32"; + +const nsIID NS_IDOMTEXT_IID= + {0xa6cf9082, 0x15b3, 0x11d2, + [ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 ]}; + +interface nsIDOMText : nsIDOMCharacterData { + + static const char[] IID_STR = NS_IDOMTEXT_IID_STR; + static const nsIID IID = NS_IDOMTEXT_IID; + +extern(System): + nsresult SplitText(PRUint32 offset, nsIDOMText *_retval); + +} +
--- a/dwt/internal/mozilla/nsIDOMUIEvent.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIDOMUIEvent.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,57 +1,27 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIDOMUIEvent; -import dwt.dwthelper.utils; - -public class nsIDOMUIEvent extends nsIDOMEvent { - - static final int LAST_METHOD_ID = nsIDOMEvent.LAST_METHOD_ID + 3; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; - public static final String NS_IDOMUIEVENT_IID_STR = - "a6cf90c3-15b3-11d2-932e-00805f8add32"; +import dwt.internal.mozilla.nsIDOMEvent; +import dwt.internal.mozilla.nsStringAPI; +import dwt.internal.mozilla.nsIDOMAbstractView; - public static final nsID NS_IDOMUIEVENT_IID = - new nsID(NS_IDOMUIEVENT_IID_STR); +const char[] NS_IDOMUIEVENT_IID_STR = "a6cf90c3-15b3-11d2-932e-00805f8add32"; + +const nsIID NS_IDOMUIEVENT_IID= + {0xa6cf90c3, 0x15b3, 0x11d2, + [ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 ]}; - public nsIDOMUIEvent(int /*long*/ address) { - super(address); - } +interface nsIDOMUIEvent : nsIDOMEvent { - public int GetView(int /*long*/[] aView) { - return XPCOM.VtblCall(nsIDOMEvent.LAST_METHOD_ID + 1, getAddress(), aView); - } + static const char[] IID_STR = NS_IDOMUIEVENT_IID_STR; + static const nsIID IID = NS_IDOMUIEVENT_IID; - public int GetDetail(int[] aDetail) { - return XPCOM.VtblCall(nsIDOMEvent.LAST_METHOD_ID + 2, getAddress(), aDetail); - } +extern(System): + nsresult GetView(nsIDOMAbstractView *aView); + nsresult GetDetail(PRInt32 *aDetail); + nsresult InitUIEvent(nsAString * typeArg, PRBool canBubbleArg, PRBool cancelableArg, nsIDOMAbstractView viewArg, PRInt32 detailArg); - public int InitUIEvent(int /*long*/ typeArg, int canBubbleArg, int cancelableArg, int /*long*/ viewArg, int detailArg) { - return XPCOM.VtblCall(nsIDOMEvent.LAST_METHOD_ID + 3, getAddress(), typeArg, canBubbleArg, cancelableArg, viewArg, detailArg); - } } +
--- a/dwt/internal/mozilla/nsIDOMWindow.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIDOMWindow.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,113 +1,46 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2005 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIDOMWindow; -import dwt.dwthelper.utils; - -public class nsIDOMWindow extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 17; - - public static final String NS_IDOMWINDOW_IID_STR = - "a6cf906b-15b3-11d2-932e-00805f8add32"; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public static final nsID NS_IDOMWINDOW_IID = - new nsID(NS_IDOMWINDOW_IID_STR); - - public nsIDOMWindow(int /*long*/ address) { - super(address); - } - - public int GetDocument(int /*long*/[] aDocument) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aDocument); - } +import dwt.internal.mozilla.nsIDOMWindowCollection; +import dwt.internal.mozilla.nsIDOMDocument; +import dwt.internal.mozilla.nsIDOMBarProp; +import dwt.internal.mozilla.nsISelection; +import dwt.internal.mozilla.nsStringAPI; - public int GetParent(int /*long*/[] aParent) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aParent); - } +alias PRUint64 DOMTimeStamp; - public int GetTop(int /*long*/[] aTop) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aTop); - } +const char[] NS_IDOMWINDOW_IID_STR = "a6cf906b-15b3-11d2-932e-00805f8add32"; - public int GetScrollbars(int /*long*/[] aScrollbars) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aScrollbars); - } +const nsIID NS_IDOMWINDOW_IID= + {0xa6cf906b, 0x15b3, 0x11d2, + [ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 ]}; - public int GetFrames(int /*long*/[] aFrames) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aFrames); - } - - public int GetName(int /*long*/ aName) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aName); - } +interface nsIDOMWindow : nsISupports { - public int SetName(int /*long*/ aName) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aName); - } - - public int GetTextZoom(float[] aTextZoom) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aTextZoom); - } - - public int SetTextZoom(float aTextZoom) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aTextZoom); - } - - public int GetScrollX(int[] aScrollX) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), aScrollX); - } - - public int GetScrollY(int[] aScrollY) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 11, getAddress(), aScrollY); - } + static const char[] IID_STR = NS_IDOMWINDOW_IID_STR; + static const nsIID IID = NS_IDOMWINDOW_IID; - public int ScrollTo(int xScroll, int yScroll) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 12, getAddress(), xScroll, yScroll); - } - - public int ScrollBy(int xScrollDif, int yScrollDif) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 13, getAddress(), xScrollDif, yScrollDif); - } - - public int GetSelection(int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 14, getAddress(), _retval); - } +extern(System): + nsresult GetDocument(nsIDOMDocument *aDocument); + nsresult GetParent(nsIDOMWindow *aParent); + nsresult GetTop(nsIDOMWindow *aTop); + nsresult GetScrollbars(nsIDOMBarProp *aScrollbars); + nsresult GetFrames(nsIDOMWindowCollection *aFrames); + nsresult GetName(nsAString * aName); + nsresult SetName(nsAString * aName); + nsresult GetTextZoom(float *aTextZoom); + nsresult SetTextZoom(float aTextZoom); + nsresult GetScrollX(PRInt32 *aScrollX); + nsresult GetScrollY(PRInt32 *aScrollY); + nsresult ScrollTo(PRInt32 xScroll, PRInt32 yScroll); + nsresult ScrollBy(PRInt32 xScrollDif, PRInt32 yScrollDif); + nsresult GetSelection(nsISelection *_retval); + nsresult ScrollByLines(PRInt32 numLines); + nsresult ScrollByPages(PRInt32 numPages); + nsresult SizeToContent(); - public int ScrollByLines(int numLines) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 15, getAddress(), numLines); - } +} - public int ScrollByPages(int numPages) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 16, getAddress(), numPages); - } - - public int SizeToContent() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 17, getAddress()); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDOMWindow2.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,23 @@ +module dwt.internal.mozilla.nsIDOMWindow2; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsIDOMWindow; +import dwt.internal.mozilla.nsIDOMEventTarget; + +const char[] NS_IDOMWINDOW2_IID_STR = "65455132-b96a-40ec-adea-52fa22b1028c"; + +const nsIID NS_IDOMWINDOW2_IID= + {0x65455132, 0xb96a, 0x40ec, + [ 0xad, 0xea, 0x52, 0xfa, 0x22, 0xb1, 0x02, 0x8c ]}; + +interface nsIDOMWindow2 : nsIDOMWindow { + + static const char[] IID_STR = NS_IDOMWINDOW2_IID_STR; + static const nsIID IID = NS_IDOMWINDOW2_IID; + +extern(System): + nsresult GetWindowRoot(nsIDOMEventTarget *aWindowRoot); + +} +
--- a/dwt/internal/mozilla/nsIDOMWindowCollection.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIDOMWindowCollection.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,57 +1,28 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIDOMWindowCollection; -import dwt.dwthelper.utils; - -public class nsIDOMWindowCollection extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 3; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIDOMWindow; +import dwt.internal.mozilla.nsStringAPI; - public static final String NS_IDOMWINDOWCOLLECTION_IID_STR = - "a6cf906f-15b3-11d2-932e-00805f8add32"; +alias PRUint64 DOMTimeStamp; - public static final nsID NS_IDOMWINDOWCOLLECTION_IID = - new nsID(NS_IDOMWINDOWCOLLECTION_IID_STR); +const char[] NS_IDOMWINDOWCOLLECTION_IID_STR = "a6cf906f-15b3-11d2-932e-00805f8add32"; - public nsIDOMWindowCollection(int /*long*/ address) { - super(address); - } +const nsIID NS_IDOMWINDOWCOLLECTION_IID= + {0xa6cf906f, 0x15b3, 0x11d2, + [ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 ]}; - public int GetLength(int[] aLength) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aLength); - } +interface nsIDOMWindowCollection : nsISupports { - public int Item(int index, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), index, _retval); - } + static const char[] IID_STR = NS_IDOMWINDOWCOLLECTION_IID_STR; + static const nsIID IID = NS_IDOMWINDOWCOLLECTION_IID; - public int NamedItem(int /*long*/ name, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), name, _retval); - } +extern(System): + nsresult GetLength(PRUint32 *aLength); + nsresult Item(PRUint32 index, nsIDOMWindow *_retval); + nsresult NamedItem(nsAString * name, nsIDOMWindow *_retval); + } +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDebug.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,23 @@ +module dwt.internal.mozilla.nsIDebug; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +const char[] NS_IDEBUG_IID_STR = "3bf0c3d7-3bd9-4cf2-a971-33572c503e1e"; + +const nsIID NS_IDEBUG_IID= + {0x3bf0c3d7, 0x3bd9, 0x4cf2, + [ 0xa9, 0x71, 0x33, 0x57, 0x2c, 0x50, 0x3e, 0x1e ]}; + +interface nsIDebug : nsISupports { + static const char[] IID_STR = NS_IDEBUG_IID_STR; + static const nsIID IID = NS_IDEBUG_IID; + +extern(System): + nsresult Assertion(char *aStr, char *aExpr, char *aFile, PRInt32 aLine); + nsresult Warning(char *aStr, char *aFile, PRInt32 aLine); + nsresult Break(char *aFile, PRInt32 aLine); + nsresult Abort(char *aFile, PRInt32 aLine); +} +
--- a/dwt/internal/mozilla/nsIDirectoryService.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIDirectoryService.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,57 +1,69 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIDirectoryService; -import dwt.dwthelper.utils; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISimpleEnumerator; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIFile; + +/****************************************************************************** -public class nsIDirectoryService extends nsISupports { +******************************************************************************/ + +const char[] NS_IDIRECTORYSERVICEPROVIDER_IID_STR = "bbf8cab0-d43a-11d3-8cc2-00609792278c"; - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 3; +const nsIID NS_IDIRECTORYSERVICEPROVIDER_IID= + {0xbbf8cab0, 0xd43a, 0x11d3, + [ 0x8c, 0xc2, 0x00, 0x60, 0x97, 0x92, 0x27, 0x8c ]}; - public static final String NS_IDIRECTORYSERVICE_IID_STR = - "57a66a60-d43a-11d3-8cc2-00609792278c"; +interface nsIDirectoryServiceProvider : nsISupports { + + static const char[] IID_STR = NS_IDIRECTORYSERVICEPROVIDER_IID_STR; + static const nsIID IID = NS_IDIRECTORYSERVICEPROVIDER_IID; + +extern(System): + nsresult GetFile(char *prop, PRBool *persistent, nsIFile *_retval); - public static final nsID NS_IDIRECTORYSERVICE_IID = - new nsID(NS_IDIRECTORYSERVICE_IID_STR); +} + +/****************************************************************************** + +******************************************************************************/ + +const char[] NS_IDIRECTORYSERVICEPROVIDER2_IID_STR = "2f977d4b-5485-11d4-87e2-0010a4e75ef2"; - public nsIDirectoryService(int /*long*/ address) { - super(address); - } +const nsIID NS_IDIRECTORYSERVICEPROVIDER2_IID= + {0x2f977d4b, 0x5485, 0x11d4, + [ 0x87, 0xe2, 0x00, 0x10, 0xa4, 0xe7, 0x5e, 0xf2 ]}; + +interface nsIDirectoryServiceProvider2 : nsIDirectoryServiceProvider { + + static const char[] IID_STR = NS_IDIRECTORYSERVICEPROVIDER2_IID_STR; + static const nsIID IID = NS_IDIRECTORYSERVICEPROVIDER2_IID; - public int Init() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress()); - } +extern(System): + nsresult GetFiles(char *prop, nsISimpleEnumerator *_retval); + +} + +/****************************************************************************** + +******************************************************************************/ - public int RegisterProvider(int /*long*/ prov) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), prov); - } +const char[] NS_IDIRECTORYSERVICE_IID_STR = "57a66a60-d43a-11d3-8cc2-00609792278c"; + +const nsIID NS_IDIRECTORYSERVICE_IID= + {0x57a66a60, 0xd43a, 0x11d3, + [ 0x8c, 0xc2, 0x00, 0x60, 0x97, 0x92, 0x27, 0x8c ]}; + +interface nsIDirectoryService : nsISupports { - public int UnregisterProvider(int /*long*/ prov) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), prov); - } + static const char[] IID_STR = NS_IDIRECTORYSERVICE_IID_STR; + static const nsIID IID = NS_IDIRECTORYSERVICE_IID; + +extern(System): + nsresult Init(); + nsresult RegisterProvider(nsIDirectoryServiceProvider prov); + nsresult UnregisterProvider(nsIDirectoryServiceProvider prov); } +
--- a/dwt/internal/mozilla/nsIDirectoryServiceProvider.d Fri Jan 16 12:19:08 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ -module dwt.internal.mozilla.nsIDirectoryServiceProvider; - -import dwt.dwthelper.utils; - -public class nsIDirectoryServiceProvider extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 1; - - public static final String NS_IDIRECTORYSERVICEPROVIDER_IID_STR = - "bbf8cab0-d43a-11d3-8cc2-00609792278c"; - - public static final nsID NS_IDIRECTORYSERVICEPROVIDER_IID = - new nsID(NS_IDIRECTORYSERVICEPROVIDER_IID_STR); - - public nsIDirectoryServiceProvider(int /*long*/ address) { - super(address); - } - - public int GetFile(byte[] prop, int[] persistent, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), prop, persistent, _retval); - } -}
--- a/dwt/internal/mozilla/nsIDirectoryServiceProvider2.d Fri Jan 16 12:19:08 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ -module dwt.internal.mozilla.nsIDirectoryServiceProvider2; - -import dwt.dwthelper.utils; - -public class nsIDirectoryServiceProvider2 extends nsIDirectoryServiceProvider { - - static final int LAST_METHOD_ID = nsIDirectoryServiceProvider.LAST_METHOD_ID + 1; - - public static final String NS_IDIRECTORYSERVICEPROVIDER2_IID_STRING = - "2f977d4b-5485-11d4-87e2-0010a4e75ef2"; - - public static final nsID NS_IDIRECTORYSERVICEPROVIDER2_IID = - new nsID(NS_IDIRECTORYSERVICEPROVIDER2_IID_STRING); - - public nsIDirectoryServiceProvider2(int /*long*/ address) { - super(address); - } - - public int GetFiles(byte[] prop, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsIDirectoryServiceProvider.LAST_METHOD_ID + 1, getAddress(), prop, _retval); - } -}
--- a/dwt/internal/mozilla/nsIDocShell.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIDocShell.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,271 +1,167 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ +// FIXME; IID's are not consistant with SWT version + module dwt.internal.mozilla.nsIDocShell; -import dwt.dwthelper.utils; - -public class nsIDocShell extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 51; - - public static final String NS_IDOCSHELL_IID_STR = - "69e5de00-7b8b-11d3-af61-00a024ffc08c"; - - public static final nsID NS_IDOCSHELL_IID = - new nsID(NS_IDOCSHELL_IID_STR); - - public nsIDocShell(int /*long*/ address) { - super(address); - } - - public int LoadURI(int /*long*/ uri, int /*long*/ loadInfo, int aLoadFlags, int firstParty) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), uri, loadInfo, aLoadFlags, firstParty); - } - - public int LoadStream(int /*long*/ aStream, int /*long*/ aURI, int /*long*/ aContentType, int /*long*/ aContentCharset, int /*long*/ aLoadInfo) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aStream, aURI, aContentType, aContentCharset, aLoadInfo); - } - - public int InternalLoad(int /*long*/ aURI, int /*long*/ aReferrer, int /*long*/ aOwner, int aInheritOwner, char[] aWindowTarget, int /*long*/ aPostDataStream, int /*long*/ aHeadersStream, int aLoadFlags, int /*long*/ aSHEntry, int firstParty, int /*long*/[] aDocShell, int /*long*/[] aRequest) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aURI, aReferrer, aOwner, aInheritOwner, aWindowTarget, aPostDataStream, aHeadersStream, aLoadFlags, aSHEntry, firstParty, aDocShell, aRequest); - } +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public int CreateLoadInfo(int /*long*/[] loadInfo) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), loadInfo); - } - - public int PrepareForNewContentModel() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress()); - } - - public int SetCurrentURI(int /*long*/ aURI) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aURI); - } - - public int FireUnloadNotification() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress()); - } +import dwt.internal.mozilla.nsIURI; +import dwt.internal.mozilla.nsIChannel; +import dwt.internal.mozilla.nsIContentViewer; +import dwt.internal.mozilla.nsIURIContentListener; +import dwt.internal.mozilla.nsIChromeEventHandler; +import dwt.internal.mozilla.nsIDocShellLoadInfo; +import dwt.internal.mozilla.nsIDocumentCharsetInfo; +import dwt.internal.mozilla.nsIWebNavigation; +import dwt.internal.mozilla.nsISimpleEnumerator; +import dwt.internal.mozilla.nsIInputStream; +import dwt.internal.mozilla.nsIRequest; +import dwt.internal.mozilla.nsISHEntry; +import dwt.internal.mozilla.nsISecureBrowserUI; +import dwt.internal.mozilla.nsIDOMStorage; +import dwt.internal.mozilla.nsStringAPI; - public int GetPresContext(int /*long*/[] aPresContext) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aPresContext); - } +/****************************************************************************** - public int GetPresShell(int /*long*/[] aPresShell) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aPresShell); - } +******************************************************************************/ + +const char[] NS_IDOCSHELL_IID_STR = "69e5de00-7b8b-11d3-af61-00a024ffc08c"; - public int GetEldestPresShell(int /*long*/[] aEldestPresShell) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), aEldestPresShell); - } +const nsIID NS_IDOCSHELL_IID= + { 0x69e5de00, 0x7b8b, 0x11d3, [0xaf,0x61,0x00,0xa0,0x24,0xff,0xc0,0x8c] }; +interface nsIDocShell : nsISupports { - public int GetContentViewer(int /*long*/[] aContentViewer) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 11, getAddress(), aContentViewer); - } + static const char[] IID_STR = NS_IDOCSHELL_IID_STR; + static const nsIID IID = NS_IDOCSHELL_IID; + +extern(System): + nsresult LoadURI(nsIURI uri, nsIDocShellLoadInfo loadInfo, PRUint32 aLoadFlags, PRBool firstParty); + nsresult LoadStream(nsIInputStream aStream, nsIURI aURI, nsACString * aContentType, nsACString * aContentCharset, nsIDocShellLoadInfo aLoadInfo); - public int GetChromeEventHandler(int /*long*/[] aChromeEventHandler) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 12, getAddress(), aChromeEventHandler); - } - - public int SetChromeEventHandler(int /*long*/ aChromeEventHandler) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 13, getAddress(), aChromeEventHandler); - } - - public int GetParentURIContentListener(int /*long*/[] aParentURIContentListener) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 14, getAddress(), aParentURIContentListener); - } + enum { INTERNAL_LOAD_FLAGS_NONE = 0 }; + enum { INTERNAL_LOAD_FLAGS_INHERIT_OWNER = 1 }; + enum { INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER = 2 }; + enum { INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP = 4 }; + enum { INTERNAL_LOAD_FLAGS_FIRST_LOAD = 8 }; - public int SetParentURIContentListener(int /*long*/ aParentURIContentListener) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 15, getAddress(), aParentURIContentListener); - } - - public int GetDocumentCharsetInfo(int /*long*/[] aDocumentCharsetInfo) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 16, getAddress(), aDocumentCharsetInfo); - } - - public int SetDocumentCharsetInfo(int /*long*/ aDocumentCharsetInfo) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 17, getAddress(), aDocumentCharsetInfo); - } - - public int GetAllowPlugins(int[] aAllowPlugins) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 18, getAddress(), aAllowPlugins); - } + nsresult InternalLoad(nsIURI aURI, nsIURI aReferrer, nsISupports aOwner, PRUint32 aFlags, PRUnichar *aWindowTarget, char *aTypeHint, nsIInputStream aPostDataStream, nsIInputStream aHeadersStream, PRUint32 aLoadFlags, nsISHEntry aSHEntry, PRBool firstParty, nsIDocShell *aDocShell, nsIRequest *aRequest); - public int SetAllowPlugins(int aAllowPlugins) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 19, getAddress(), aAllowPlugins); - } - - public int GetAllowJavascript(int[] aAllowJavascript) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 20, getAddress(), aAllowJavascript); - } - - public int SetAllowJavascript(int aAllowJavascript) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 21, getAddress(), aAllowJavascript); - } - - public int GetAllowMetaRedirects(int[] aAllowMetaRedirects) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 22, getAddress(), aAllowMetaRedirects); - } + nsresult CreateLoadInfo(nsIDocShellLoadInfo *loadInfo); + nsresult PrepareForNewContentModel(); + nsresult SetCurrentURI(nsIURI aURI); + nsresult FirePageHideNotification(PRBool isUnload); + nsresult GetPresContext(nsPresContext * *aPresContext); + nsresult GetPresShell(nsIPresShell * *aPresShell); + nsresult GetEldestPresShell(nsIPresShell * *aEldestPresShell); + nsresult GetContentViewer(nsIContentViewer *aContentViewer); + nsresult GetChromeEventHandler(nsIChromeEventHandler *aChromeEventHandler); + nsresult SetChromeEventHandler(nsIChromeEventHandler aChromeEventHandler); + nsresult GetDocumentCharsetInfo(nsIDocumentCharsetInfo *aDocumentCharsetInfo); + nsresult SetDocumentCharsetInfo(nsIDocumentCharsetInfo aDocumentCharsetInfo); + nsresult GetAllowPlugins(PRBool *aAllowPlugins); + nsresult SetAllowPlugins(PRBool aAllowPlugins); + nsresult GetAllowJavascript(PRBool *aAllowJavascript); + nsresult SetAllowJavascript(PRBool aAllowJavascript); + nsresult GetAllowMetaRedirects(PRBool *aAllowMetaRedirects); + nsresult SetAllowMetaRedirects(PRBool aAllowMetaRedirects); + nsresult GetAllowSubframes(PRBool *aAllowSubframes); + nsresult SetAllowSubframes(PRBool aAllowSubframes); + nsresult GetAllowImages(PRBool *aAllowImages); + nsresult SetAllowImages(PRBool aAllowImages); - public int SetAllowMetaRedirects(int aAllowMetaRedirects) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 23, getAddress(), aAllowMetaRedirects); - } - - public int GetAllowSubframes(int[] aAllowSubframes) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 24, getAddress(), aAllowSubframes); - } + enum { ENUMERATE_FORWARDS = 0 }; + enum { ENUMERATE_BACKWARDS = 1 }; - public int SetAllowSubframes(int aAllowSubframes) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 25, getAddress(), aAllowSubframes); - } + nsresult GetDocShellEnumerator(PRInt32 aItemType, PRInt32 aDirection, nsISimpleEnumerator *_retval); - public int GetAllowImages(int[] aAllowImages) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 26, getAddress(), aAllowImages); - } + enum { APP_TYPE_UNKNOWN = 0U }; + enum { APP_TYPE_MAIL = 1U }; + enum { APP_TYPE_EDITOR = 2U }; - public int SetAllowImages(int aAllowImages) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 27, getAddress(), aAllowImages); - } - - public static final int ENUMERATE_FORWARDS = 0; - - public static final int ENUMERATE_BACKWARDS = 1; - - public int GetDocShellEnumerator(int aItemType, int aDirection, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 28, getAddress(), aItemType, aDirection, _retval); - } - - public static final int APP_TYPE_UNKNOWN = 0; - - public static final int APP_TYPE_MAIL = 1; - - public int GetAppType(int[] aAppType) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 29, getAddress(), aAppType); - } - - public int SetAppType(int aAppType) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 30, getAddress(), aAppType); - } - - public int GetAllowAuth(int[] aAllowAuth) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 31, getAddress(), aAllowAuth); - } + nsresult GetAppType(PRUint32 *aAppType); + nsresult SetAppType(PRUint32 aAppType); + nsresult GetAllowAuth(PRBool *aAllowAuth); + nsresult SetAllowAuth(PRBool aAllowAuth); + nsresult GetZoom(float *aZoom); + nsresult SetZoom(float aZoom); + nsresult GetMarginWidth(PRInt32 *aMarginWidth); + nsresult SetMarginWidth(PRInt32 aMarginWidth); + nsresult GetMarginHeight(PRInt32 *aMarginHeight); + nsresult SetMarginHeight(PRInt32 aMarginHeight); + nsresult GetHasFocus(PRBool *aHasFocus); + nsresult SetHasFocus(PRBool aHasFocus); + nsresult GetCanvasHasFocus(PRBool *aCanvasHasFocus); + nsresult SetCanvasHasFocus(PRBool aCanvasHasFocus); + nsresult TabToTreeOwner(PRBool forward, PRBool *tookFocus); - public int SetAllowAuth(int aAllowAuth) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 32, getAddress(), aAllowAuth); - } - - public int GetZoom(float[] aZoom) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 33, getAddress(), aZoom); - } - - public int SetZoom(float aZoom) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 34, getAddress(), aZoom); - } - - public int GetMarginWidth(int[] aMarginWidth) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 35, getAddress(), aMarginWidth); - } - - public int SetMarginWidth(int aMarginWidth) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 36, getAddress(), aMarginWidth); - } - - public int GetMarginHeight(int[] aMarginHeight) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 37, getAddress(), aMarginHeight); - } - - public int SetMarginHeight(int aMarginHeight) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 38, getAddress(), aMarginHeight); - } - - public int GetHasFocus(int[] aHasFocus) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 39, getAddress(), aHasFocus); - } + enum { BUSY_FLAGS_NONE = 0U }; + enum { BUSY_FLAGS_BUSY = 1U }; + enum { BUSY_FLAGS_BEFORE_PAGE_LOAD = 2U }; + enum { BUSY_FLAGS_PAGE_LOADING = 4U }; + enum { LOAD_CMD_NORMAL = 1U }; + enum { LOAD_CMD_RELOAD = 2U }; + enum { LOAD_CMD_HISTORY = 4U }; - public int SetHasFocus(int aHasFocus) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 40, getAddress(), aHasFocus); - } - - public int GetCanvasHasFocus(int[] aCanvasHasFocus) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 41, getAddress(), aCanvasHasFocus); - } - - public int SetCanvasHasFocus(int aCanvasHasFocus) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 42, getAddress(), aCanvasHasFocus); - } + nsresult GetBusyFlags(PRUint32 *aBusyFlags); + nsresult GetLoadType(PRUint32 *aLoadType); + nsresult SetLoadType(PRUint32 aLoadType); + nsresult IsBeingDestroyed(PRBool *_retval); + nsresult GetIsExecutingOnLoadHandler(PRBool *aIsExecutingOnLoadHandler); + nsresult GetLayoutHistoryState(nsILayoutHistoryState *aLayoutHistoryState); + nsresult SetLayoutHistoryState(nsILayoutHistoryState aLayoutHistoryState); + nsresult GetShouldSaveLayoutState(PRBool *aShouldSaveLayoutState); + nsresult GetSecurityUI(nsISecureBrowserUI *aSecurityUI); + nsresult SetSecurityUI(nsISecureBrowserUI aSecurityUI); + nsresult SuspendRefreshURIs(); + nsresult ResumeRefreshURIs(); + nsresult BeginRestore(nsIContentViewer viewer, PRBool top); + nsresult FinishRestore(); + nsresult GetRestoringDocument(PRBool *aRestoringDocument); + nsresult GetUseErrorPages(PRBool *aUseErrorPages); + nsresult SetUseErrorPages(PRBool aUseErrorPages); + nsresult GetPreviousTransIndex(PRInt32 *aPreviousTransIndex); + nsresult GetLoadedTransIndex(PRInt32 *aLoadedTransIndex); + nsresult HistoryPurged(PRInt32 numEntries); +} - public int TabToTreeOwner(int forward, int[] tookFocus) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 43, getAddress(), forward, tookFocus); - } - - public static final int BUSY_FLAGS_NONE = 0; - - public static final int BUSY_FLAGS_BUSY = 1; +/****************************************************************************** - public static final int BUSY_FLAGS_BEFORE_PAGE_LOAD = 2; - - public static final int BUSY_FLAGS_PAGE_LOADING = 4; +******************************************************************************/ - public static final int LOAD_CMD_NORMAL = 1; - - public static final int LOAD_CMD_RELOAD = 2; - - public static final int LOAD_CMD_HISTORY = 4; +const char[] NS_IDOCSHELL_1_8_IID_STR = "9f0c7461-b9a4-47f6-b88c-421dce1bce66"; - public int GetBusyFlags(int[] aBusyFlags) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 44, getAddress(), aBusyFlags); - } +const nsIID NS_IDOCSHELL_1_8_IID= + { 0x9f0c7461, 0xb9a4, 0x47f6, + [ 0xb8,0x8c,0x42,0x1d,0xce,0x1b,0xce,0x66 ] }; - public int GetLoadType(int[] aLoadType) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 45, getAddress(), aLoadType); - } +interface nsIDocShell_1_8 : nsIDocShell { - public int SetLoadType(int aLoadType) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 46, getAddress(), aLoadType); - } + static const char[] IID_STR = NS_IDOCSHELL_1_8_IID_STR; + static const nsIID IID = NS_IDOCSHELL_1_8_IID; - public int IsBeingDestroyed(int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 47, getAddress(), _retval); - } +extern(System): + nsresult GetSessionStorageForURI(nsIURI uri, nsIDOMStorage *_retval); + nsresult AddSessionStorage(nsACString * aDomain, nsIDOMStorage storage); + nsresult GetCurrentDocumentChannel(nsIChannel *aCurrentDocumentChannel); +} + +/****************************************************************************** - public int GetIsExecutingOnLoadHandler(int[] aIsExecutingOnLoadHandler) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 48, getAddress(), aIsExecutingOnLoadHandler); - } +******************************************************************************/ + +const char[] NS_IDOCSHELL_1_9_IID_STR = "10ed386d-8598-408c-b571-e75ad18edeb0"; - public int GetLayoutHistoryState(int /*long*/[] aLayoutHistoryState) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 49, getAddress(), aLayoutHistoryState); - } +const nsIID NS_IDOCSHELL_1_9_IID = + {0x10ed386d, 0x8598, 0x408c, [ 0xb5, 0x71, 0xe7, 0x5a, 0xd1, 0x8e, 0xde, 0xb0 ] }; + +interface nsIDocShell_1_9 : nsIDocShell_1_8 { - public int SetLayoutHistoryState(int /*long*/ aLayoutHistoryState) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 50, getAddress(), aLayoutHistoryState); - } + static const char[] IID_STR = NS_IDOCSHELL_1_9_IID_STR; + static const nsIID IID = NS_IDOCSHELL_1_9_IID; - public int GetShouldSaveLayoutState(int[] aShouldSaveLayoutState) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 51, getAddress(), aShouldSaveLayoutState); - } +extern(System): + nsresult GetSessionStorageForURI(nsIURI uri, nsIDOMStorage *_retval); + nsresult AddSessionStorage(nsACString * aDomain, nsIDOMStorage storage); + nsresult GetCurrentDocumentChannel(nsIChannel *aCurrentDocumentChannel); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDocShellLoadInfo.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,61 @@ +module dwt.internal.mozilla.nsIDocShellLoadInfo; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIURI; +import dwt.internal.mozilla.nsIInputStream; +import dwt.internal.mozilla.nsISHEntry; + +alias PRInt32 nsDocShellInfoLoadType; + +const char[] NS_IDOCSHELLLOADINFO_IID_STR = "4f813a88-7aca-4607-9896-d97270cdf15e"; + +const nsIID NS_IDOCSHELLLOADINFO_IID= + {0x4f813a88, 0x7aca, 0x4607, + [ 0x98, 0x96, 0xd9, 0x72, 0x70, 0xcd, 0xf1, 0x5e ]}; + +interface nsIDocShellLoadInfo : nsISupports { + + static const char[] IID_STR = NS_IDOCSHELLLOADINFO_IID_STR; + static const nsIID IID = NS_IDOCSHELLLOADINFO_IID; + +extern(System): + nsresult GetReferrer(nsIURI *aReferrer); + nsresult SetReferrer(nsIURI aReferrer); + nsresult GetOwner(nsISupports *aOwner); + nsresult SetOwner(nsISupports aOwner); + nsresult GetInheritOwner(PRBool *aInheritOwner); + nsresult SetInheritOwner(PRBool aInheritOwner); + + enum { loadNormal = 0 }; + enum { loadNormalReplace = 1 }; + enum { loadHistory = 2 }; + enum { loadReloadNormal = 3 }; + enum { loadReloadBypassCache = 4 }; + enum { loadReloadBypassProxy = 5 }; + enum { loadReloadBypassProxyAndCache = 6 }; + enum { loadLink = 7 }; + enum { loadRefresh = 8 }; + enum { loadReloadCharsetChange = 9 }; + enum { loadBypassHistory = 10 }; + enum { loadStopContent = 11 }; + enum { loadStopContentAndReplace = 12 }; + enum { loadNormalExternal = 13 }; + + nsresult GetLoadType(nsDocShellInfoLoadType *aLoadType); + nsresult SetLoadType(nsDocShellInfoLoadType aLoadType); + nsresult GetSHEntry(nsISHEntry *aSHEntry); + nsresult SetSHEntry(nsISHEntry aSHEntry); + nsresult GetTarget(PRUnichar * *aTarget); + nsresult SetTarget(PRUnichar * aTarget); + nsresult GetPostDataStream(nsIInputStream *aPostDataStream); + nsresult SetPostDataStream(nsIInputStream aPostDataStream); + nsresult GetHeadersStream(nsIInputStream *aHeadersStream); + nsresult SetHeadersStream(nsIInputStream aHeadersStream); + nsresult GetSendReferrer(PRBool *aSendReferrer); + nsresult SetSendReferrer(PRBool aSendReferrer); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDocShellTreeItem.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,44 @@ +module dwt.internal.mozilla.nsIDocShellTreeItem; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIDocShellTreeOwner; + +const char[] NS_IDOCSHELLTREEITEM_IID_STR = "7d935d63-6d2a-4600-afb5-9a4f7d68b825"; + +const nsIID NS_IDOCSHELLTREEITEM_IID= + {0x7d935d63, 0x6d2a, 0x4600, + [ 0xaf, 0xb5, 0x9a, 0x4f, 0x7d, 0x68, 0xb8, 0x25 ]}; + +interface nsIDocShellTreeItem : nsISupports { + + static const char[] IID_STR = NS_IDOCSHELLTREEITEM_IID_STR; + static const nsIID IID = NS_IDOCSHELLTREEITEM_IID; + +extern(System): + nsresult GetName(PRUnichar * *aName); + nsresult SetName(PRUnichar * aName); + nsresult NameEquals(PRUnichar *name, PRBool *_retval); + + enum { typeChrome = 0 }; + enum { typeContent = 1 }; + enum { typeContentWrapper = 2 }; + enum { typeChromeWrapper = 3 }; + enum { typeAll = 2147483647 }; + + nsresult GetItemType(PRInt32 *aItemType); + nsresult SetItemType(PRInt32 aItemType); + nsresult GetParent(nsIDocShellTreeItem *aParent); + nsresult GetSameTypeParent(nsIDocShellTreeItem *aSameTypeParent); + nsresult GetRootTreeItem(nsIDocShellTreeItem *aRootTreeItem); + nsresult GetSameTypeRootTreeItem(nsIDocShellTreeItem *aSameTypeRootTreeItem); + nsresult FindItemWithName(PRUnichar *name, nsISupports aRequestor, nsIDocShellTreeItem aOriginalRequestor, nsIDocShellTreeItem *_retval); + nsresult GetTreeOwner(nsIDocShellTreeOwner *aTreeOwner); + nsresult SetTreeOwner(nsIDocShellTreeOwner treeOwner); + nsresult GetChildOffset(PRInt32 *aChildOffset); + nsresult SetChildOffset(PRInt32 aChildOffset); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDocShellTreeOwner.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,55 @@ +module dwt.internal.mozilla.nsIDocShellTreeOwner; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIDocShellTreeItem; +import dwt.internal.mozilla.nsStringAPI; + +/****************************************************************************** + +******************************************************************************/ + +const char[] NS_IDOCSHELLTREEOWNER_IID_STR = "9e508466-5ebb-4618-abfa-9ad47bed0b2e"; + +const nsIID NS_IDOCSHELLTREEOWNER_IID= + {0x9e508466, 0x5ebb, 0x4618, + [ 0xab, 0xfa, 0x9a, 0xd4, 0x7b, 0xed, 0x0b, 0x2e ]}; + +interface nsIDocShellTreeOwner : nsISupports { + + static const char[] IID_STR = NS_IDOCSHELLTREEOWNER_IID_STR; + static const nsIID IID = NS_IDOCSHELLTREEOWNER_IID; + +extern(System): + nsresult FindItemWithName(PRUnichar *name, nsIDocShellTreeItem aRequestor, nsIDocShellTreeItem aOriginalRequestor, nsIDocShellTreeItem *_retval); + nsresult ContentShellAdded(nsIDocShellTreeItem aContentShell, PRBool aPrimary, PRUnichar *aID); + nsresult GetPrimaryContentShell(nsIDocShellTreeItem *aPrimaryContentShell); + nsresult SizeShellTo(nsIDocShellTreeItem shell, PRInt32 cx, PRInt32 cy); + nsresult SetPersistence(PRBool aPersistPosition, PRBool aPersistSize, PRBool aPersistSizeMode); + nsresult GetPersistence(PRBool *aPersistPosition, PRBool *aPersistSize, PRBool *aPersistSizeMode); + +} + +/****************************************************************************** + +******************************************************************************/ + +const char[] NS_IDOCSHELLTREEOWNER_MOZILLA_1_8_BRANCH_IID_STR = "3c2a6927-e923-4ea8-bbda-a335c768ce4e"; + +const nsIID NS_IDOCSHELLTREEOWNER_MOZILLA_1_8_BRANCH_IID= + {0x3c2a6927, 0xe923, 0x4ea8, + [ 0xbb, 0xda, 0xa3, 0x35, 0xc7, 0x68, 0xce, 0x4e ]}; + +interface nsIDocShellTreeOwner_MOZILLA_1_8_BRANCH : nsIDocShellTreeOwner { + + static const char[] IID_STR = NS_IDOCSHELLTREEOWNER_MOZILLA_1_8_BRANCH_IID_STR; + static const nsIID IID = NS_IDOCSHELLTREEOWNER_MOZILLA_1_8_BRANCH_IID; + +extern(System): + nsresult ContentShellAdded2(nsIDocShellTreeItem aContentShell, PRBool aPrimary, PRBool aTargetable, nsAString * aID); + nsresult ContentShellRemoved(nsIDocShellTreeItem aContentShell); + +} +
--- a/dwt/internal/mozilla/nsIDocShell_1_8.d Fri Jan 16 12:19:08 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,319 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ -module dwt.internal.mozilla.nsIDocShell_1_8; - -import dwt.dwthelper.utils; - -public class nsIDocShell_1_8 extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 61; - - public static final String NS_IDOCSHELL_IID_STR = - "9f0c7461-b9a4-47f6-b88c-421dce1bce66"; - - public static final nsID NS_IDOCSHELL_IID = - new nsID(NS_IDOCSHELL_IID_STR); - - public nsIDocShell_1_8(int /*long*/ address) { - super(address); - } - - public int LoadURI(int /*long*/ uri, int /*long*/ loadInfo, int aLoadFlags, int firstParty) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), uri, loadInfo, aLoadFlags, firstParty); - } - - public int LoadStream(int /*long*/ aStream, int /*long*/ aURI, int /*long*/ aContentType, int /*long*/ aContentCharset, int /*long*/ aLoadInfo) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aStream, aURI, aContentType, aContentCharset, aLoadInfo); - } - - public static final int INTERNAL_LOAD_FLAGS_NONE = 0; - - public static final int INTERNAL_LOAD_FLAGS_INHERIT_OWNER = 1; - - public static final int INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER = 2; - - public int InternalLoad(int /*long*/ aURI, int /*long*/ aReferrer, int /*long*/ aOwner, int aFlags, char[] aWindowTarget, byte[] aTypeHint, int /*long*/ aPostDataStream, int /*long*/ aHeadersStream, int aLoadFlags, int /*long*/ aSHEntry, int firstParty, int /*long*/[] aDocShell, int /*long*/[] aRequest) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aURI, aReferrer, aOwner, aFlags, aWindowTarget, aTypeHint, aPostDataStream, aHeadersStream, aLoadFlags, aSHEntry, firstParty, aDocShell, aRequest); - } - - public int CreateLoadInfo(int /*long*/[] loadInfo) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), loadInfo); - } - - public int PrepareForNewContentModel() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress()); - } - - public int SetCurrentURI(int /*long*/ aURI) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aURI); - } - - public int FirePageHideNotification(int isUnload) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), isUnload); - } - - public int GetPresContext(int /*long*/[] aPresContext) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aPresContext); - } - - public int GetPresShell(int /*long*/[] aPresShell) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aPresShell); - } - - public int GetEldestPresShell(int /*long*/[] aEldestPresShell) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), aEldestPresShell); - } - - public int GetContentViewer(int /*long*/[] aContentViewer) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 11, getAddress(), aContentViewer); - } - - public int GetChromeEventHandler(int /*long*/[] aChromeEventHandler) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 12, getAddress(), aChromeEventHandler); - } - - public int SetChromeEventHandler(int /*long*/ aChromeEventHandler) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 13, getAddress(), aChromeEventHandler); - } - - public int GetDocumentCharsetInfo(int /*long*/[] aDocumentCharsetInfo) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 14, getAddress(), aDocumentCharsetInfo); - } - - public int SetDocumentCharsetInfo(int /*long*/ aDocumentCharsetInfo) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 15, getAddress(), aDocumentCharsetInfo); - } - - public int GetAllowPlugins(int[] aAllowPlugins) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 16, getAddress(), aAllowPlugins); - } - - public int SetAllowPlugins(int aAllowPlugins) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 17, getAddress(), aAllowPlugins); - } - - public int GetAllowJavascript(int[] aAllowJavascript) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 18, getAddress(), aAllowJavascript); - } - - public int SetAllowJavascript(int aAllowJavascript) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 19, getAddress(), aAllowJavascript); - } - - public int GetAllowMetaRedirects(int[] aAllowMetaRedirects) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 20, getAddress(), aAllowMetaRedirects); - } - - public int SetAllowMetaRedirects(int aAllowMetaRedirects) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 21, getAddress(), aAllowMetaRedirects); - } - - public int GetAllowSubframes(int[] aAllowSubframes) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 22, getAddress(), aAllowSubframes); - } - - public int SetAllowSubframes(int aAllowSubframes) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 23, getAddress(), aAllowSubframes); - } - - public int GetAllowImages(int[] aAllowImages) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 24, getAddress(), aAllowImages); - } - - public int SetAllowImages(int aAllowImages) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 25, getAddress(), aAllowImages); - } - - public static final int ENUMERATE_FORWARDS = 0; - - public static final int ENUMERATE_BACKWARDS = 1; - - public int GetDocShellEnumerator(int aItemType, int aDirection, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 26, getAddress(), aItemType, aDirection, _retval); - } - - public static final int APP_TYPE_UNKNOWN = 0; - - public static final int APP_TYPE_MAIL = 1; - - public static final int APP_TYPE_EDITOR = 2; - - public int GetAppType(int[] aAppType) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 27, getAddress(), aAppType); - } - - public int SetAppType(int aAppType) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 28, getAddress(), aAppType); - } - - public int GetAllowAuth(int[] aAllowAuth) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 29, getAddress(), aAllowAuth); - } - - public int SetAllowAuth(int aAllowAuth) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 30, getAddress(), aAllowAuth); - } - - public int GetZoom(float[] aZoom) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 31, getAddress(), aZoom); - } - - public int SetZoom(float aZoom) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 32, getAddress(), aZoom); - } - - public int GetMarginWidth(int[] aMarginWidth) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 33, getAddress(), aMarginWidth); - } - - public int SetMarginWidth(int aMarginWidth) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 34, getAddress(), aMarginWidth); - } - - public int GetMarginHeight(int[] aMarginHeight) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 35, getAddress(), aMarginHeight); - } - - public int SetMarginHeight(int aMarginHeight) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 36, getAddress(), aMarginHeight); - } - - public int GetHasFocus(int[] aHasFocus) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 37, getAddress(), aHasFocus); - } - - public int SetHasFocus(int aHasFocus) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 38, getAddress(), aHasFocus); - } - - public int GetCanvasHasFocus(int[] aCanvasHasFocus) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 39, getAddress(), aCanvasHasFocus); - } - - public int SetCanvasHasFocus(int aCanvasHasFocus) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 40, getAddress(), aCanvasHasFocus); - } - - public int TabToTreeOwner(int forward, int[] tookFocus) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 41, getAddress(), forward, tookFocus); - } - - public static final int BUSY_FLAGS_NONE = 0; - - public static final int BUSY_FLAGS_BUSY = 1; - - public static final int BUSY_FLAGS_BEFORE_PAGE_LOAD = 2; - - public static final int BUSY_FLAGS_PAGE_LOADING = 4; - - public static final int LOAD_CMD_NORMAL = 1; - - public static final int LOAD_CMD_RELOAD = 2; - - public static final int LOAD_CMD_HISTORY = 4; - - public int GetBusyFlags(int[] aBusyFlags) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 42, getAddress(), aBusyFlags); - } - - public int GetLoadType(int[] aLoadType) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 43, getAddress(), aLoadType); - } - - public int SetLoadType(int aLoadType) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 44, getAddress(), aLoadType); - } - - public int IsBeingDestroyed(int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 45, getAddress(), _retval); - } - - public int GetIsExecutingOnLoadHandler(int[] aIsExecutingOnLoadHandler) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 46, getAddress(), aIsExecutingOnLoadHandler); - } - - public int GetLayoutHistoryState(int /*long*/[] aLayoutHistoryState) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 47, getAddress(), aLayoutHistoryState); - } - - public int SetLayoutHistoryState(int /*long*/ aLayoutHistoryState) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 48, getAddress(), aLayoutHistoryState); - } - - public int GetShouldSaveLayoutState(int[] aShouldSaveLayoutState) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 49, getAddress(), aShouldSaveLayoutState); - } - - public int GetSecurityUI(int /*long*/[] aSecurityUI) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 50, getAddress(), aSecurityUI); - } - - public int SetSecurityUI(int /*long*/ aSecurityUI) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 51, getAddress(), aSecurityUI); - } - - public int SuspendRefreshURIs() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 52, getAddress()); - } - - public int ResumeRefreshURIs() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 53, getAddress()); - } - - public int BeginRestore(int /*long*/ viewer, int top) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 54, getAddress(), viewer, top); - } - - public int FinishRestore() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 55, getAddress()); - } - - public int GetRestoringDocument(int[] aRestoringDocument) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 56, getAddress(), aRestoringDocument); - } - - public int GetUseErrorPages(int[] aUseErrorPages) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 57, getAddress(), aUseErrorPages); - } - - public int SetUseErrorPages(int aUseErrorPages) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 58, getAddress(), aUseErrorPages); - } - - public int GetPreviousTransIndex(int[] aPreviousTransIndex) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 59, getAddress(), aPreviousTransIndex); - } - - public int GetLoadedTransIndex(int[] aLoadedTransIndex) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 60, getAddress(), aLoadedTransIndex); - } - - public int HistoryPurged(int numEntries) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 61, getAddress(), numEntries); - } -}
--- a/dwt/internal/mozilla/nsIDocShell_1_9.d Fri Jan 16 12:19:08 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,349 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ -module dwt.internal.mozilla.nsIDocShell_1_9; - -import dwt.dwthelper.utils; - -public class nsIDocShell_1_9 extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 67; - - public static final String NS_IDOCSHELL_IID_STR = - "7d1cf6b9-daa3-476d-8f9f-9eb2a971a95c"; - - public static final nsID NS_IDOCSHELL_IID = - new nsID(NS_IDOCSHELL_IID_STR); - - public nsIDocShell_1_9(int /*long*/ address) { - super(address); - } - - public int LoadURI(int /*long*/ uri, int /*long*/ loadInfo, int aLoadFlags, int firstParty) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), uri, loadInfo, aLoadFlags, firstParty); - } - - public int LoadStream(int /*long*/ aStream, int /*long*/ aURI, int /*long*/ aContentType, int /*long*/ aContentCharset, int /*long*/ aLoadInfo) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aStream, aURI, aContentType, aContentCharset, aLoadInfo); - } - - public static final int INTERNAL_LOAD_FLAGS_NONE = 0; - - public static final int INTERNAL_LOAD_FLAGS_INHERIT_OWNER = 1; - - public static final int INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER = 2; - - public static final int INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP = 4; - - public static final int INTERNAL_LOAD_FLAGS_FIRST_LOAD = 8; - - public static final int INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER = 16; - - public int InternalLoad(int /*long*/ aURI, int /*long*/ aReferrer, int /*long*/ aOwner, int aFlags, char[] aWindowTarget, byte[] aTypeHint, int /*long*/ aPostDataStream, int /*long*/ aHeadersStream, int aLoadFlags, int /*long*/ aSHEntry, int firstParty, int /*long*/[] aDocShell, int /*long*/[] aRequest) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aURI, aReferrer, aOwner, aFlags, aWindowTarget, aTypeHint, aPostDataStream, aHeadersStream, aLoadFlags, aSHEntry, firstParty, aDocShell, aRequest); - } - - public int CreateLoadInfo(int /*long*/[] loadInfo) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), loadInfo); - } - - public int PrepareForNewContentModel() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress()); - } - - public int SetCurrentURI(int /*long*/ aURI) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aURI); - } - - public int FirePageHideNotification(int isUnload) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), isUnload); - } - - public int GetPresContext(int /*long*/[] aPresContext) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aPresContext); - } - - public int GetPresShell(int /*long*/[] aPresShell) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aPresShell); - } - - public int GetEldestPresShell(int /*long*/[] aEldestPresShell) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), aEldestPresShell); - } - - public int GetContentViewer(int /*long*/[] aContentViewer) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 11, getAddress(), aContentViewer); - } - - public int GetChromeEventHandler(int /*long*/[] aChromeEventHandler) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 12, getAddress(), aChromeEventHandler); - } - - public int SetChromeEventHandler(int /*long*/ aChromeEventHandler) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 13, getAddress(), aChromeEventHandler); - } - - public int GetDocumentCharsetInfo(int /*long*/[] aDocumentCharsetInfo) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 14, getAddress(), aDocumentCharsetInfo); - } - - public int SetDocumentCharsetInfo(int /*long*/ aDocumentCharsetInfo) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 15, getAddress(), aDocumentCharsetInfo); - } - - public int GetAllowPlugins(int[] aAllowPlugins) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 16, getAddress(), aAllowPlugins); - } - - public int SetAllowPlugins(int aAllowPlugins) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 17, getAddress(), aAllowPlugins); - } - - public int GetAllowJavascript(int[] aAllowJavascript) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 18, getAddress(), aAllowJavascript); - } - - public int SetAllowJavascript(int aAllowJavascript) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 19, getAddress(), aAllowJavascript); - } - - public int GetAllowMetaRedirects(int[] aAllowMetaRedirects) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 20, getAddress(), aAllowMetaRedirects); - } - - public int SetAllowMetaRedirects(int aAllowMetaRedirects) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 21, getAddress(), aAllowMetaRedirects); - } - - public int GetAllowSubframes(int[] aAllowSubframes) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 22, getAddress(), aAllowSubframes); - } - - public int SetAllowSubframes(int aAllowSubframes) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 23, getAddress(), aAllowSubframes); - } - - public int GetAllowImages(int[] aAllowImages) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 24, getAddress(), aAllowImages); - } - - public int SetAllowImages(int aAllowImages) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 25, getAddress(), aAllowImages); - } - - public static final int ENUMERATE_FORWARDS = 0; - - public static final int ENUMERATE_BACKWARDS = 1; - - public int GetDocShellEnumerator(int aItemType, int aDirection, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 26, getAddress(), aItemType, aDirection, _retval); - } - - public static final int APP_TYPE_UNKNOWN = 0; - - public static final int APP_TYPE_MAIL = 1; - - public static final int APP_TYPE_EDITOR = 2; - - public int GetAppType(int[] aAppType) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 27, getAddress(), aAppType); - } - - public int SetAppType(int aAppType) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 28, getAddress(), aAppType); - } - - public int GetAllowAuth(int[] aAllowAuth) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 29, getAddress(), aAllowAuth); - } - - public int SetAllowAuth(int aAllowAuth) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 30, getAddress(), aAllowAuth); - } - - public int GetZoom(float[] aZoom) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 31, getAddress(), aZoom); - } - - public int SetZoom(float aZoom) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 32, getAddress(), aZoom); - } - - public int GetMarginWidth(int[] aMarginWidth) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 33, getAddress(), aMarginWidth); - } - - public int SetMarginWidth(int aMarginWidth) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 34, getAddress(), aMarginWidth); - } - - public int GetMarginHeight(int[] aMarginHeight) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 35, getAddress(), aMarginHeight); - } - - public int SetMarginHeight(int aMarginHeight) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 36, getAddress(), aMarginHeight); - } - - public int GetHasFocus(int[] aHasFocus) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 37, getAddress(), aHasFocus); - } - - public int SetHasFocus(int aHasFocus) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 38, getAddress(), aHasFocus); - } - - public int GetCanvasHasFocus(int[] aCanvasHasFocus) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 39, getAddress(), aCanvasHasFocus); - } - - public int SetCanvasHasFocus(int aCanvasHasFocus) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 40, getAddress(), aCanvasHasFocus); - } - - public int TabToTreeOwner(int forward, int[] tookFocus) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 41, getAddress(), forward, tookFocus); - } - - public static final int BUSY_FLAGS_NONE = 0; - - public static final int BUSY_FLAGS_BUSY = 1; - - public static final int BUSY_FLAGS_BEFORE_PAGE_LOAD = 2; - - public static final int BUSY_FLAGS_PAGE_LOADING = 4; - - public static final int LOAD_CMD_NORMAL = 1; - - public static final int LOAD_CMD_RELOAD = 2; - - public static final int LOAD_CMD_HISTORY = 4; - - public int GetBusyFlags(int[] aBusyFlags) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 42, getAddress(), aBusyFlags); - } - - public int GetLoadType(int[] aLoadType) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 43, getAddress(), aLoadType); - } - - public int SetLoadType(int aLoadType) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 44, getAddress(), aLoadType); - } - - public int IsBeingDestroyed(int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 45, getAddress(), _retval); - } - - public int GetIsExecutingOnLoadHandler(int[] aIsExecutingOnLoadHandler) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 46, getAddress(), aIsExecutingOnLoadHandler); - } - - public int GetLayoutHistoryState(int /*long*/[] aLayoutHistoryState) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 47, getAddress(), aLayoutHistoryState); - } - - public int SetLayoutHistoryState(int /*long*/ aLayoutHistoryState) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 48, getAddress(), aLayoutHistoryState); - } - - public int GetShouldSaveLayoutState(int[] aShouldSaveLayoutState) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 49, getAddress(), aShouldSaveLayoutState); - } - - public int GetSecurityUI(int /*long*/[] aSecurityUI) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 50, getAddress(), aSecurityUI); - } - - public int SetSecurityUI(int /*long*/ aSecurityUI) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 51, getAddress(), aSecurityUI); - } - - public int SuspendRefreshURIs() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 52, getAddress()); - } - - public int ResumeRefreshURIs() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 53, getAddress()); - } - - public int BeginRestore(int /*long*/ viewer, int top) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 54, getAddress(), viewer, top); - } - - public int FinishRestore() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 55, getAddress()); - } - - public int GetRestoringDocument(int[] aRestoringDocument) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 56, getAddress(), aRestoringDocument); - } - - public int GetUseErrorPages(int[] aUseErrorPages) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 57, getAddress(), aUseErrorPages); - } - - public int SetUseErrorPages(int aUseErrorPages) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 58, getAddress(), aUseErrorPages); - } - - public int GetPreviousTransIndex(int[] aPreviousTransIndex) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 59, getAddress(), aPreviousTransIndex); - } - - public int GetLoadedTransIndex(int[] aLoadedTransIndex) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 60, getAddress(), aLoadedTransIndex); - } - - public int HistoryPurged(int numEntries) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 61, getAddress(), numEntries); - } - - public int GetSessionStorageForURI(int /*long*/ uri, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 62, getAddress(), uri, _retval); - } - - public int AddSessionStorage(int /*long*/ aDomain, int /*long*/ storage) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 63, getAddress(), aDomain, storage); - } - - public int GetCurrentDocumentChannel(int /*long*/[] aCurrentDocumentChannel) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 64, getAddress(), aCurrentDocumentChannel); - } - - public int SetChildOffset(int offset) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 65, getAddress(), offset); - } - - public int GetIsInUnload(int[] aIsInUnload) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 66, getAddress(), aIsInUnload); - } - - public int GetChannelIsUnsafe(int[] aChannelIsUnsafe) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 67, getAddress(), aChannelIsUnsafe); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIDocumentCharsetInfo.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,31 @@ +module dwt.internal.mozilla.nsIDocumentCharsetInfo; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIAtom; + +const char[] NS_IDOCUMENTCHARSETINFO_IID_STR = "2d40b291-01e1-11d4-9d0e-0050040007b2"; + +const nsIID NS_IDOCUMENTCHARSETINFO_IID= + {0x2d40b291, 0x01e1, 0x11d4, + [ 0x9d, 0x0e, 0x00, 0x50, 0x04, 0x00, 0x07, 0xb2 ]}; + +interface nsIDocumentCharsetInfo : nsISupports { + + static const char[] IID_STR = NS_IDOCUMENTCHARSETINFO_IID_STR; + static const nsIID IID = NS_IDOCUMENTCHARSETINFO_IID; + +extern(System): + nsresult GetForcedCharset(nsIAtom *aForcedCharset); + nsresult SetForcedCharset(nsIAtom aForcedCharset); + nsresult GetForcedDetector(PRBool *aForcedDetector); + nsresult SetForcedDetector(PRBool aForcedDetector); + nsresult GetParentCharset(nsIAtom *aParentCharset); + nsresult SetParentCharset(nsIAtom aParentCharset); + nsresult GetParentCharsetSource(PRInt32 *aParentCharsetSource); + nsresult SetParentCharsetSource(PRInt32 aParentCharsetSource); + +} +
--- a/dwt/internal/mozilla/nsIDownload.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIDownload.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,97 +1,41 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2004, 2005 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIDownload; -import dwt.dwthelper.utils; - -public class nsIDownload extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 13; - - public static final String NS_IDOWNLOAD_IID_STR = - "06cb92f2-1dd2-11b2-95f2-96dfdfb804a1"; - - public static final nsID NS_IDOWNLOAD_IID = - new nsID(NS_IDOWNLOAD_IID_STR); - - public nsIDownload(int /*long*/ address) { - super(address); - } +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsITransfer; +import dwt.internal.mozilla.nsIWebProgressListener; +import dwt.internal.mozilla.nsIURI; +import dwt.internal.mozilla.nsILocalFile; +import dwt.internal.mozilla.nsIObserver; +import dwt.internal.mozilla.nsICancelable; +import dwt.internal.mozilla.nsIMIMEInfo; +import dwt.internal.mozilla.nsStringAPI; +import dwt.internal.mozilla.prtime; - public int Init(int /*long*/ aSource, int /*long*/ aTarget, char[] aDisplayName, int /*long*/ aMIMEInfo, long startTime, int /*long*/ aPersist) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aSource, aTarget, aDisplayName, aMIMEInfo, startTime, aPersist); - } - - public int GetSource(int /*long*/[] aSource) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aSource); - } +const char[] NS_IDOWNLOAD_IID_STR = "9e1fd9f2-9727-4926-85cd-f16c375bba6d"; - public int GetTarget(int /*long*/[] aTarget) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aTarget); - } - - public int GetPersist(int /*long*/[] aPersist) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aPersist); - } +const nsIID NS_IDOWNLOAD_IID= + {0x9e1fd9f2, 0x9727, 0x4926, + [ 0x85, 0xcd, 0xf1, 0x6c, 0x37, 0x5b, 0xba, 0x6d ]}; - public int GetPercentComplete(int[] aPercentComplete) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aPercentComplete); - } - - public int GetDisplayName(int /*long*/[] aDisplayName) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aDisplayName); - } +interface nsIDownload : nsISupports { - public int SetDisplayName(char[] aDisplayName) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aDisplayName); - } - - public int GetStartTime(long[] aStartTime) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aStartTime); - } + static const char[] IID_STR = NS_IDOWNLOAD_IID_STR; + static const nsIID IID = NS_IDOWNLOAD_IID; - public int GetMIMEInfo(int /*long*/[] aMIMEInfo) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aMIMEInfo); - } - - public int GetListener(int /*long*/[] aListener) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), aListener); - } - - public int SetListener(int /*long*/ aListener) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 11, getAddress(), aListener); - } - - public int GetObserver(int /*long*/[] aObserver) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 12, getAddress(), aObserver); - } - - public int SetObserver(int /*long*/ aObserver) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 13, getAddress(), aObserver); - } +extern(System): + nsresult Init(nsIURI aSource, nsIURI aTarget, nsAString* aDisplayName, nsIMIMEInfo aMIMEInfo, PRTime startTime, PRBool aPersist); + nsresult GetSource(nsIURI *aSource); + nsresult GetTarget(nsIURI *aTarget); + nsresult GetPersist(PRBool *aPersist); + nsresult GetPercentComplete(PRInt32 *aPercentComplete); + nsresult GetDisplayName(PRUnichar * *aDisplayName); + nsresult SetDisplayName(PRUnichar* aDisplayName); + nsresult GetStartTime(PRInt64 *aStartTime); + nsresult GetMIMEInfo(nsIMIMEInfo *aMIMEInfo); + nsresult GetListener(nsIWebProgressListener* aListener); + nsresult SetListener(nsIWebProgressListener aListener); + nsresult GetObserver(nsIObserver * aObserver); + nsresult SetObserver(nsIObserver aObserver); }
--- a/dwt/internal/mozilla/nsIDownload_1_8.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIDownload_1_8.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,85 +1,35 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIDownload_1_8; -import dwt.dwthelper.utils; - -public class nsIDownload_1_8 extends nsITransfer { - - static final int LAST_METHOD_ID = nsITransfer.LAST_METHOD_ID + 10; - - public static final String NS_IDOWNLOAD_IID_STR = - "9e1fd9f2-9727-4926-85cd-f16c375bba6d"; - - public static final nsID NS_IDOWNLOAD_IID = - new nsID(NS_IDOWNLOAD_IID_STR); +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsITransfer; +import dwt.internal.mozilla.nsIURI; +import dwt.internal.mozilla.nsILocalFile; +import dwt.internal.mozilla.nsIObserver; +import dwt.internal.mozilla.nsICancelable; +import dwt.internal.mozilla.nsIMIMEInfo; - public nsIDownload_1_8(int /*long*/ address) { - super(address); - } - - public int GetTargetFile(int /*long*/[] aTargetFile) { - return XPCOM.VtblCall(nsITransfer.LAST_METHOD_ID + 1, getAddress(), aTargetFile); - } +const char[] NS_IDOWNLOAD_IID_STR = "9e1fd9f2-9727-4926-85cd-f16c375bba6d"; - public int GetPercentComplete(int[] aPercentComplete) { - return XPCOM.VtblCall(nsITransfer.LAST_METHOD_ID + 2, getAddress(), aPercentComplete); - } +const nsIID NS_IDOWNLOAD_IID= + {0x9e1fd9f2, 0x9727, 0x4926, + [ 0x85, 0xcd, 0xf1, 0x6c, 0x37, 0x5b, 0xba, 0x6d ]}; - public int GetAmountTransferred(int /*long*/ aAmountTransferred) { - return XPCOM.VtblCall(nsITransfer.LAST_METHOD_ID + 3, getAddress(), aAmountTransferred); - } +interface nsIDownload_1_8 : nsITransfer { - public int GetSize(int /*long*/ aSize) { - return XPCOM.VtblCall(nsITransfer.LAST_METHOD_ID + 4, getAddress(), aSize); - } - - public int GetSource(int /*long*/[] aSource) { - return XPCOM.VtblCall(nsITransfer.LAST_METHOD_ID + 5, getAddress(), aSource); - } - - public int GetTarget(int /*long*/[] aTarget) { - return XPCOM.VtblCall(nsITransfer.LAST_METHOD_ID + 6, getAddress(), aTarget); - } + static const char[] IID_STR = NS_IDOWNLOAD_IID_STR; + static const nsIID IID = NS_IDOWNLOAD_IID; - public int GetCancelable(int /*long*/[] aCancelable) { - return XPCOM.VtblCall(nsITransfer.LAST_METHOD_ID + 7, getAddress(), aCancelable); - } - - public int GetDisplayName(int /*long*/[] aDisplayName) { - return XPCOM.VtblCall(nsITransfer.LAST_METHOD_ID + 8, getAddress(), aDisplayName); - } +extern(System): + nsresult GetTargetFile(nsILocalFile *aTargetFile); + nsresult GetPercentComplete(PRInt32 *aPercentComplete); + nsresult GetAmountTransferred(PRUint64 *aAmountTransferred); + nsresult GetSize(PRUint64 *aSize); + nsresult GetSource(nsIURI *aSource); + nsresult GetTarget(nsIURI *aTarget); + nsresult GetCancelable(nsICancelable *aCancelable); + nsresult GetDisplayName(PRUnichar * *aDisplayName); + nsresult GetStartTime(PRInt64 *aStartTime); + nsresult GetMIMEInfo(nsIMIMEInfo *aMIMEInfo); - public int GetStartTime(long[] aStartTime) { - return XPCOM.VtblCall(nsITransfer.LAST_METHOD_ID + 9, getAddress(), aStartTime); - } - - public int GetMIMEInfo(int /*long*/[] aMIMEInfo) { - return XPCOM.VtblCall(nsITransfer.LAST_METHOD_ID + 10, getAddress(), aMIMEInfo); - } -} +} \ No newline at end of file
--- a/dwt/internal/mozilla/nsIEmbeddingSiteWindow.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIEmbeddingSiteWindow.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,83 +1,33 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIEmbeddingSiteWindow; -import dwt.dwthelper.utils; - -public class nsIEmbeddingSiteWindow extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 8; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public static final String NS_IEMBEDDINGSITEWINDOW_IID_STR = - "3e5432cd-9568-4bd1-8cbe-d50aba110743"; - - public static final nsID NS_IEMBEDDINGSITEWINDOW_IID = - new nsID(NS_IEMBEDDINGSITEWINDOW_IID_STR); +const char[] NS_IEMBEDDINGSITEWINDOW_IID_STR = "3e5432cd-9568-4bd1-8cbe-d50aba110743"; - public nsIEmbeddingSiteWindow(int /*long*/ address) { - super(address); - } - - public static final int DIM_FLAGS_POSITION = 1; +const nsIID NS_IEMBEDDINGSITEWINDOW_IID= + {0x3e5432cd, 0x9568, 0x4bd1, + [ 0x8c, 0xbe, 0xd5, 0x0a, 0xba, 0x11, 0x07, 0x43 ]}; - public static final int DIM_FLAGS_SIZE_INNER = 2; - - public static final int DIM_FLAGS_SIZE_OUTER = 4; +interface nsIEmbeddingSiteWindow : nsISupports { - public int SetDimensions(int flags, int x, int y, int cx, int cy) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), flags, x, y, cx, cy); - } + static const char[] IID_STR = NS_IEMBEDDINGSITEWINDOW_IID_STR; + static const nsIID IID = NS_IEMBEDDINGSITEWINDOW_IID; - public int GetDimensions(int flags, int[] x, int[] y, int[] cx, int[] cy) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), flags, x, y, cx, cy); - } - - public int SetFocus() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress()); - } - - public int GetVisibility(int[] aVisibility) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aVisibility); - } + enum { DIM_FLAGS_POSITION = 1U }; + enum { DIM_FLAGS_SIZE_INNER = 2U }; + enum { DIM_FLAGS_SIZE_OUTER = 4U }; - public int SetVisibility(int aVisibility) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aVisibility); - } - - public int GetTitle(int /*long*/[] aTitle) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aTitle); - } +extern(System): + nsresult SetDimensions(PRUint32 flags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy); + nsresult GetDimensions(PRUint32 flags, PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy); + nsresult SetFocus(); + nsresult GetVisibility(PRBool *aVisibility); + nsresult SetVisibility(PRBool aVisibility); + nsresult GetTitle(PRUnichar * *aTitle); + nsresult SetTitle(PRUnichar * aTitle); + nsresult GetSiteWindow(void * *aSiteWindow); - public int SetTitle(char[] aTitle) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aTitle); - } +} - public int GetSiteWindow(int /*long*/[] aSiteWindow) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aSiteWindow); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIEmbeddingSiteWindow2.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,22 @@ +module dwt.internal.mozilla.nsIEmbeddingSiteWindow2; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsIEmbeddingSiteWindow; + +const char[] NS_IEMBEDDINGSITEWINDOW2_IID_STR = "e932bf55-0a64-4beb-923a-1f32d3661044"; + +const nsIID NS_IEMBEDDINGSITEWINDOW2_IID= + {0xe932bf55, 0x0a64, 0x4beb, + [ 0x92, 0x3a, 0x1f, 0x32, 0xd3, 0x66, 0x10, 0x44 ]}; + +interface nsIEmbeddingSiteWindow2 : nsIEmbeddingSiteWindow { + + static const char[] IID_STR = NS_IEMBEDDINGSITEWINDOW2_IID_STR; + static const nsIID IID = NS_IEMBEDDINGSITEWINDOW2_IID; + +extern(System): + nsresult Blur(); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIEnumerator.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,50 @@ +module dwt.internal.mozilla.nsIEnumerator; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +/****************************************************************************** + +******************************************************************************/ + +const char[] NS_IENUMERATOR_IID_STR = "ad385286-cbc4-11d2-8cca-0060b0fc14a3"; + +const nsIID NS_IENUMERATOR_IID= + {0xad385286, 0xcbc4, 0x11d2, + [ 0x8c, 0xca, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3 ]}; + +interface nsIEnumerator : nsISupports { + + static const char[] IID_STR = NS_IENUMERATOR_IID_STR; + static const nsIID IID = NS_IENUMERATOR_IID; + +extern(System): + nsresult First(); + nsresult Next(); + nsresult CurrentItem(nsISupports *_retval); + nsresult IsDone(); + +} + +/****************************************************************************** + +******************************************************************************/ + +const char[] NS_IBIDIRECTIONALENUMERATOR_IID_STR = "75f158a0-cadd-11d2-8cca-0060b0fc14a3"; + +const nsIID NS_IBIDIRECTIONALENUMERATOR_IID= + {0x75f158a0, 0xcadd, 0x11d2, + [ 0x8c, 0xca, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3 ]}; + +interface nsIBidirectionalEnumerator : nsIEnumerator { + + static const char[] IID_STR = NS_IBIDIRECTIONALENUMERATOR_IID_STR; + static const nsIID IID = NS_IBIDIRECTIONALENUMERATOR_IID; + +extern(System): + nsresult Last(); + nsresult Prev(); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIEventQueue.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,38 @@ +module dwt.internal.mozilla.nsIEventQueue; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsIEventTarget; + +const char[] NS_IEVENTQUEUE_IID_STR = "176afb41-00a4-11d3-9f2a-00400553eef0"; +const nsIID NS_IEVENTQUEUE_IID= + {0x176afb41, 0x00a4, 0x11d3, + [ 0x9f, 0x2a, 0x00, 0x40, 0x05, 0x53, 0xee, 0xf0 ]}; + +interface nsIEventQueue : nsIEventTarget { + static const char[] IID_STR = NS_IEVENTQUEUE_IID_STR; + static const nsIID IID = NS_IEVENTQUEUE_IID; + +extern(System): + nsresult InitEvent(PLEvent * aEvent, void * owner, PLHandleEventProc handler, PLDestroyEventProc destructor); + nsresult PostSynchronousEvent(PLEvent * aEvent, void * *aResult); + nsresult PendingEvents(PRBool *_retval); + nsresult ProcessPendingEvents(); + nsresult EventLoop(); + nsresult EventAvailable(PRBool * aResult); + nsresult GetEvent(PLEvent * *_retval); + nsresult HandleEvent(PLEvent * aEvent); + nsresult WaitForEvent(PLEvent * *_retval); + PRInt32 GetEventQueueSelectFD(); + nsresult Init(PRBool aNative); + nsresult InitFromPRThread(PRThread * thread, PRBool aNative); + nsresult InitFromPLQueue(PLEventQueue * aQueue); + nsresult EnterMonitor(); + nsresult ExitMonitor(); + nsresult RevokeEvents(void * owner); + nsresult GetPLEventQueue(PLEventQueue * *_retval); + nsresult IsQueueNative(PRBool *_retval); + nsresult StopAcceptingEvents(); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIEventTarget.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,22 @@ +module dwt.internal.mozilla.nsIEventTarget; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsID; + +const char[] NS_IEVENTTARGET_IID_STR = "ea99ad5b-cc67-4efb-97c9-2ef620a59f2a"; + +const nsIID NS_IEVENTTARGET_IID= + {0xea99ad5b, 0xcc67, 0x4efb, + [ 0x97, 0xc9, 0x2e, 0xf6, 0x20, 0xa5, 0x9f, 0x2a ]}; + +interface nsIEventTarget : nsISupports { + + static const char[] IID_STR = NS_IEVENTTARGET_IID_STR; + static const nsIID IID = NS_IEVENTTARGET_IID; + +extern(System): + nsresult PostEvent(PLEvent * aEvent); + nsresult IsOnCurrentThread(PRBool *_retval); +} +
--- a/dwt/internal/mozilla/nsIFactory.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIFactory.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,53 +1,22 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ + module dwt.internal.mozilla.nsIFactory; -import dwt.dwthelper.utils; - -public class nsIFactory extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 2; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public static final String NS_IFACTORY_IID_STR = - "00000001-0000-0000-c000-000000000046"; +const char[] NS_IFACTORY_IID_STR = "00000001-0000-0000-c000-000000000046"; - public static final nsID NS_IFACTORY_IID = - new nsID(NS_IFACTORY_IID_STR); +const nsIID NS_IFACTORY_IID= + {0x00000001, 0x0000, 0x0000, + [ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 ]}; - public nsIFactory(int /*long*/ address) { - super(address); - } +interface nsIFactory : nsISupports { + + static const char[] IID_STR = NS_IFACTORY_IID_STR; + static const nsIID IID = NS_IFACTORY_IID; - public int CreateInstance(int /*long*/ aOuter, nsID iid, int /*long*/[] result) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aOuter, iid, result); - } - - public int LockFactory(int lock) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), lock); - } -} +extern(System): + nsresult CreateInstance(nsISupports aOuter, nsIID * iid, void * *result); + nsresult LockFactory(PRBool lock); +} \ No newline at end of file
--- a/dwt/internal/mozilla/nsIFile.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIFile.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,229 +1,69 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIFile; -import dwt.dwthelper.utils; - -public class nsIFile extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 45; - - public static final String NS_IFILE_IID_STR = - "c8c0a080-0868-11d3-915f-d9d889d48e3c"; - - public static final nsID NS_IFILE_IID = - new nsID(NS_IFILE_IID_STR); - - public nsIFile(int /*long*/ address) { - super(address); - } - - public static final int NORMAL_FILE_TYPE = 0; - - public static final int DIRECTORY_TYPE = 1; - - public int Append(int /*long*/ node) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), node); - } +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsISimpleEnumerator; +import dwt.internal.mozilla.nsStringAPI; - public int AppendNative(int /*long*/ node) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), node); - } - - public int Normalize() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress()); - } - - public int Create(int type, int permissions) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), type, permissions); - } - - public int GetLeafName(int /*long*/ aLeafName) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aLeafName); - } - - public int SetLeafName(int /*long*/ aLeafName) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aLeafName); - } - - public int GetNativeLeafName(int /*long*/ aNativeLeafName) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aNativeLeafName); - } +const char[] NS_IFILE_IID_STR = "c8c0a080-0868-11d3-915f-d9d889d48e3c"; - public int SetNativeLeafName(int /*long*/ aNativeLeafName) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aNativeLeafName); - } - - public int CopyTo(int /*long*/ newParentDir, int /*long*/ newName) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), newParentDir, newName); - } - - public int CopyToNative(int /*long*/ newParentDir, int /*long*/ newName) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), newParentDir, newName); - } - - public int CopyToFollowingLinks(int /*long*/ newParentDir, int /*long*/ newName) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 11, getAddress(), newParentDir, newName); - } - - public int CopyToFollowingLinksNative(int /*long*/ newParentDir, int /*long*/ newName) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 12, getAddress(), newParentDir, newName); - } - - public int MoveTo(int /*long*/ newParentDir, int /*long*/ newName) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 13, getAddress(), newParentDir, newName); - } +const nsIID NS_IFILE_IID= + {0xc8c0a080, 0x0868, 0x11d3, + [ 0x91, 0x5f, 0xd9, 0xd8, 0x89, 0xd4, 0x8e, 0x3c ]}; - public int MoveToNative(int /*long*/ newParentDir, int /*long*/ newName) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 14, getAddress(), newParentDir, newName); - } - - public int Remove(int recursive) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 15, getAddress(), recursive); - } - - public int GetPermissions(int[] aPermissions) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 16, getAddress(), aPermissions); - } +interface nsIFile : nsISupports { + static const char[] IID_STR = NS_IFILE_IID_STR; + static const nsIID IID = NS_IFILE_IID; - public int SetPermissions(int aPermissions) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 17, getAddress(), aPermissions); - } - - public int GetPermissionsOfLink(int[] aPermissionsOfLink) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 18, getAddress(), aPermissionsOfLink); - } - - public int SetPermissionsOfLink(int aPermissionsOfLink) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 19, getAddress(), aPermissionsOfLink); - } - - public int GetLastModifiedTime(long[] aLastModifiedTime) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 20, getAddress(), aLastModifiedTime); - } + enum { NORMAL_FILE_TYPE = 0U }; + enum { DIRECTORY_TYPE = 1U }; - public int SetLastModifiedTime(long aLastModifiedTime) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 21, getAddress(), aLastModifiedTime); - } - - public int GetLastModifiedTimeOfLink(long[] aLastModifiedTimeOfLink) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 22, getAddress(), aLastModifiedTimeOfLink); - } - - public int SetLastModifiedTimeOfLink(long aLastModifiedTimeOfLink) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 23, getAddress(), aLastModifiedTimeOfLink); - } - - public int GetFileSize(long[] aFileSize) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 24, getAddress(), aFileSize); - } - - public int SetFileSize(long aFileSize) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 25, getAddress(), aFileSize); - } - - public int GetFileSizeOfLink(long[] aFileSizeOfLink) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 26, getAddress(), aFileSizeOfLink); - } - - public int GetTarget(int /*long*/ aTarget) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 27, getAddress(), aTarget); - } - - public int GetNativeTarget(int /*long*/ aNativeTarget) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 28, getAddress(), aNativeTarget); - } - - public int GetPath(int /*long*/ aPath) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 29, getAddress(), aPath); - } - - public int GetNativePath(int /*long*/ aNativePath) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 30, getAddress(), aNativePath); - } - - public int Exists(int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 31, getAddress(), _retval); - } - - public int IsWritable(int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 32, getAddress(), _retval); - } +extern(System): + nsresult Append(nsAString * node); + nsresult AppendNative(nsACString * node); + nsresult Normalize(); + nsresult Create(PRUint32 type, PRUint32 permissions); + nsresult GetLeafName(nsAString * aLeafName); + nsresult SetLeafName(nsAString * aLeafName); + nsresult GetNativeLeafName(nsACString * aNativeLeafName); + nsresult SetNativeLeafName(nsACString * aNativeLeafName); + nsresult CopyTo(nsIFile newParentDir, nsAString * newName); + nsresult CopyToNative(nsIFile newParentDir, nsACString * newName); + nsresult CopyToFollowingLinks(nsIFile newParentDir, nsAString * newName); + nsresult CopyToFollowingLinksNative(nsIFile newParentDir, nsACString * newName); + nsresult MoveTo(nsIFile newParentDir, nsAString * newName); + nsresult MoveToNative(nsIFile newParentDir, nsACString * newName); + nsresult Remove(PRBool recursive); + nsresult GetPermissions(PRUint32 *aPermissions); + nsresult SetPermissions(PRUint32 aPermissions); + nsresult GetPermissionsOfLink(PRUint32 *aPermissionsOfLink); + nsresult SetPermissionsOfLink(PRUint32 aPermissionsOfLink); + nsresult GetLastModifiedTime(PRInt64 *aLastModifiedTime); + nsresult SetLastModifiedTime(PRInt64 aLastModifiedTime); + nsresult GetLastModifiedTimeOfLink(PRInt64 *aLastModifiedTimeOfLink); + nsresult SetLastModifiedTimeOfLink(PRInt64 aLastModifiedTimeOfLink); + nsresult GetFileSize(PRInt64 *aFileSize); + nsresult SetFileSize(PRInt64 aFileSize); + nsresult GetFileSizeOfLink(PRInt64 *aFileSizeOfLink); + nsresult GetTarget(nsAString * aTarget); + nsresult GetNativeTarget(nsACString * aNativeTarget); + nsresult GetPath(nsAString * aPath); + nsresult GetNativePath(nsACString * aNativePath); + nsresult Exists(PRBool *_retval); + nsresult IsWritable(PRBool *_retval); + nsresult IsReadable(PRBool *_retval); + nsresult IsExecutable(PRBool *_retval); + nsresult IsHidden(PRBool *_retval); + nsresult IsDirectory(PRBool *_retval); + nsresult IsFile(PRBool *_retval); + nsresult IsSymlink(PRBool *_retval); + nsresult IsSpecial(PRBool *_retval); + nsresult CreateUnique(PRUint32 type, PRUint32 permissions); + nsresult Clone(nsIFile *_retval); + nsresult Equals(nsIFile inFile, PRBool *_retval); + nsresult Contains(nsIFile inFile, PRBool recur, PRBool *_retval); + nsresult GetParent(nsIFile *aParent); + nsresult GetDirectoryEntries(nsISimpleEnumerator *aDirectoryEntries); +} - public int IsReadable(int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 33, getAddress(), _retval); - } - - public int IsExecutable(int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 34, getAddress(), _retval); - } - - public int IsHidden(int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 35, getAddress(), _retval); - } - - public int IsDirectory(int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 36, getAddress(), _retval); - } - - public int IsFile(int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 37, getAddress(), _retval); - } - - public int IsSymlink(int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 38, getAddress(), _retval); - } - - public int IsSpecial(int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 39, getAddress(), _retval); - } - - public int CreateUnique(int type, int permissions) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 40, getAddress(), type, permissions); - } - - public int Clone(int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 41, getAddress(), _retval); - } - - public int Equals(int /*long*/ inFile, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 42, getAddress(), inFile, _retval); - } - - public int Contains(int /*long*/ inFile, int recur, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 43, getAddress(), inFile, recur, _retval); - } - - public int GetParent(int /*long*/[] aParent) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 44, getAddress(), aParent); - } - - public int GetDirectoryEntries(int /*long*/[] aDirectoryEntries) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 45, getAddress(), aDirectoryEntries); - } -}
--- a/dwt/internal/mozilla/nsIFilePicker.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIFilePicker.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,120 +1,56 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2005 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIFilePicker; -import dwt.dwthelper.utils; - -public class nsIFilePicker extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 15; - - public static final String NS_IFILEPICKER_IID_STR = - "c47de916-1dd1-11b2-8141-82507fa02b21"; - - public static final nsID NS_IFILEPICKER_IID = - new nsID(NS_IFILEPICKER_IID_STR); - - public nsIFilePicker(int /*long*/ address) { - super(address); - } +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsILocalFile; +import dwt.internal.mozilla.nsIFileURL; +import dwt.internal.mozilla.nsIDOMWindow; +import dwt.internal.mozilla.nsISimpleEnumerator; +import dwt.internal.mozilla.nsStringAPI; - public static final int modeOpen = 0; - public static final int modeSave = 1; - public static final int modeGetFolder = 2; - public static final int modeOpenMultiple = 3; - public static final int returnOK = 0; - public static final int returnCancel = 1; - public static final int returnReplace = 2; - public static final int filterAll = 1; - public static final int filterHTML = 2; - public static final int filterText = 4; - public static final int filterImages = 8; - public static final int filterXML = 16; - public static final int filterXUL = 32; - public static final int filterApps = 64; +const char[] NS_IFILEPICKER_IID_STR = "c47de916-1dd1-11b2-8141-82507fa02b21"; - public int Init(int /*long*/ parent, char[] title, int mode) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), parent, title, mode); - } +const nsIID NS_IFILEPICKER_IID= + {0xc47de916, 0x1dd1, 0x11b2, + [ 0x81, 0x41, 0x82, 0x50, 0x7f, 0xa0, 0x2b, 0x21 ]}; - public int AppendFilters(int filterMask) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), filterMask); - } +interface nsIFilePicker : nsISupports { - public int AppendFilter(char[] title, char[] filter) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), title, filter); - } + static const char[] IID_STR = NS_IFILEPICKER_IID_STR; + static const nsIID IID = NS_IFILEPICKER_IID; - public int GetDefaultString(int /*long*/[] aDefaultString) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aDefaultString); - } - - public int SetDefaultString(char[] aDefaultString) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aDefaultString); - } - - public int GetDefaultExtension(int /*long*/[] aDefaultExtension) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aDefaultExtension); - } - - public int SetDefaultExtension(char[] aDefaultExtension) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aDefaultExtension); - } - - public int GetFilterIndex(int[] aFilterIndex) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aFilterIndex); - } - - public int SetFilterIndex(int aFilterIndex) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aFilterIndex); - } + enum { modeOpen = 0 }; + enum { modeSave = 1 }; + enum { modeGetFolder = 2 }; + enum { modeOpenMultiple = 3 }; + enum { returnOK = 0 }; + enum { returnCancel = 1 }; + enum { returnReplace = 2 }; + enum { filterAll = 1 }; + enum { filterHTML = 2 }; + enum { filterText = 4 }; + enum { filterImages = 8 }; + enum { filterXML = 16 }; + enum { filterXUL = 32 }; + enum { filterApps = 64 }; - public int GetDisplayDirectory(int /*long*/[] aDisplayDirectory) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), aDisplayDirectory); - } - - public int SetDisplayDirectory(int /*long*/ aDisplayDirectory) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 11, getAddress(), aDisplayDirectory); - } - - public int GetFile(int /*long*/[] aFile) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 12, getAddress(), aFile); - } +extern(System): + nsresult Init(nsIDOMWindow parent, nsAString * title, PRInt16 mode); + nsresult AppendFilters(PRInt32 filterMask); + nsresult AppendFilter(nsAString * title, nsAString * filter); + nsresult GetDefaultString(nsAString * aDefaultString); + nsresult SetDefaultString(nsAString * aDefaultString); + nsresult GetDefaultExtension(nsAString * aDefaultExtension); + nsresult SetDefaultExtension(nsAString * aDefaultExtension); + nsresult GetFilterIndex(PRInt32 *aFilterIndex); + nsresult SetFilterIndex(PRInt32 aFilterIndex); + nsresult GetDisplayDirectory(nsILocalFile *aDisplayDirectory); + nsresult SetDisplayDirectory(nsILocalFile aDisplayDirectory); + nsresult GetFile(nsILocalFile *aFile); + nsresult GetFileURL(nsIFileURL *aFileURL); + nsresult GetFiles(nsISimpleEnumerator *aFiles); + nsresult Show(PRInt16 *_retval); - public int GetFileURL(int /*long*/[] aFileURL) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 13, getAddress(), aFileURL); - } +} - public int GetFiles(int /*long*/[] aFiles) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 14, getAddress(), aFiles); - } - - public int Show(int /*long*/ _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 15, getAddress(), _retval); - } -}
--- a/dwt/internal/mozilla/nsIFilePicker_1_8.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIFilePicker_1_8.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,120 +1,56 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIFilePicker_1_8; -import dwt.dwthelper.utils; - -public class nsIFilePicker_1_8 extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 15; - - public static final String NS_IFILEPICKER_IID_STR = - "80faf095-c807-4558-a2cc-185ed70754ea"; - - public static final nsID NS_IFILEPICKER_IID = - new nsID(NS_IFILEPICKER_IID_STR); - - public nsIFilePicker_1_8(int /*long*/ address) { - super(address); - } +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsILocalFile; +import dwt.internal.mozilla.nsIFileURL; +import dwt.internal.mozilla.nsIDOMWindow; +import dwt.internal.mozilla.nsISimpleEnumerator; +import dwt.internal.mozilla.nsStringAPI; - public static final int modeOpen = 0; - public static final int modeSave = 1; - public static final int modeGetFolder = 2; - public static final int modeOpenMultiple = 3; - public static final int returnOK = 0; - public static final int returnCancel = 1; - public static final int returnReplace = 2; - public static final int filterAll = 1; - public static final int filterHTML = 2; - public static final int filterText = 4; - public static final int filterImages = 8; - public static final int filterXML = 16; - public static final int filterXUL = 32; - public static final int filterApps = 64; +const char[] NS_IFILEPICKER_IID_STR = "80faf095-c807-4558-a2cc-185ed70754ea"; + +const nsIID NS_IFILEPICKER_IID= + {0x80faf095, 0xc807, 0x4558, + [ 0xa2, 0xcc, 0x18, 0x5e, 0xd7, 0x07, 0x54, 0xea ]}; - public int Init(int /*long*/ parent, int /*long*/ title, int mode) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), parent, title, mode); - } +//extern(System) +interface nsIFilePicker_1_8 : nsISupports { - public int AppendFilters(int filterMask) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), filterMask); - } - - public int AppendFilter(int /*long*/ title, int /*long*/ filter) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), title, filter); - } + static const char[] IID_STR = NS_IFILEPICKER_IID_STR; + static const nsIID IID = NS_IFILEPICKER_IID; - public int GetDefaultString(int /*long*/ aDefaultString) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aDefaultString); - } - - public int SetDefaultString(int /*long*/ aDefaultString) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aDefaultString); - } - - public int GetDefaultExtension(int /*long*/ aDefaultExtension) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aDefaultExtension); - } - - public int SetDefaultExtension(int /*long*/ aDefaultExtension) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aDefaultExtension); - } - - public int GetFilterIndex(int[] aFilterIndex) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aFilterIndex); - } - - public int SetFilterIndex(int aFilterIndex) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aFilterIndex); - } + enum { modeOpen = 0 }; + enum { modeSave = 1 }; + enum { modeGetFolder = 2 }; + enum { modeOpenMultiple = 3 }; + enum { returnOK = 0 }; + enum { returnCancel = 1 }; + enum { returnReplace = 2 }; + enum { filterAll = 1 }; + enum { filterHTML = 2 }; + enum { filterText = 4 }; + enum { filterImages = 8 }; + enum { filterXML = 16 }; + enum { filterXUL = 32 }; + enum { filterApps = 64 }; - public int GetDisplayDirectory(int /*long*/[] aDisplayDirectory) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), aDisplayDirectory); - } - - public int SetDisplayDirectory(int /*long*/ aDisplayDirectory) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 11, getAddress(), aDisplayDirectory); - } - - public int GetFile(int /*long*/[] aFile) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 12, getAddress(), aFile); - } +extern(System): + nsresult Init(nsIDOMWindow parent, nsAString * title, PRInt16 mode); + nsresult AppendFilters(PRInt32 filterMask); + nsresult AppendFilter(nsAString * title, nsAString * filter); + nsresult GetDefaultString(nsAString * aDefaultString); + nsresult SetDefaultString(nsAString * aDefaultString); + nsresult GetDefaultExtension(nsAString * aDefaultExtension); + nsresult SetDefaultExtension(nsAString * aDefaultExtension); + nsresult GetFilterIndex(PRInt32 *aFilterIndex); + nsresult SetFilterIndex(PRInt32 aFilterIndex); + nsresult GetDisplayDirectory(nsILocalFile *aDisplayDirectory); + nsresult SetDisplayDirectory(nsILocalFile aDisplayDirectory); + nsresult GetFile(nsILocalFile *aFile); + nsresult GetFileURL(nsIFileURL *aFileURL); + nsresult GetFiles(nsISimpleEnumerator *aFiles); + nsresult Show(PRInt16 *_retval); - public int GetFileURL(int /*long*/[] aFileURL) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 13, getAddress(), aFileURL); - } - - public int GetFiles(int /*long*/[] aFiles) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 14, getAddress(), aFiles); - } - - public int Show(int /*long*/ _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 15, getAddress(), _retval); - } -} +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIFileURL.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,24 @@ +module dwt.internal.mozilla.nsIFileURL; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsIURL; +import dwt.internal.mozilla.nsIFile; + +const char[] NS_IFILEURL_IID_STR = "d26b2e2e-1dd1-11b2-88f3-8545a7ba7949"; + +const nsIID NS_IFILEURL_IID= + {0xd26b2e2e, 0x1dd1, 0x11b2, + [ 0x88, 0xf3, 0x85, 0x45, 0xa7, 0xba, 0x79, 0x49 ]}; + +interface nsIFileURL : nsIURL { + + static const char[] IID_STR = NS_IFILEURL_IID_STR; + static const nsIID IID = NS_IFILEURL_IID; + +extern(System): + nsresult GetFile(nsIFile *aFile); + nsresult SetFile(nsIFile aFile); + +} +
--- a/dwt/internal/mozilla/nsIHelperAppLauncher.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIHelperAppLauncher.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,81 +1,35 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ -module dwt.internal.mozilla.nsIHelperAppLauncher; - -import dwt.dwthelper.utils; - -public class nsIHelperAppLauncher extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 9; - - public static final String NS_IHELPERAPPLAUNCHER_IID_STR = - "9503d0fe-4c9d-11d4-98d0-001083010e9b"; - - public static final nsID NS_IHELPERAPPLAUNCHER_IID = - new nsID(NS_IHELPERAPPLAUNCHER_IID_STR); - - public nsIHelperAppLauncher(int /*long*/ address) { - super(address); - } - - public int GetMIMEInfo(int /*long*/[] aMIMEInfo) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aMIMEInfo); - } - - public int GetSource(int /*long*/[] aSource) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aSource); - } - - public int GetSuggestedFileName(int /*long*/[] aSuggestedFileName) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aSuggestedFileName); - } - - public int SaveToDisk(int /*long*/ aNewFileLocation, int aRememberThisPreference) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aNewFileLocation, aRememberThisPreference); - } - - public int LaunchWithApplication(int /*long*/ aApplication, int aRememberThisPreference) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aApplication, aRememberThisPreference); - } - - public int Cancel() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress()); - } - - public int SetWebProgressListener(int /*long*/ aWebProgressListener) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aWebProgressListener); - } - - public int CloseProgressWindow() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress()); - } - - public int GetDownloadInfo(int /*long*/[] aSourceUrl, long[] aTimeDownloadStarted, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aSourceUrl, aTimeDownloadStarted, _retval); - } -} +module dwt.internal.mozilla.nsIHelperAppLauncher; + +private import dwt.internal.mozilla.Common; +private import dwt.internal.mozilla.nsID; +private import dwt.internal.mozilla.nsISupports; +private import dwt.internal.mozilla.nsIURI; +private import dwt.internal.mozilla.nsIMIMEInfo; +private import dwt.internal.mozilla.nsIFile; +private import dwt.internal.mozilla.nsIWebProgressListener; +private import dwt.internal.mozilla.nsStringAPI; +private import dwt.internal.mozilla.prtime; + +const char[] NS_IHELPERAPPLAUNCHER_IID_STR = "9503d0fe-4c9d-11d4-98d0-001083010e9b"; + +const nsIID NS_IHELPERAPPLAUNCHER_IID= + {0x9503d0fe, 0x4c9d, 0x11d4, + [ 0x98, 0xd0, 0x00, 0x10, 0x83, 0x01, 0x0e, 0x9b ]}; + +interface nsIHelperAppLauncher : nsISupports { + + static const char[] IID_STR = NS_IHELPERAPPLAUNCHER_IID_STR; + static const nsIID IID = NS_IHELPERAPPLAUNCHER_IID; + +extern(System): + nsresult GetMIMEInfo(nsIMIMEInfo *aMIMEInfo); + nsresult GetSource(nsIURI *aSource); + nsresult GetSuggestedFileName(nsAString * aSuggestedFileName); + nsresult SaveToDisk(nsIFile aNewFileLocation, PRBool aRememberThisPreference); + nsresult LaunchWithApplication(nsIFile aApplication, PRBool aRememberThisPreference); + nsresult Cancel(); + nsresult SetWebProgressListener(nsIWebProgressListener aWebProgressListener); + nsresult CloseProgressWindow(); + nsresult GetDownloadInfo( nsIURI* aSourceUrl, PRTime* aTimeDownloadStarted, nsIFile* result); + +} \ No newline at end of file
--- a/dwt/internal/mozilla/nsIHelperAppLauncherDialog.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIHelperAppLauncherDialog.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,57 +1,28 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2004, 2005 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIHelperAppLauncherDialog; -import dwt.dwthelper.utils; - -public class nsIHelperAppLauncherDialog extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 3; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIHelperAppLauncher; +import dwt.internal.mozilla.nsILocalFile; - public static final String NS_IHELPERAPPLAUNCHERDIALOG_IID_STR = - "d7ebddf0-4c84-11d4-807a-00600811a9c3"; +const char[] NS_IHELPERAPPLAUNCHERDIALOG_IID_STR = "d7ebddf0-4c84-11d4-807a-00600811a9c3"; - public static final nsID NS_IHELPERAPPLAUNCHERDIALOG_IID = - new nsID(NS_IHELPERAPPLAUNCHERDIALOG_IID_STR); +const nsIID NS_IHELPERAPPLAUNCHERDIALOG_IID= + { 0xd7ebddf0, 0x4c84, 0x11d4, [ 0x80,0x7a,0x00,0x60,0x08,0x11,0xa9,0xc3 ]}; + +interface nsIHelperAppLauncherDialog : nsISupports { - public nsIHelperAppLauncherDialog(int /*long*/ address) { - super(address); - } + static const char[] IID_STR = NS_IHELPERAPPLAUNCHERDIALOG_IID_STR; + static const nsIID IID = NS_IHELPERAPPLAUNCHERDIALOG_IID; - public int Show(int /*long*/ aLauncher, int /*long*/ aContext) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aLauncher, aContext); - } + enum { REASON_CANTHANDLE = 0U }; + enum { REASON_SERVERREQUEST = 1U }; + enum { REASON_TYPESNIFFED = 2U }; - public int PromptForSaveToFile(int /*long*/ aWindowContext, char[] aDefaultFile, char[] aSuggestedFileExtension, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aWindowContext, aDefaultFile, aSuggestedFileExtension, _retval); - } +extern(System): + nsresult Show(nsIHelperAppLauncher aLauncher, nsISupports aContext, PRUint32 aReason); + nsresult PromptForSaveToFile(nsIHelperAppLauncher aLauncher, nsISupports aWindowContext, PRUnichar *aDefaultFile, PRUnichar *aSuggestedFileExtension, nsILocalFile *_retval); - public int ShowProgressDialog(int /*long*/ aLauncher, int /*long*/ aContext) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aLauncher, aContext); - } } +
--- a/dwt/internal/mozilla/nsIHelperAppLauncherDialog_1_9.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIHelperAppLauncherDialog_1_9.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,59 +1,28 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIHelperAppLauncherDialog_1_9; -import dwt.dwthelper.utils; - -public class nsIHelperAppLauncherDialog_1_9 extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 2; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIHelperAppLauncher_1_9; +import dwt.internal.mozilla.nsILocalFile; - public static final String NS_IHELPERAPPLAUNCHERDIALOG_IID_STR = - "f3704fdc-8ae6-4eba-a3c3-f02958ac0649"; +const char[] NS_IHELPERAPPLAUNCHERDIALOG_1_9_IID_STR = "f3704fdc-8ae6-4eba-a3c3-f02958ac0649"; - public static final nsID NS_IHELPERAPPLAUNCHERDIALOG_IID = - new nsID(NS_IHELPERAPPLAUNCHERDIALOG_IID_STR); +const nsIID NS_IHELPERAPPLAUNCHERDIALOG_1_9_IID= + { 0xf3704fdc, 0x8ae6, 0x4eba, [ 0xa3,0xc3,0xf0,0x29,0x58,0xac,0x06,0x49 ]}; + +interface nsIHelperAppLauncherDialog_1_9 : nsISupports { - public nsIHelperAppLauncherDialog_1_9(int /*long*/ address) { - super(address); - } + static const char[] IID_STR = NS_IHELPERAPPLAUNCHERDIALOG_1_9_IID_STR; + static const nsIID IID = NS_IHELPERAPPLAUNCHERDIALOG_1_9_IID; - public static final int REASON_CANTHANDLE = 0; - - public static final int REASON_SERVERREQUEST = 1; + enum { REASON_CANTHANDLE = 0U }; + enum { REASON_SERVERREQUEST = 1U }; + enum { REASON_TYPESNIFFED = 2U }; - public static final int REASON_TYPESNIFFED = 2; +extern(System): + nsresult Show(nsIHelperAppLauncher_1_9 aLauncher, nsISupports aContext, PRUint32 aReason); + nsresult PromptForSaveToFile(nsIHelperAppLauncher_1_9 aLauncher, nsISupports aWindowContext, PRUnichar *aDefaultFile, PRUnichar *aSuggestedFileExtension, PRBool aForcePrompt, nsILocalFile *_retval); - public int Show(int /*long*/ aLauncher, int /*long*/ aWindowContext, int aReason) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aLauncher, aWindowContext, aReason); - } +} - public int PromptForSaveToFile(int /*long*/ aLauncher, int /*long*/ aWindowContext, char[] aDefaultFileName, char[] aSuggestedFileExtension, int aForcePrompt, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aLauncher, aWindowContext, aDefaultFileName, aSuggestedFileExtension, aForcePrompt, _retval); - } -}
--- a/dwt/internal/mozilla/nsIHelperAppLauncher_1_8.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIHelperAppLauncher_1_8.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,81 +1,35 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ -module dwt.internal.mozilla.nsIHelperAppLauncher_1_8; - -import dwt.dwthelper.utils; - -public class nsIHelperAppLauncher_1_8 extends nsICancelable { - - static final int LAST_METHOD_ID = nsICancelable.LAST_METHOD_ID + 9; - - public static final String NS_IHELPERAPPLAUNCHER_IID_STR = - "99a0882d-2ff9-4659-9952-9ac531ba5592"; - - public static final nsID NS_IHELPERAPPLAUNCHER_IID = - new nsID(NS_IHELPERAPPLAUNCHER_IID_STR); - - public nsIHelperAppLauncher_1_8(int /*long*/ address) { - super(address); - } - - public int GetMIMEInfo(int /*long*/[] aMIMEInfo) { - return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 1, getAddress(), aMIMEInfo); - } - - public int GetSource(int /*long*/[] aSource) { - return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 2, getAddress(), aSource); - } - - public int GetSuggestedFileName(int /*long*/ aSuggestedFileName) { - return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 3, getAddress(), aSuggestedFileName); - } - - public int SaveToDisk(int /*long*/ aNewFileLocation, int aRememberThisPreference) { - return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 4, getAddress(), aNewFileLocation, aRememberThisPreference); - } - - public int LaunchWithApplication(int /*long*/ aApplication, int aRememberThisPreference) { - return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 5, getAddress(), aApplication, aRememberThisPreference); - } - - public int SetWebProgressListener(int /*long*/ aWebProgressListener) { - return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 6, getAddress(), aWebProgressListener); - } - - public int CloseProgressWindow() { - return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 7, getAddress()); - } - - public int GetTargetFile(int /*long*/[] aTargetFile) { - return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 8, getAddress(), aTargetFile); - } - - public int GetTimeDownloadStarted(int /*long*/ aTimeDownloadStarted) { - return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 9, getAddress(), aTimeDownloadStarted); - } -} +module dwt.internal.mozilla.nsIHelperAppLauncher_1_8; + +private import dwt.internal.mozilla.Common; +private import dwt.internal.mozilla.nsID; +private import dwt.internal.mozilla.nsICancelable; +private import dwt.internal.mozilla.nsIURI; +private import dwt.internal.mozilla.nsIMIMEInfo; +private import dwt.internal.mozilla.nsIFile; +private import dwt.internal.mozilla.nsIWebProgressListener2; +private import dwt.internal.mozilla.nsStringAPI; +private import dwt.internal.mozilla.prtime; + +const char[] NS_IHELPERAPPLAUNCHER_1_8_IID_STR = "99a0882d-2ff9-4659-9952-9ac531ba5592"; + +const nsIID NS_IHELPERAPPLAUNCHER_1_8_IID= + {0x99a0882d, 0x2ff9, 0x4659, + [ 0x99, 0x52, 0x9a, 0xc5, 0x31, 0xba, 0x55, 0x92 ]}; + +interface nsIHelperAppLauncher_1_8 : nsICancelable { + + static const char[] IID_STR = NS_IHELPERAPPLAUNCHER_1_8_IID_STR; + static const nsIID IID = NS_IHELPERAPPLAUNCHER_1_8_IID; + +extern(System): + nsresult GetMIMEInfo(nsIMIMEInfo *aMIMEInfo); + nsresult GetSource(nsIURI *aSource); + nsresult GetSuggestedFileName(nsAString * aSuggestedFileName); + nsresult SaveToDisk(nsIFile aNewFileLocation, PRBool aRememberThisPreference); + nsresult LaunchWithApplication(nsIFile aApplication, PRBool aRememberThisPreference); + nsresult SetWebProgressListener(nsIWebProgressListener2 aWebProgressListener); + nsresult CloseProgressWindow(); + nsresult GetTargetFile(nsIFile *aTargetFile); + nsresult GetTimeDownloadStarted(PRTime *aTimeDownloadStarted); + +} \ No newline at end of file
--- a/dwt/internal/mozilla/nsIHelperAppLauncher_1_9.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIHelperAppLauncher_1_9.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,85 +1,35 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ -module dwt.internal.mozilla.nsIHelperAppLauncher_1_9; - -import dwt.dwthelper.utils; - -public class nsIHelperAppLauncher_1_9 extends nsICancelable { - - static final int LAST_METHOD_ID = nsICancelable.LAST_METHOD_ID + 10; - - public static final String NS_IHELPERAPPLAUNCHER_IID_STR = - "cc75c21a-0a79-4f68-90e1-563253d0c555"; - - public static final nsID NS_IHELPERAPPLAUNCHER_IID = - new nsID(NS_IHELPERAPPLAUNCHER_IID_STR); - - public nsIHelperAppLauncher_1_9(int /*long*/ address) { - super(address); - } - - public int GetMIMEInfo(int /*long*/[] aMIMEInfo) { - return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 1, getAddress(), aMIMEInfo); - } - - public int GetSource(int /*long*/[] aSource) { - return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 2, getAddress(), aSource); - } - - public int GetSuggestedFileName(int /*long*/ aSuggestedFileName) { - return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 3, getAddress(), aSuggestedFileName); - } - - public int SaveToDisk(int /*long*/ aNewFileLocation, int aRememberThisPreference) { - return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 4, getAddress(), aNewFileLocation, aRememberThisPreference); - } - - public int LaunchWithApplication(int /*long*/ aApplication, int aRememberThisPreference) { - return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 5, getAddress(), aApplication, aRememberThisPreference); - } - - public int SetWebProgressListener(int /*long*/ aWebProgressListener) { - return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 6, getAddress(), aWebProgressListener); - } - - public int CloseProgressWindow() { - return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 7, getAddress()); - } - - public int GetTargetFile(int /*long*/[] aTargetFile) { - return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 8, getAddress(), aTargetFile); - } - - public int GetTargetFileIsExecutable(int[] aTargetFileIsExecutable) { - return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 9, getAddress(), aTargetFileIsExecutable); - } - - public int GetTimeDownloadStarted(int /*long*/ aTimeDownloadStarted) { - return XPCOM.VtblCall(nsICancelable.LAST_METHOD_ID + 10, getAddress(), aTimeDownloadStarted); - } -} +module dwt.internal.mozilla.nsIHelperAppLauncher_1_9; + +private import dwt.internal.mozilla.Common; +private import dwt.internal.mozilla.nsID; +private import dwt.internal.mozilla.nsICancelable; +private import dwt.internal.mozilla.nsIURI; +private import dwt.internal.mozilla.nsIMIMEInfo; +private import dwt.internal.mozilla.nsIFile; +private import dwt.internal.mozilla.nsIWebProgressListener2; +private import dwt.internal.mozilla.nsStringAPI; +private import dwt.internal.mozilla.prtime; + +const char[] NS_IHELPERAPPLAUNCHER_1_9_IID_STR = "cc75c21a-0a79-4f68-90e1-563253d0c555"; + +const nsIID NS_IHELPERAPPLAUNCHER_1_9_IID= + {0xcc75c21a, 0x0a79, 0x4f68, + [ 0x90, 0xe1, 0x56, 0x32, 0x53, 0xd0, 0xc5, 0x55 ]}; + +interface nsIHelperAppLauncher_1_9 : nsICancelable { + + static const char[] IID_STR = NS_IHELPERAPPLAUNCHER_1_9_IID_STR; + static const nsIID IID = NS_IHELPERAPPLAUNCHER_1_9_IID; + +extern(System): + nsresult GetMIMEInfo(nsIMIMEInfo *aMIMEInfo); + nsresult GetSource(nsIURI *aSource); + nsresult GetSuggestedFileName(nsAString * aSuggestedFileName); + nsresult SaveToDisk(nsIFile aNewFileLocation, PRBool aRememberThisPreference); + nsresult LaunchWithApplication(nsIFile aApplication, PRBool aRememberThisPreference); + nsresult SetWebProgressListener(nsIWebProgressListener2 aWebProgressListener); + nsresult CloseProgressWindow(); + nsresult GetTargetFile(nsIFile *aTargetFile); + nsresult GetTargetFileIsExecutable(PRBool* aTargetFileIsExecutable); + nsresult GetTimeDownloadStarted(PRTime *aTimeDownloadStarted); +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIHistoryEntry.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,26 @@ +module dwt.internal.mozilla.nsIHistoryEntry; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIURI; + +const char[] NS_IHISTORYENTRY_IID_STR = "a41661d4-1417-11d5-9882-00c04fa02f40"; + +const nsIID NS_IHISTORYENTRY_IID= + {0xa41661d4, 0x1417, 0x11d5, + [ 0x98, 0x82, 0x00, 0xc0, 0x4f, 0xa0, 0x2f, 0x40 ]}; + +interface nsIHistoryEntry : nsISupports { + + static const char[] IID_STR = NS_IHISTORYENTRY_IID_STR; + static const nsIID IID = NS_IHISTORYENTRY_IID; + +extern(System): + nsresult GetURI(nsIURI *aURI); + nsresult GetTitle(PRUnichar * *aTitle); + nsresult GetIsSubFrame(PRBool *aIsSubFrame); + +} +
--- a/dwt/internal/mozilla/nsIIOService.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIIOService.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,85 +1,36 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIIOService; -import dwt.dwthelper.utils; - -public class nsIIOService extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 10; - - public static final String NS_IIOSERVICE_IID_STR = - "bddeda3f-9020-4d12-8c70-984ee9f7935e"; - - public static final nsID NS_IIOSERVICE_IID = - new nsID(NS_IIOSERVICE_IID_STR); +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIProtocolHandler; +import dwt.internal.mozilla.nsIChannel; +import dwt.internal.mozilla.nsIURI; +import dwt.internal.mozilla.nsIFile; +import dwt.internal.mozilla.nsStringAPI; - public nsIIOService(int /*long*/ address) { - super(address); - } - - public int GetProtocolHandler(byte[] aScheme, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aScheme, _retval); - } +const char[] NS_IIOSERVICE_IID_STR = "bddeda3f-9020-4d12-8c70-984ee9f7935e"; - public int GetProtocolFlags(byte[] aScheme, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aScheme, _retval); - } +const nsIID NS_IIOSERVICE_IID= + {0xbddeda3f, 0x9020, 0x4d12, + [ 0x8c, 0x70, 0x98, 0x4e, 0xe9, 0xf7, 0x93, 0x5e ]}; - public int NewURI(int /*long*/ aSpec, byte[] aOriginCharset, int /*long*/ aBaseURI, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aSpec, aOriginCharset, aBaseURI, _retval); - } +interface nsIIOService : nsISupports { - public int NewFileURI(int /*long*/ aFile, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aFile, _retval); - } - - public int NewChannelFromURI(int /*long*/ aURI, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aURI, _retval); - } - - public int NewChannel(int /*long*/ aSpec, byte[] aOriginCharset, int /*long*/ aBaseURI, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aSpec, aOriginCharset, aBaseURI, _retval); - } + static const char[] IID_STR = NS_IIOSERVICE_IID_STR; + static const nsIID IID = NS_IIOSERVICE_IID; - public int GetOffline(int[] aOffline) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aOffline); - } - - public int SetOffline(int aOffline) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aOffline); - } +extern(System): + nsresult GetProtocolHandler(char *aScheme, nsIProtocolHandler *_retval); + nsresult GetProtocolFlags(char *aScheme, PRUint32 *_retval); + nsresult NewURI(nsACString * aSpec, char *aOriginCharset, nsIURI aBaseURI, nsIURI *_retval); + nsresult NewFileURI(nsIFile aFile, nsIURI *_retval); + nsresult NewChannelFromURI(nsIURI aURI, nsIChannel *_retval); + nsresult NewChannel(nsACString * aSpec, char *aOriginCharset, nsIURI aBaseURI, nsIChannel *_retval); + nsresult GetOffline(PRBool *aOffline); + nsresult SetOffline(PRBool aOffline); + nsresult AllowPort(PRInt32 aPort, char *aScheme, PRBool *_retval); + nsresult ExtractScheme(nsACString * urlString, nsACString * _retval); - public int AllowPort(int aPort, byte[] aScheme, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aPort, aScheme, _retval); - } +} - public int ExtractScheme(int /*long*/ urlString, int /*long*/ _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), urlString, _retval); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIIOService2.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,23 @@ +module dwt.internal.mozilla.nsIIOService2; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsIIOService; + +const char[] NS_IIOSERVICE2_IID_STR = "d44fe6d4-ee35-4789-886a-eb8f0554d04e"; + +const nsIID NS_IIOSERVICE2_IID= + {0xd44fe6d4, 0xee35, 0x4789, + [ 0x88, 0x6a, 0xeb, 0x8f, 0x05, 0x54, 0xd0, 0x4e ]}; + +interface nsIIOService2 : nsIIOService { + + static const char[] IID_STR = NS_IIOSERVICE2_IID_STR; + static const nsIID IID = NS_IIOSERVICE2_IID; + +extern(System): + nsresult GetManageOfflineStatus(PRBool *aManageOfflineStatus); + nsresult SetManageOfflineStatus(PRBool aManageOfflineStatus); + +} +
--- a/dwt/internal/mozilla/nsIInputStream.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIInputStream.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,65 +1,33 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIInputStream; -import dwt.dwthelper.utils; - -public class nsIInputStream extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 5; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public static final String NS_IINPUTSTREAM_IID_STR = - "fa9c7f6c-61b3-11d4-9877-00c04fa0cf4a"; +typedef nsresult function(nsIInputStream aInStream, + void *aClosure, + byte *aFromSegment, + PRUint32 aToOffset, + PRUint32 aCount, + PRUint32 *aWriteCount) nsWriteSegmentFun; - public static final nsID NS_IINPUTSTREAM_IID = - new nsID(NS_IINPUTSTREAM_IID_STR); - - public nsIInputStream(int /*long*/ address) { - super(address); - } +const char[] NS_IINPUTSTREAM_IID_STR = "fa9c7f6c-61b3-11d4-9877-00c04fa0cf4a"; - public int Close() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress()); - } +const nsIID NS_IINPUTSTREAM_IID= + {0xfa9c7f6c, 0x61b3, 0x11d4, + [ 0x98, 0x77, 0x00, 0xc0, 0x4f, 0xa0, 0xcf, 0x4a ]}; - public int Available(int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), _retval); - } +interface nsIInputStream : nsISupports { + + static const char[] IID_STR = NS_IINPUTSTREAM_IID_STR; + static const nsIID IID = NS_IINPUTSTREAM_IID; - public int Read(byte[] aBuf, int aCount, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aBuf, aCount, _retval); - } +extern(System): + nsresult Close(); + nsresult Available(PRUint32 *_retval); + nsresult Read(byte * aBuf, PRUint32 aCount, PRUint32 *_retval); + nsresult ReadSegments(nsWriteSegmentFun aWriter, void * aClosure, PRUint32 aCount, PRUint32 *_retval); + nsresult IsNonBlocking(PRBool *_retval); - public int ReadSegments(int /*long*/ aWriter, int /*long*/ aClosure, int aCount, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aWriter, aClosure, aCount, _retval); - } +} - public int IsNonBlocking(int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), _retval); - } -}
--- a/dwt/internal/mozilla/nsIInterfaceRequestor.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIInterfaceRequestor.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,49 +1,22 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2005 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIInterfaceRequestor; -import dwt.dwthelper.utils; - -public class nsIInterfaceRequestor extends nsISupports { +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 1; +const char[] NS_IINTERFACEREQUESTOR_IID_STR = "033a1470-8b2a-11d3-af88-00a024ffc08c"; - public static final String NS_IINTERFACEREQUESTOR_IID_STR = - "033a1470-8b2a-11d3-af88-00a024ffc08c"; +const nsIID NS_IINTERFACEREQUESTOR_IID= + {0x033a1470, 0x8b2a, 0x11d3, + [ 0xaf, 0x88, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c ]}; - public static final nsID NS_IINTERFACEREQUESTOR_IID = - new nsID(NS_IINTERFACEREQUESTOR_IID_STR); +interface nsIInterfaceRequestor : nsISupports { + + static const char[] IID_STR = NS_IINTERFACEREQUESTOR_IID_STR; + static const nsIID IID = NS_IINTERFACEREQUESTOR_IID; - public nsIInterfaceRequestor(int /*long*/ address) { - super(address); - } +extern(System): + nsresult GetInterface(nsIID * uuid, void * *result); - public int GetInterface(nsID uuid, int /*long*/[] result) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), uuid, result); - } } +
--- a/dwt/internal/mozilla/nsIJSContextStack.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIJSContextStack.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,61 +1,72 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIJSContextStack; -import dwt.dwthelper.utils; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +/****************************************************************************** + +******************************************************************************/ -public class nsIJSContextStack extends nsISupports { +const char[] NS_IJSCONTEXTSTACK_IID_STR = "c67d8270-3189-11d3-9885-006008962422"; - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 4; +const nsIID NS_IJSCONTEXTSTACK_IID= + {0xc67d8270, 0x3189, 0x11d3, + [ 0x98, 0x85, 0x00, 0x60, 0x08, 0x96, 0x24, 0x22 ]}; + +interface nsIJSContextStack : nsISupports { - public static final String NS_IJSCONTEXTSTACK_IID_STR = - "c67d8270-3189-11d3-9885-006008962422"; + static const char[] IID_STR = NS_IJSCONTEXTSTACK_IID_STR; + static const nsIID IID = NS_IJSCONTEXTSTACK_IID; - public static final nsID NS_IJSCONTEXTSTACK_IID = - new nsID(NS_IJSCONTEXTSTACK_IID_STR); +extern(System): + nsresult GetCount(PRInt32 *aCount); + nsresult Peek(JSContext * *_retval); + nsresult Pop(JSContext * *_retval); + nsresult Push(JSContext * cx); - public nsIJSContextStack(int /*long*/ address) { - super(address); - } +} + +/****************************************************************************** + +******************************************************************************/ + +const char[] NS_IJSCONTEXTSTACKITERATOR_IID_STR = "c7e6b7aa-fc12-4ca7-b140-98c38b698961"; - public int GetCount(int[] aCount) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aCount); - } +const nsIID NS_IJSCONTEXTSTACKITERATOR_IID= + {0xc7e6b7aa, 0xfc12, 0x4ca7, + [ 0xb1, 0x40, 0x98, 0xc3, 0x8b, 0x69, 0x89, 0x61 ]}; + +interface nsIJSContextStackIterator : nsISupports { + + static const char[] IID_STR = NS_IJSCONTEXTSTACKITERATOR_IID_STR; + static const nsIID IID = NS_IJSCONTEXTSTACKITERATOR_IID; - public int Peek(int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), _retval); - } +extern(System): + nsresult Reset(nsIJSContextStack stack); + nsresult Done(PRBool *_retval); + nsresult Prev(JSContext * *_retval); + +} + +/****************************************************************************** - public int Pop(int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), _retval); - } +******************************************************************************/ + +const char[] NS_ITHREADJSCONTEXTSTACK_IID_STR = "a1339ae0-05c1-11d4-8f92-0010a4e73d9a"; + +const nsIID NS_ITHREADJSCONTEXTSTACK_IID= + {0xa1339ae0, 0x05c1, 0x11d4, + [ 0x8f, 0x92, 0x00, 0x10, 0xa4, 0xe7, 0x3d, 0x9a ]}; + +interface nsIThreadJSContextStack : nsIJSContextStack { - public int Push(int /*long*/ cx) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), cx); - } + static const char[] IID_STR = NS_ITHREADJSCONTEXTSTACK_IID_STR; + static const nsIID IID = NS_ITHREADJSCONTEXTSTACK_IID; + +extern(System): + nsresult GetSafeJSContext(JSContext * *aSafeJSContext); + nsresult SetSafeJSContext(JSContext * aSafeJSContext); + } +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsILoadGroup.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,36 @@ +module dwt.internal.mozilla.nsILoadGroup; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIRequest; +import dwt.internal.mozilla.nsISimpleEnumerator; +import dwt.internal.mozilla.nsIRequestObserver; +import dwt.internal.mozilla.nsIInterfaceRequestor; + +const char[] NS_ILOADGROUP_IID_STR = "3de0a31c-feaf-400f-9f1e-4ef71f8b20cc"; + +const nsIID NS_ILOADGROUP_IID= + {0x3de0a31c, 0xfeaf, 0x400f, + [ 0x9f, 0x1e, 0x4e, 0xf7, 0x1f, 0x8b, 0x20, 0xcc ]}; + +interface nsILoadGroup : nsIRequest { + + static const char[] IID_STR = NS_ILOADGROUP_IID_STR; + static const nsIID IID = NS_ILOADGROUP_IID; + +extern(System): + nsresult GetGroupObserver(nsIRequestObserver *aGroupObserver); + nsresult SetGroupObserver(nsIRequestObserver aGroupObserver); + nsresult GetDefaultLoadRequest(nsIRequest *aDefaultLoadRequest); + nsresult SetDefaultLoadRequest(nsIRequest aDefaultLoadRequest); + nsresult AddRequest(nsIRequest aRequest, nsISupports aContext); + nsresult RemoveRequest(nsIRequest aRequest, nsISupports aContext, nsresult aStatus); + nsresult GetRequests(nsISimpleEnumerator *aRequests); + nsresult GetActiveCount(PRUint32 *aActiveCount); + nsresult GetNotificationCallbacks(nsIInterfaceRequestor *aNotificationCallbacks); + nsresult SetNotificationCallbacks(nsIInterfaceRequestor aNotificationCallbacks); + +} +
--- a/dwt/internal/mozilla/nsILocalFile.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsILocalFile.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,113 +1,43 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsILocalFile; -import dwt.dwthelper.utils; - -public class nsILocalFile extends nsIFile { - - static final int LAST_METHOD_ID = nsIFile.LAST_METHOD_ID + 17; - - public static final String NS_ILOCALFILE_IID_STR = - "aa610f20-a889-11d3-8c81-000064657374"; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.prlink; +import dwt.internal.mozilla.prio; +import dwt.internal.mozilla.prtime; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsIFile; +import dwt.internal.mozilla.nsStringAPI; - public static final nsID NS_ILOCALFILE_IID = - new nsID(NS_ILOCALFILE_IID_STR); - - public nsILocalFile(int /*long*/ address) { - super(address); - } - - public int InitWithPath(int /*long*/ filePath) { - return XPCOM.VtblCall(nsIFile.LAST_METHOD_ID + 1, getAddress(), filePath); - } +import tango.stdc.stdio : FILE; - public int InitWithNativePath(int /*long*/ filePath) { - return XPCOM.VtblCall(nsIFile.LAST_METHOD_ID + 2, getAddress(), filePath); - } - - public int InitWithFile(int /*long*/ aFile) { - return XPCOM.VtblCall(nsIFile.LAST_METHOD_ID + 3, getAddress(), aFile); - } +const char[] NS_ILOCALFILE_IID_STR = "aa610f20-a889-11d3-8c81-000064657374"; - public int GetFollowLinks(int[] aFollowLinks) { - return XPCOM.VtblCall(nsIFile.LAST_METHOD_ID + 4, getAddress(), aFollowLinks); - } +const nsIID NS_ILOCALFILE_IID= + {0xaa610f20, 0xa889, 0x11d3, + [ 0x8c, 0x81, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74 ]}; - public int SetFollowLinks(int aFollowLinks) { - return XPCOM.VtblCall(nsIFile.LAST_METHOD_ID + 5, getAddress(), aFollowLinks); - } +interface nsILocalFile : nsIFile { - public int OpenNSPRFileDesc(int flags, int mode, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsIFile.LAST_METHOD_ID + 6, getAddress(), flags, mode, _retval); - } + static const char[] IID_STR = NS_ILOCALFILE_IID_STR; + static const nsIID IID = NS_ILOCALFILE_IID; - public int OpenANSIFileDesc(byte[] mode, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsIFile.LAST_METHOD_ID + 7, getAddress(), mode, _retval); - } - - public int Load(int /*long*/[] _retval) { - return XPCOM.VtblCall(nsIFile.LAST_METHOD_ID + 8, getAddress(), _retval); - } - - public int GetDiskSpaceAvailable(long[] aDiskSpaceAvailable) { - return XPCOM.VtblCall(nsIFile.LAST_METHOD_ID + 9, getAddress(), aDiskSpaceAvailable); - } - - public int AppendRelativePath(int /*long*/ relativeFilePath) { - return XPCOM.VtblCall(nsIFile.LAST_METHOD_ID + 10, getAddress(), relativeFilePath); - } - - public int AppendRelativeNativePath(int /*long*/ relativeFilePath) { - return XPCOM.VtblCall(nsIFile.LAST_METHOD_ID + 11, getAddress(), relativeFilePath); - } +extern(System): + nsresult InitWithPath(nsAString * filePath); + nsresult InitWithNativePath(nsACString * filePath); + nsresult InitWithFile(nsILocalFile aFile); + nsresult GetFollowLinks(PRBool *aFollowLinks); + nsresult SetFollowLinks(PRBool aFollowLinks); + nsresult OpenNSPRFileDesc(PRInt32 flags, PRInt32 mode, PRFileDesc * *_retval); + nsresult OpenANSIFileDesc(char *mode, FILE * *_retval); + nsresult Load(PRLibrary * *_retval); + nsresult GetDiskSpaceAvailable(PRInt64 *aDiskSpaceAvailable); + nsresult AppendRelativePath(nsAString * relativeFilePath); + nsresult AppendRelativeNativePath(nsACString * relativeFilePath); + nsresult GetPersistentDescriptor(nsACString * aPersistentDescriptor); + nsresult SetPersistentDescriptor(nsACString * aPersistentDescriptor); + nsresult Reveal(); + nsresult Launch(); + nsresult GetRelativeDescriptor(nsILocalFile fromFile, nsACString * _retval); + nsresult SetRelativeDescriptor(nsILocalFile fromFile, nsACString * relativeDesc); +} - public int GetPersistentDescriptor(int /*long*/ aPersistentDescriptor) { - return XPCOM.VtblCall(nsIFile.LAST_METHOD_ID + 12, getAddress(), aPersistentDescriptor); - } - - public int SetPersistentDescriptor(int /*long*/ aPersistentDescriptor) { - return XPCOM.VtblCall(nsIFile.LAST_METHOD_ID + 13, getAddress(), aPersistentDescriptor); - } - - public int Reveal() { - return XPCOM.VtblCall(nsIFile.LAST_METHOD_ID + 14, getAddress()); - } - - public int Launch() { - return XPCOM.VtblCall(nsIFile.LAST_METHOD_ID + 15, getAddress()); - } - - public int GetRelativeDescriptor(int /*long*/ fromFile, int /*long*/ _retval) { - return XPCOM.VtblCall(nsIFile.LAST_METHOD_ID + 16, getAddress(), fromFile, _retval); - } - - public int SetRelativeDescriptor(int /*long*/ fromFile, int /*long*/ relativeDesc) { - return XPCOM.VtblCall(nsIFile.LAST_METHOD_ID + 17, getAddress(), fromFile, relativeDesc); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIMIMEInfo.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,59 @@ +module dwt.internal.mozilla.nsIMIMEInfo; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIURI; +import dwt.internal.mozilla.nsIFile; +import dwt.internal.mozilla.nsIStringEnumerator; +import dwt.internal.mozilla.nsStringAPI; + +alias PRInt32 nsMIMEInfoHandleAction; + +const char[] NS_IMIMEINFO_IID_STR = "1448b42f-cf0d-466e-9a15-64e876ebe857"; + +const nsIID NS_IMIMEINFO_IID= + {0x1448b42f, 0xcf0d, 0x466e, + [ 0x9a, 0x15, 0x64, 0xe8, 0x76, 0xeb, 0xe8, 0x57 ]}; + +interface nsIMIMEInfo : nsISupports { + + static const char[] IID_STR = NS_IMIMEINFO_IID_STR; + static const nsIID IID = NS_IMIMEINFO_IID; + +extern(System): + nsresult GetFileExtensions(nsIUTF8StringEnumerator *_retval); + nsresult SetFileExtensions(nsACString * aExtensions); + nsresult ExtensionExists(nsACString * aExtension, PRBool *_retval); + nsresult AppendExtension(nsACString * aExtension); + nsresult GetPrimaryExtension(nsACString * aPrimaryExtension); + nsresult SetPrimaryExtension(nsACString * aPrimaryExtension); + nsresult GetMIMEType(nsACString * aMIMEType); + nsresult SetDescription(nsAString * aDescription); + nsresult GetMacType(PRUint32 *aMacType); + nsresult SetMacType(PRUint32 aMacType); + nsresult GetMacCreator(PRUint32 *aMacCreator); + nsresult SetMacCreator(PRUint32 aMacCreator); + nsresult Equals(nsIMIMEInfo aMIMEInfo, PRBool *_retval); + nsresult GetPreferredApplicationHandler(nsIFile *aPreferredApplicationHandler); + nsresult SetPreferredApplicationHandler(nsIFile aPreferredApplicationHandler); + nsresult GetApplicationDescription(nsAString * aApplicationDescription); + nsresult SetApplicationDescription(nsAString * aApplicationDescription); + nsresult GetHasDefaultHandler(PRBool *aHasDefaultHandler); + nsresult GetDefaultDescription(nsAString * aDefaultDescription); + nsresult LaunchWithFile(nsIFile aFile); + + enum { saveToDisk = 0 }; + enum { alwaysAsk = 1 }; + enum { useHelperApp = 2 }; + enum { handleInternally = 3 }; + enum { useSystemDefault = 4 }; + + nsresult GetPreferredAction(nsMIMEInfoHandleAction *aPreferredAction); + nsresult SetPreferredAction(nsMIMEInfoHandleAction aPreferredAction); + nsresult GetAlwaysAskBeforeHandling(PRBool *aAlwaysAskBeforeHandling); + nsresult SetAlwaysAskBeforeHandling(PRBool aAlwaysAskBeforeHandling); + +} +
--- a/dwt/internal/mozilla/nsIMemory.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIMemory.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,65 +1,24 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIMemory; -import dwt.dwthelper.utils; - -public class nsIMemory extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 5; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public static final String NS_IMEMORY_IID_STR = - "59e7e77a-38e4-11d4-8cf5-0060b0fc14a3"; +const char[] NS_IMEMORY_IID_STR = "59e7e77a-38e4-11d4-8cf5-0060b0fc14a3"; - public static final nsID NS_IMEMORY_IID = - new nsID(NS_IMEMORY_IID_STR); - - public nsIMemory(int /*long*/ address) { - super(address); - } +const nsIID NS_IMEMORY_IID= + {0x59e7e77a, 0x38e4, 0x11d4, + [ 0x8c, 0xf5, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3 ]}; - public int Alloc(int size) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), size); - } - - public int Realloc(int /*long*/ ptr, int newSize) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), ptr, newSize); - } +interface nsIMemory : nsISupports { + static const char[] IID_STR = NS_IMEMORY_IID_STR; + static const nsIID IID = NS_IMEMORY_IID; + +extern(System): + void * Alloc(size_t size); + void * Realloc(void * ptr, size_t newSize); + void Free(void * ptr); + nsresult HeapMinimize(PRBool immediate); + nsresult IsLowMemory(PRBool *_retval); +} - public int Free(int /*long*/ ptr) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), ptr); - } - - public int HeapMinimize(int immediate) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), immediate); - } - - public int IsLowMemory(int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), _retval); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIModule.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,25 @@ +module dwt.internal.mozilla.nsIModule; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIFile; +import dwt.internal.mozilla.nsIComponentManager; + +const char[] NS_IMODULE_IID_STR = "7392d032-5371-11d3-994e-00805fd26fee"; + +const nsIID NS_IMODULE_IID= + {0x7392d032, 0x5371, 0x11d3, + [ 0x99, 0x4e, 0x00, 0x80, 0x5f, 0xd2, 0x6f, 0xee ]}; + +interface nsIModule : nsISupports { + static const char[] IID_STR = NS_IMODULE_IID_STR; + static const nsIID IID = NS_IMODULE_IID; + +extern(System): + nsresult GetClassObject(nsIComponentManager aCompMgr, nsCID * aClass, nsIID * aIID, void * *aResult); + nsresult RegisterSelf(nsIComponentManager aCompMgr, nsIFile aLocation, char *aLoaderStr, char *aType); + nsresult UnregisterSelf(nsIComponentManager aCompMgr, nsIFile aLocation, char *aLoaderStr); + nsresult CanUnload(nsIComponentManager aCompMgr, PRBool *_retval); +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIObjectInputStream.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,27 @@ +module dwt.internal.mozilla.nsIObjectInputStream; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIBinaryInputStream; + +const char[] NS_IOBJECTINPUTSTREAM_IID_STR = "6c248606-4eae-46fa-9df0-ba58502368eb"; + +const nsIID NS_IOBJECTINPUTSTREAM_IID= + {0x6c248606, 0x4eae, 0x46fa, + [ 0x9d, 0xf0, 0xba, 0x58, 0x50, 0x23, 0x68, 0xeb ]}; + +interface nsIObjectInputStream : nsIBinaryInputStream { + + static const char[] IID_STR = NS_IOBJECTINPUTSTREAM_IID_STR; + static const nsIID IID = NS_IOBJECTINPUTSTREAM_IID; + +extern(System): + nsresult ReadObject(PRBool aIsStrongRef, nsISupports *_retval); + nsresult ReadID(nsID *aID); + char * GetBuffer(PRUint32 aLength, PRUint32 aAlignMask); + void PutBuffer(char * aBuffer, PRUint32 aLength); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIObjectOutputStream.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,29 @@ +module dwt.internal.mozilla.nsIObjectOutputStream; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIBinaryOutputStream; + +const char[] NS_IOBJECTOUTPUTSTREAM_IID_STR = "92c898ac-5fde-4b99-87b3-5d486422094b"; + +const nsIID NS_IOBJECTOUTPUTSTREAM_IID= + {0x92c898ac, 0x5fde, 0x4b99, + [ 0x87, 0xb3, 0x5d, 0x48, 0x64, 0x22, 0x09, 0x4b ]}; + +interface nsIObjectOutputStream : nsIBinaryOutputStream { + + static const char[] IID_STR = NS_IOBJECTOUTPUTSTREAM_IID_STR; + static const nsIID IID = NS_IOBJECTOUTPUTSTREAM_IID; + +extern(System): + nsresult WriteObject(nsISupports aObject, PRBool aIsStrongRef); + nsresult WriteSingleRefObject(nsISupports aObject); + nsresult WriteCompoundObject(nsISupports aObject, nsIID * aIID, PRBool aIsStrongRef); + nsresult WriteID(nsID * aID); + char * GetBuffer(PRUint32 aLength, PRUint32 aAlignMask); + void PutBuffer(char * aBuffer, PRUint32 aLength); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIObserver.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,22 @@ +module dwt.internal.mozilla.nsIObserver; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +const char[] NS_IOBSERVER_IID_STR = "db242e01-e4d9-11d2-9dde-000064657374"; + +const nsIID NS_IOBSERVER_IID= + {0xdb242e01, 0xe4d9, 0x11d2, + [ 0x9d, 0xde, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74 ]}; + +interface nsIObserver : nsISupports { + + static const char[] IID_STR = NS_IOBSERVER_IID_STR; + static const nsIID IID = NS_IOBSERVER_IID; + +extern(System): + nsresult Observe(nsISupports aSubject, char *aTopic, PRUnichar *aData); + +} +
--- a/dwt/internal/mozilla/nsIObserverService.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIObserverService.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,61 +1,27 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIObserverService; -import dwt.dwthelper.utils; - -public class nsIObserverService extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 4; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIObserver; +import dwt.internal.mozilla.nsISimpleEnumerator; - public static final String NS_IOBSERVERSERVICE_IID_STR = - "d07f5192-e3d1-11d2-8acd-00105a1b8860"; +const char[] NS_IOBSERVERSERVICE_IID_STR = "d07f5192-e3d1-11d2-8acd-00105a1b8860"; - public static final nsID NS_IOBSERVERSERVICE_IID = - new nsID(NS_IOBSERVERSERVICE_IID_STR); - - public nsIObserverService(int /*long*/ address) { - super(address); - } +const nsIID NS_IOBSERVERSERVICE_IID= + {0xd07f5192, 0xe3d1, 0x11d2, + [ 0x8a, 0xcd, 0x00, 0x10, 0x5a, 0x1b, 0x88, 0x60 ]}; - public int AddObserver(int /*long*/ anObserver, byte[] aTopic, int ownsWeak) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), anObserver, aTopic, ownsWeak); - } +interface nsIObserverService : nsISupports { - public int RemoveObserver(int /*long*/ anObserver, byte[] aTopic) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), anObserver, aTopic); - } + static const char[] IID_STR = NS_IOBSERVERSERVICE_IID_STR; + static const nsIID IID = NS_IOBSERVERSERVICE_IID; - public int NotifyObservers(int /*long*/ aSubject, byte[] aTopic, char[] someData) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aSubject, aTopic, someData); - } +extern(System): + nsresult AddObserver(nsIObserver anObserver, char *aTopic, PRBool ownsWeak); + nsresult RemoveObserver(nsIObserver anObserver, char *aTopic); + nsresult NotifyObservers(nsISupports aSubject, char *aTopic, PRUnichar *someData); + nsresult EnumerateObservers(char *aTopic, nsISimpleEnumerator *_retval); - public int EnumerateObservers(byte[] aTopic, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aTopic, _retval); - } } +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIOutputStream.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,36 @@ +module dwt.internal.mozilla.nsIOutputStream; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIInputStream; + +typedef nsresult function(nsIOutputStream aOutStream, + void *aClosure, + char *aToSegment, + PRUint32 aFromOffset, + PRUint32 aCount, + PRUint32 *aReadCount) nsReadSegmentFun; + +const char[] NS_IOUTPUTSTREAM_IID_STR = "0d0acd2a-61b4-11d4-9877-00c04fa0cf4a"; + +const nsIID NS_IOUTPUTSTREAM_IID= + {0x0d0acd2a, 0x61b4, 0x11d4, + [ 0x98, 0x77, 0x00, 0xc0, 0x4f, 0xa0, 0xcf, 0x4a ]}; + +interface nsIOutputStream : nsISupports { + + static const char[] IID_STR = NS_IOUTPUTSTREAM_IID_STR; + static const nsIID IID = NS_IOUTPUTSTREAM_IID; + +extern(System): + nsresult Close(); + nsresult Flush(); + nsresult Write(char *aBuf, PRUint32 aCount, PRUint32 *_retval); + nsresult WriteFrom(nsIInputStream aFromStream, PRUint32 aCount, PRUint32 *_retval); + nsresult WriteSegments(nsReadSegmentFun aReader, void * aClosure, PRUint32 aCount, PRUint32 *_retval); + nsresult IsNonBlocking(PRBool *_retval); + +} +
--- a/dwt/internal/mozilla/nsIPrefBranch.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIPrefBranch.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,125 +1,44 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIPrefBranch; -import dwt.dwthelper.utils; - -public class nsIPrefBranch extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 18; - - public static final String NS_IPREFBRANCH_IID_STR = - "56c35506-f14b-11d3-99d3-ddbfac2ccf65"; - - public static final nsID NS_IPREFBRANCH_IID = - new nsID(NS_IPREFBRANCH_IID_STR); +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public nsIPrefBranch(int /*long*/ address) { - super(address); - } - - public static final int PREF_INVALID = 0; +const char[] NS_IPREFBRANCH_IID_STR = "56c35506-f14b-11d3-99d3-ddbfac2ccf65"; - public static final int PREF_STRING = 32; - - public static final int PREF_INT = 64; - - public static final int PREF_BOOL = 128; +const nsIID NS_IPREFBRANCH_IID= + {0x56c35506, 0xf14b, 0x11d3, + [ 0x99, 0xd3, 0xdd, 0xbf, 0xac, 0x2c, 0xcf, 0x65 ]}; - public int GetRoot(int /*long*/[] aRoot) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aRoot); - } +interface nsIPrefBranch : nsISupports { - public int GetPrefType(byte[] aPrefName, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aPrefName, _retval); - } - - public int GetBoolPref(byte[] aPrefName, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aPrefName, _retval); - } + static const char[] IID_STR = NS_IPREFBRANCH_IID_STR; + static const nsIID IID = NS_IPREFBRANCH_IID; - public int SetBoolPref(byte[] aPrefName, int aValue) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aPrefName, aValue); - } - - public int GetCharPref(byte[] aPrefName, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aPrefName, _retval); - } - - public int SetCharPref(byte[] aPrefName, byte[] aValue) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aPrefName, aValue); - } + enum { PREF_INVALID = 0 }; + enum { PREF_STRING = 32 }; + enum { PREF_INT = 64 }; + enum { PREF_BOOL = 128 }; - public int GetIntPref(byte[] aPrefName, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aPrefName, _retval); - } - - public int SetIntPref(byte[] aPrefName, int aValue) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aPrefName, aValue); - } - - public int GetComplexValue(byte[] aPrefName, nsID aType, int /*long*/[] aValue) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aPrefName, aType, aValue); - } - - public int SetComplexValue(byte[] aPrefName, nsID aType, int /*long*/ aValue) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), aPrefName, aType, aValue); - } - - public int ClearUserPref(byte[] aPrefName) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 11, getAddress(), aPrefName); - } - - public int LockPref(byte[] aPrefName) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 12, getAddress(), aPrefName); - } +extern(System): + nsresult GetRoot(char * *aRoot); + nsresult GetPrefType(char *aPrefName, PRInt32 *_retval); + nsresult GetBoolPref(char *aPrefName, PRBool *_retval); + nsresult SetBoolPref(char *aPrefName, PRInt32 aValue); + nsresult GetCharPref(char *aPrefName, char **_retval); + nsresult SetCharPref(char *aPrefName, char *aValue); + nsresult GetIntPref(char *aPrefName, PRInt32 *_retval); + nsresult SetIntPref(char *aPrefName, PRInt32 aValue); + nsresult GetComplexValue(char *aPrefName, nsIID * aType, void * *aValue); + nsresult SetComplexValue(char *aPrefName, nsIID * aType, nsISupports aValue); + nsresult ClearUserPref(char *aPrefName); + nsresult LockPref(char *aPrefName); + nsresult PrefHasUserValue(char *aPrefName, PRBool *_retval); + nsresult PrefIsLocked(char *aPrefName, PRBool *_retval); + nsresult UnlockPref(char *aPrefName); + nsresult DeleteBranch(char *aStartingAt); + nsresult GetChildList(char *aStartingAt, PRUint32 *aCount, char ***aChildArray); + nsresult ResetBranch(char *aStartingAt); - public int PrefHasUserValue(byte[] aPrefName, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 13, getAddress(), aPrefName, _retval); - } - - public int PrefIsLocked(byte[] aPrefName, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 14, getAddress(), aPrefName, _retval); - } - - public int UnlockPref(byte[] aPrefName) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 15, getAddress(), aPrefName); - } +} - public int DeleteBranch(byte[] aStartingAt) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 16, getAddress(), aStartingAt); - } - - public int GetChildList(byte[] aStartingAt, int[] aCount, int /*long*/[] aChildArray) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 17, getAddress(), aStartingAt, aCount, aChildArray); - } - - public int ResetBranch(byte[] aStartingAt) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 18, getAddress(), aStartingAt); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIPrefBranch2.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,25 @@ +module dwt.internal.mozilla.nsIPrefBranch2; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIPrefBranch; +import dwt.internal.mozilla.nsIObserver; + +const char[] NS_IPREFBRANCH2_IID_STR = "74567534-eb94-4b1c-8f45-389643bfc555"; + +const nsIID NS_IPREFBRANCH2_IID= + {0x74567534, 0xeb94, 0x4b1c, + [ 0x8f, 0x45, 0x38, 0x96, 0x43, 0xbf, 0xc5, 0x55 ]}; + +interface nsIPrefBranch2 : nsIPrefBranch { + + static const char[] IID_STR = NS_IPREFBRANCH2_IID_STR; + static const nsIID IID = NS_IPREFBRANCH2_IID; + +extern(System): + nsresult AddObserver(char *aDomain, nsIObserver aObserver, PRBool aHoldWeak); + nsresult RemoveObserver(char *aDomain, nsIObserver aObserver); + +} +
--- a/dwt/internal/mozilla/nsIPrefLocalizedString.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIPrefLocalizedString.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,61 +1,25 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2006 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIPrefLocalizedString; -import dwt.dwthelper.utils; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; -public class nsIPrefLocalizedString extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 4; +const char[] NS_IPREFLOCALIZEDSTRING_IID_STR = "ae419e24-1dd1-11b2-b39a-d3e5e7073802"; - public static final String NS_IPREFLOCALIZEDSTRING_IID_STR = - "ae419e24-1dd1-11b2-b39a-d3e5e7073802"; +const nsIID NS_IPREFLOCALIZEDSTRING_IID= + {0xae419e24, 0x1dd1, 0x11b2, + [ 0xb3, 0x9a, 0xd3, 0xe5, 0xe7, 0x07, 0x38, 0x02 ]}; - public static final nsID NS_IPREFLOCALIZEDSTRING_IID = - new nsID(NS_IPREFLOCALIZEDSTRING_IID_STR); - - public nsIPrefLocalizedString(int /*long*/ address) { - super(address); - } +interface nsIPrefLocalizedString : nsISupports { - public int GetData(int /*long*/[] aData) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aData); - } - - public int SetData(char[] aData) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aData); - } + static const char[] IID_STR = NS_IPREFLOCALIZEDSTRING_IID_STR; + static const nsIID IID = NS_IPREFLOCALIZEDSTRING_IID; - public int ToString(int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), _retval); - } +extern(System): + nsresult GetData(PRUnichar * *aData); + nsresult SetData(PRUnichar * aData); + nsresult ToString(PRUnichar **_retval); + nsresult SetDataWithLength(PRUint32 length, PRUnichar *data); - public int SetDataWithLength(int length, char[] data) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), length, data); - } } +
--- a/dwt/internal/mozilla/nsIPrefService.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIPrefService.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,69 +1,29 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2006 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIPrefService; -import dwt.dwthelper.utils; - -public class nsIPrefService extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 6; - - public static final String NS_IPREFSERVICE_IID_STR = - "decb9cc7-c08f-4ea5-be91-a8fc637ce2d2"; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIPrefBranch; +import dwt.internal.mozilla.nsIFile; - public static final nsID NS_IPREFSERVICE_IID = - new nsID(NS_IPREFSERVICE_IID_STR); +const char[] NS_IPREFSERVICE_IID_STR = "decb9cc7-c08f-4ea5-be91-a8fc637ce2d2"; - public nsIPrefService(int /*long*/ address) { - super(address); - } +const nsIID NS_IPREFSERVICE_IID= + {0xdecb9cc7, 0xc08f, 0x4ea5, + [ 0xbe, 0x91, 0xa8, 0xfc, 0x63, 0x7c, 0xe2, 0xd2 ]}; - public int ReadUserPrefs(int /*long*/ aFile) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aFile); - } +interface nsIPrefService : nsISupports { - public int ResetPrefs() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress()); - } - - public int ResetUserPrefs() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress()); - } + static const char[] IID_STR = NS_IPREFSERVICE_IID_STR; + static const nsIID IID = NS_IPREFSERVICE_IID; - public int SavePrefFile(int /*long*/ aFile) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aFile); - } +extern(System): + nsresult ReadUserPrefs(nsIFile aFile); + nsresult ResetPrefs(); + nsresult ResetUserPrefs(); + nsresult SavePrefFile(nsIFile aFile); + nsresult GetBranch(char *aPrefRoot, nsIPrefBranch *_retval); + nsresult GetDefaultBranch(char *aPrefRoot, nsIPrefBranch *_retval); - public int GetBranch(byte[] aPrefRoot, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aPrefRoot, _retval); - } +} - public int GetDefaultBranch(byte[] aPrefRoot, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aPrefRoot, _retval); - } -}
--- a/dwt/internal/mozilla/nsIProgressDialog.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIProgressDialog.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,65 +1,29 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIProgressDialog; -import dwt.dwthelper.utils; - -public class nsIProgressDialog extends nsIDownload { - - static final int LAST_METHOD_ID = nsIDownload.LAST_METHOD_ID + 5; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIDownload; +import dwt.internal.mozilla.nsIDOMWindow; +import dwt.internal.mozilla.nsIObserver; - public static final String NS_IPROGRESSDIALOG_IID_STR = - "88a478b3-af65-440a-94dc-ed9b154d2990"; +const char[] NS_IPROGRESSDIALOG_IID_STR = "88a478b3-af65-440a-94dc-ed9b154d2990"; - public static final nsID NS_IPROGRESSDIALOG_IID = - new nsID(NS_IPROGRESSDIALOG_IID_STR); - - public nsIProgressDialog(int /*long*/ address) { - super(address); - } +const nsIID NS_IPROGRESSDIALOG_IID= + {0x88a478b3, 0xaf65, 0x440a, + [ 0x94, 0xdc, 0xed, 0x9b, 0x15, 0x4d, 0x29, 0x90 ]}; - public int Open(int /*long*/ aParent) { - return XPCOM.VtblCall(nsIDownload.LAST_METHOD_ID + 1, getAddress(), aParent); - } +interface nsIProgressDialog : nsIDownload { - public int GetCancelDownloadOnClose(int[] aCancelDownloadOnClose) { - return XPCOM.VtblCall(nsIDownload.LAST_METHOD_ID + 2, getAddress(), aCancelDownloadOnClose); - } + static const char[] IID_STR = NS_IPROGRESSDIALOG_IID_STR; + static const nsIID IID = NS_IPROGRESSDIALOG_IID; - public int SetCancelDownloadOnClose(int aCancelDownloadOnClose) { - return XPCOM.VtblCall(nsIDownload.LAST_METHOD_ID + 3, getAddress(), aCancelDownloadOnClose); - } +extern(System): + nsresult Open(nsIDOMWindow aParent); + nsresult GetCancelDownloadOnClose(PRBool *aCancelDownloadOnClose); + nsresult SetCancelDownloadOnClose(PRBool aCancelDownloadOnClose); + nsresult GetDialog(nsIDOMWindow *aDialog); + nsresult SetDialog(nsIDOMWindow aDialog); - public int GetDialog(int /*long*/[] aDialog) { - return XPCOM.VtblCall(nsIDownload.LAST_METHOD_ID + 4, getAddress(), aDialog); - } +} - public int SetDialog(int /*long*/ aDialog) { - return XPCOM.VtblCall(nsIDownload.LAST_METHOD_ID + 5, getAddress(), aDialog); - } -}
--- a/dwt/internal/mozilla/nsIProgressDialog_1_8.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIProgressDialog_1_8.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,73 +1,32 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIProgressDialog_1_8; -import dwt.dwthelper.utils; - -public class nsIProgressDialog_1_8 extends nsIDownload_1_8 { - - static final int LAST_METHOD_ID = nsIDownload_1_8.LAST_METHOD_ID + 7; - - public static final String NS_IPROGRESSDIALOG_IID_STR = - "20e790a2-76c6-462d-851a-22ab6cbbe48b"; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIDownload; +import dwt.internal.mozilla.nsIDOMWindow; +import dwt.internal.mozilla.nsIObserver; +import dwt.internal.mozilla.nsIDownload_1_8; - public static final nsID NS_IPROGRESSDIALOG_IID = - new nsID(NS_IPROGRESSDIALOG_IID_STR); +const char[] NS_IPROGRESSDIALOG_IID_STR = "20e790a2-76c6-462d-851a-22ab6cbbe48b"; - public nsIProgressDialog_1_8(int /*long*/ address) { - super(address); - } - - public int Open(int /*long*/ aParent) { - return XPCOM.VtblCall(nsIDownload_1_8.LAST_METHOD_ID + 1, getAddress(), aParent); - } +const nsIID NS_IPROGRESSDIALOG_IID= + {0x20e790a2, 0x76c6, 0x462d, + [ 0x85, 0x1a, 0x22, 0xab, 0x6c, 0xbb, 0xe4, 0x8b ]}; - public int GetCancelDownloadOnClose(int[] aCancelDownloadOnClose) { - return XPCOM.VtblCall(nsIDownload_1_8.LAST_METHOD_ID + 2, getAddress(), aCancelDownloadOnClose); - } +interface nsIProgressDialog_1_8 : nsIDownload_1_8 { - public int SetCancelDownloadOnClose(int aCancelDownloadOnClose) { - return XPCOM.VtblCall(nsIDownload_1_8.LAST_METHOD_ID + 3, getAddress(), aCancelDownloadOnClose); - } - - public int GetObserver(int /*long*/[] aObserver) { - return XPCOM.VtblCall(nsIDownload_1_8.LAST_METHOD_ID + 4, getAddress(), aObserver); - } + static const char[] IID_STR = NS_IPROGRESSDIALOG_IID_STR; + static const nsIID IID = NS_IPROGRESSDIALOG_IID; - public int SetObserver(int /*long*/ aObserver) { - return XPCOM.VtblCall(nsIDownload_1_8.LAST_METHOD_ID + 5, getAddress(), aObserver); - } +extern(System): + nsresult Open(nsIDOMWindow aParent); + nsresult GetCancelDownloadOnClose(PRBool *aCancelDownloadOnClose); + nsresult SetCancelDownloadOnClose(PRBool aCancelDownloadOnClose); + nsresult GetObserver(nsIObserver *aObserver); + nsresult SetObserver(nsIObserver aObserver); + nsresult GetDialog(nsIDOMWindow *aDialog); + nsresult SetDialog(nsIDOMWindow aDialog); - public int GetDialog(int /*long*/[] aDialog) { - return XPCOM.VtblCall(nsIDownload_1_8.LAST_METHOD_ID + 6, getAddress(), aDialog); - } +} - public int SetDialog(int /*long*/ aDialog) { - return XPCOM.VtblCall(nsIDownload_1_8.LAST_METHOD_ID + 7, getAddress(), aDialog); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIPrompt.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,48 @@ +module dwt.internal.mozilla.nsIPrompt; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +const char[] NS_IPROMPT_IID_STR = "a63f70c0-148b-11d3-9333-00104ba0fd40"; + +const nsIID NS_IPROMPT_IID= + {0xa63f70c0, 0x148b, 0x11d3, + [ 0x93, 0x33, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40 ]}; + +interface nsIPrompt : nsISupports { + + static const char[] IID_STR = NS_IPROMPT_IID_STR; + static const nsIID IID = NS_IPROMPT_IID; + +extern(System): + nsresult Alert(PRUnichar *dialogTitle, PRUnichar *text); + nsresult AlertCheck(PRUnichar *dialogTitle, PRUnichar *text, PRUnichar *checkMsg, PRBool *checkValue); + nsresult Confirm(PRUnichar *dialogTitle, PRUnichar *text, PRBool *_retval); + nsresult ConfirmCheck(PRUnichar *dialogTitle, PRUnichar *text, PRUnichar *checkMsg, PRBool *checkValue, PRBool *_retval); + + enum { BUTTON_POS_0 = 1U }; + enum { BUTTON_POS_1 = 256U }; + enum { BUTTON_POS_2 = 65536U }; + enum { BUTTON_TITLE_OK = 1U }; + enum { BUTTON_TITLE_CANCEL = 2U }; + enum { BUTTON_TITLE_YES = 3U }; + enum { BUTTON_TITLE_NO = 4U }; + enum { BUTTON_TITLE_SAVE = 5U }; + enum { BUTTON_TITLE_DONT_SAVE = 6U }; + enum { BUTTON_TITLE_REVERT = 7U }; + enum { BUTTON_TITLE_IS_STRING = 127U }; + enum { BUTTON_POS_0_DEFAULT = 0U }; + enum { BUTTON_POS_1_DEFAULT = 16777216U }; + enum { BUTTON_POS_2_DEFAULT = 33554432U }; + enum { BUTTON_DELAY_ENABLE = 67108864U }; + enum { STD_OK_CANCEL_BUTTONS = 513U }; + + nsresult ConfirmEx(PRUnichar *dialogTitle, PRUnichar *text, PRUint32 buttonFlags, PRUnichar *button0Title, PRUnichar *button1Title, PRUnichar *button2Title, PRUnichar *checkMsg, PRBool *checkValue, PRInt32 *_retval); + nsresult Prompt(PRUnichar *dialogTitle, PRUnichar *text, PRUnichar **value, PRUnichar *checkMsg, PRBool *checkValue, PRBool *_retval); + nsresult PromptPassword(PRUnichar *dialogTitle, PRUnichar *text, PRUnichar **password, PRUnichar *checkMsg, PRBool *checkValue, PRBool *_retval); + nsresult PromptUsernameAndPassword(PRUnichar *dialogTitle, PRUnichar *text, PRUnichar **username, PRUnichar **password, PRUnichar *checkMsg, PRBool *checkValue, PRBool *_retval); + nsresult Select(PRUnichar *dialogTitle, PRUnichar *text, PRUint32 count, PRUnichar **selectList, PRInt32 *outSelection, PRBool *_retval); + +} +
--- a/dwt/internal/mozilla/nsIPromptService.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIPromptService.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,115 +1,51 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIPromptService; -import dwt.dwthelper.utils; - -public class nsIPromptService extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 9; - - public static final String NS_IPROMPTSERVICE_IID_STR = - "1630c61a-325e-49ca-8759-a31b16c47aa5"; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public static final nsID NS_IPROMPTSERVICE_IID = - new nsID(NS_IPROMPTSERVICE_IID_STR); +import dwt.internal.mozilla.nsIDOMWindow; - public nsIPromptService(int /*long*/ address) { - super(address); - } - - public int Alert(int /*long*/ aParent, char[] aDialogTitle, char[] aText) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aParent, aDialogTitle, aText); - } +const char[] NS_IPROMPTSERVICE_IID_STR = "1630c61a-325e-49ca-8759-a31b16c47aa5"; - public int AlertCheck(int /*long*/ aParent, char[] aDialogTitle, char[] aText, char[] aCheckMsg, int[] aCheckState) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aParent, aDialogTitle, aText, aCheckMsg, aCheckState); - } +const nsIID NS_IPROMPTSERVICE_IID= + {0x1630c61a, 0x325e, 0x49ca, + [ 0x87, 0x59, 0xa3, 0x1b, 0x16, 0xc4, 0x7a, 0xa5 ]}; - public int Confirm(int /*long*/ aParent, char[] aDialogTitle, char[] aText, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aParent, aDialogTitle, aText, _retval); - } +interface nsIPromptService : nsISupports { - public int ConfirmCheck(int /*long*/ aParent, char[] aDialogTitle, char[] aText, char[] aCheckMsg, int[] aCheckState, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aParent, aDialogTitle, aText, aCheckMsg, aCheckState, _retval); - } - - public static final int BUTTON_POS_0 = 1; + static const char[] IID_STR = NS_IPROMPTSERVICE_IID_STR; + static const nsIID IID = NS_IPROMPTSERVICE_IID; - public static final int BUTTON_POS_1 = 256; - - public static final int BUTTON_POS_2 = 65536; - - public static final int BUTTON_TITLE_OK = 1; - - public static final int BUTTON_TITLE_CANCEL = 2; +extern(System): + nsresult Alert(nsIDOMWindow aParent, PRUnichar *aDialogTitle, PRUnichar *aText); + nsresult AlertCheck(nsIDOMWindow aParent, PRUnichar *aDialogTitle, PRUnichar *aText, PRUnichar *aCheckMsg, PRBool *aCheckState); + nsresult Confirm(nsIDOMWindow aParent, PRUnichar *aDialogTitle, PRUnichar *aText, PRBool *_retval); + nsresult ConfirmCheck(nsIDOMWindow aParent, PRUnichar *aDialogTitle, PRUnichar *aText, PRUnichar *aCheckMsg, PRBool *aCheckState, PRBool *_retval); - public static final int BUTTON_TITLE_YES = 3; - - public static final int BUTTON_TITLE_NO = 4; - - public static final int BUTTON_TITLE_SAVE = 5; - - public static final int BUTTON_TITLE_DONT_SAVE = 6; - - public static final int BUTTON_TITLE_REVERT = 7; - - public static final int BUTTON_TITLE_IS_STRING = 127; - - public static final int BUTTON_POS_0_DEFAULT = 0; - - public static final int BUTTON_POS_1_DEFAULT = 16777216; - - public static final int BUTTON_POS_2_DEFAULT = 33554432; - - public static final int BUTTON_DELAY_ENABLE = 67108864; - - public static final int STD_OK_CANCEL_BUTTONS = 513; + enum { BUTTON_POS_0 = 1U }; + enum { BUTTON_POS_1 = 256U }; + enum { BUTTON_POS_2 = 65536U }; + enum { BUTTON_TITLE_OK = 1U }; + enum { BUTTON_TITLE_CANCEL = 2U }; + enum { BUTTON_TITLE_YES = 3U }; + enum { BUTTON_TITLE_NO = 4U }; + enum { BUTTON_TITLE_SAVE = 5U }; + enum { BUTTON_TITLE_DONT_SAVE = 6U }; + enum { BUTTON_TITLE_REVERT = 7U }; + enum { BUTTON_TITLE_IS_STRING = 127U }; + enum { BUTTON_POS_0_DEFAULT = 0U }; + enum { BUTTON_POS_1_DEFAULT = 16777216U }; + enum { BUTTON_POS_2_DEFAULT = 33554432U }; + enum { BUTTON_DELAY_ENABLE = 67108864U }; + enum { STD_OK_CANCEL_BUTTONS = 513U }; + enum { STD_YES_NO_BUTTONS = 1027U }; - public static final int STD_YES_NO_BUTTONS = 1027; - - public int ConfirmEx(int /*long*/ aParent, char[] aDialogTitle, char[] aText, int aButtonFlags, char[] aButton0Title, char[] aButton1Title, char[] aButton2Title, char[] aCheckMsg, int[] aCheckState, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aParent, aDialogTitle, aText, aButtonFlags, aButton0Title, aButton1Title, aButton2Title, aCheckMsg, aCheckState, _retval); - } - - public int Prompt(int /*long*/ aParent, char[] aDialogTitle, char[] aText, int /*long*/[] aValue, char[] aCheckMsg, int[] aCheckState, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aParent, aDialogTitle, aText, aValue, aCheckMsg, aCheckState, _retval); - } + nsresult ConfirmEx(nsIDOMWindow aParent, PRUnichar *aDialogTitle, PRUnichar *aText, PRUint32 aButtonFlags, PRUnichar *aButton0Title, PRUnichar *aButton1Title, PRUnichar *aButton2Title, PRUnichar *aCheckMsg, PRBool *aCheckState, PRInt32 *_retval); + nsresult Prompt(nsIDOMWindow aParent, PRUnichar *aDialogTitle, PRUnichar *aText, PRUnichar **aValue, PRUnichar *aCheckMsg, PRBool *aCheckState, PRBool *_retval); + nsresult PromptUsernameAndPassword(nsIDOMWindow aParent, PRUnichar *aDialogTitle, PRUnichar *aText, PRUnichar **aUsername, PRUnichar **aPassword, PRUnichar *aCheckMsg, PRBool *aCheckState, PRBool *_retval); + nsresult PromptPassword(nsIDOMWindow aParent, PRUnichar *aDialogTitle, PRUnichar *aText, PRUnichar **aPassword, PRUnichar *aCheckMsg, PRBool *aCheckState, PRBool *_retval); + nsresult Select(nsIDOMWindow aParent, PRUnichar *aDialogTitle, PRUnichar *aText, PRUint32 aCount, PRUnichar **aSelectList, PRInt32 *aOutSelection, PRBool *_retval); - public int PromptUsernameAndPassword(int /*long*/ aParent, char[] aDialogTitle, char[] aText, int /*long*/[] aUsername, int /*long*/[] aPassword, char[] aCheckMsg, int[] aCheckState, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aParent, aDialogTitle, aText, aUsername, aPassword, aCheckMsg, aCheckState, _retval); - } +} - public int PromptPassword(int /*long*/ aParent, char[] aDialogTitle, char[] aText, int /*long*/[] aPassword, char[] aCheckMsg, int[] aCheckState, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aParent, aDialogTitle, aText, aPassword, aCheckMsg, aCheckState, _retval); - } - - public int Select(int /*long*/ aParent, char[] aDialogTitle, char[] aText, int aCount, int /*long*/[] aSelectList, int[] aOutSelection, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aParent, aDialogTitle, aText, aCount, aSelectList, aOutSelection, _retval); - } -}
--- a/dwt/internal/mozilla/nsIPromptService2.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIPromptService2.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,53 +1,30 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIPromptService2; -import dwt.dwthelper.utils; - -public class nsIPromptService2 extends nsIPromptService { - - static final int LAST_METHOD_ID = nsIPromptService.LAST_METHOD_ID + 2; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsICancelable; +import dwt.internal.mozilla.nsIChannel; +import dwt.internal.mozilla.nsIAuthInformation; +import dwt.internal.mozilla.nsIAuthPromptCallback; +import dwt.internal.mozilla.nsIPromptService; - public static final String NS_IPROMPTSERVICE2_IID_STR = - "cf86d196-dbee-4482-9dfa-3477aa128319"; +import dwt.internal.mozilla.nsIDOMWindow; - public static final nsID NS_IPROMPTSERVICE2_IID = - new nsID(NS_IPROMPTSERVICE2_IID_STR); +const char[] NS_IPROMPTSERVICE2_IID_STR = "cf86d196-dbee-4482-9dfa-3477aa128319"; - public nsIPromptService2(int /*long*/ address) { - super(address); - } +const nsIID NS_IPROMPTSERVICE2_IID= + {0xcf86d196, 0xdbee, 0x4482, + [ 0x9d, 0xfa, 0x34, 0x77, 0xaa, 0x12, 0x83, 0x19 ]}; + +interface nsIPromptService2 : nsIPromptService { - public int PromptAuth(int /*long*/ aParent, int /*long*/ aChannel, int level, int /*long*/ authInfo, char[] checkboxLabel, int[] checkValue, int[] _retval) { - return XPCOM.VtblCall(nsIPromptService.LAST_METHOD_ID + 1, getAddress(), aParent, aChannel, level, authInfo, checkboxLabel, checkValue, _retval); - } + static const char[] IID_STR = NS_IPROMPTSERVICE2_IID_STR; + static const nsIID IID = NS_IPROMPTSERVICE2_IID; - public int AsyncPromptAuth(int /*long*/ aParent, int /*long*/ aChannel, int /*long*/ aCallback, int /*long*/ aContext, int level, int /*long*/ authInfo, char[] checkboxLabel, int[] checkValue, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsIPromptService.LAST_METHOD_ID + 2, getAddress(), aParent, aChannel, aCallback, aContext, level, authInfo, checkboxLabel, checkValue, _retval); - } +extern(System): + public nsresult PromptAuth(nsIDOMWindow aParent, nsIChannel aChannel, PRUint32 level, nsIAuthInformation authInfo, PRUnichar* checkboxLabel, PRBool* checkValue, PRBool* _retval); + + public nsresult AsyncPromptAuth(nsIDOMWindow aParent, nsIChannel aChannel, nsIAuthPromptCallback aCallback, nsISupports aContext, PRUint32 level, nsIAuthInformation authInfo, PRUnichar* checkboxLabel, PRBool* checkValue, nsICancelable* _retval); + }
--- a/dwt/internal/mozilla/nsIProperties.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIProperties.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,65 +1,26 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIProperties; -import dwt.dwthelper.utils; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; -public class nsIProperties extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 5; +const char[] NS_IPROPERTIES_IID_STR = "78650582-4e93-4b60-8e85-26ebd3eb14ca"; - public static final String NS_IPROPERTIES_IID_STR = - "78650582-4e93-4b60-8e85-26ebd3eb14ca"; +const nsIID NS_IPROPERTIES_IID= + {0x78650582, 0x4e93, 0x4b60, + [ 0x8e, 0x85, 0x26, 0xeb, 0xd3, 0xeb, 0x14, 0xca ]}; - public static final nsID NS_IPROPERTIES_IID = - new nsID(NS_IPROPERTIES_IID_STR); - - public nsIProperties(int /*long*/ address) { - super(address); - } +interface nsIProperties : nsISupports { - public int Get(byte[] prop, nsID iid, int /*long*/[] result) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), prop, iid, result); - } - - public int Set(byte[] prop, int /*long*/ value) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), prop, value); - } + static const char[] IID_STR = NS_IPROPERTIES_IID_STR; + static const nsIID IID = NS_IPROPERTIES_IID; - public int Has(byte[] prop, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), prop, _retval); - } +extern(System): + nsresult Get(char *prop, nsIID * iid, void * *result); + nsresult Set(char *prop, nsISupports value); + nsresult Has(char *prop, PRBool *_retval); + nsresult Undefine(char *prop); + nsresult GetKeys(PRUint32 *count, char ***keys); - public int Undefine(byte[] prop) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), prop); - } +} - public int GetKeys(int[] count, int /*long*/[] keys) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), count, keys); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIProtocolHandler.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,36 @@ +module dwt.internal.mozilla.nsIProtocolHandler; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsIURI; +import dwt.internal.mozilla.nsIChannel; +import dwt.internal.mozilla.nsStringAPI; + +const char[] NS_IPROTOCOLHANDLER_IID_STR = "15fd6940-8ea7-11d3-93ad-00104ba0fd40"; + +const nsIID NS_IPROTOCOLHANDLER_IID= + {0x15fd6940, 0x8ea7, 0x11d3, + [ 0x93, 0xad, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40 ]}; + +interface nsIProtocolHandler : nsISupports { + + static const char[] IID_STR = NS_IPROTOCOLHANDLER_IID_STR; + static const nsIID IID = NS_IPROTOCOLHANDLER_IID; + +extern(System): + nsresult GetScheme(nsACString * aScheme); + nsresult GetDefaultPort(PRInt32 *aDefaultPort); + nsresult GetProtocolFlags(PRUint32 *aProtocolFlags); + nsresult NewURI(nsACString * aSpec, char *aOriginCharset, nsIURI aBaseURI, nsIURI *_retval); + nsresult NewChannel(nsIURI aURI, nsIChannel *_retval); + nsresult AllowPort(PRInt32 port, char *scheme, PRBool *_retval); + + enum { URI_STD = 0U }; + enum { URI_NORELATIVE = 1U }; + enum { URI_NOAUTH = 2U }; + enum { ALLOWS_PROXY = 4U }; + enum { ALLOWS_PROXY_HTTP = 8U }; + +} +
--- a/dwt/internal/mozilla/nsIRequest.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIRequest.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,103 +1,45 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIRequest; -import dwt.dwthelper.utils; - -public class nsIRequest extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 10; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsILoadGroup; +import dwt.internal.mozilla.nsStringAPI; - public static final String NS_IREQUEST_IID_STR = - "ef6bfbd2-fd46-48d8-96b7-9f8f0fd387fe"; - - public static final nsID NS_IREQUEST_IID = - new nsID(NS_IREQUEST_IID_STR); - - public nsIRequest(int /*long*/ address) { - super(address); - } +alias PRUint32 nsLoadFlags; - public int GetName(int /*long*/ aName) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aName); - } - - public int IsPending(int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), _retval); - } +const char[] NS_IREQUEST_IID_STR = "ef6bfbd2-fd46-48d8-96b7-9f8f0fd387fe"; - public int GetStatus(int /*long*/[] aStatus) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aStatus); - } +const nsIID NS_IREQUEST_IID= + {0xef6bfbd2, 0xfd46, 0x48d8, + [ 0x96, 0xb7, 0x9f, 0x8f, 0x0f, 0xd3, 0x87, 0xfe ]}; - public int Cancel(int aStatus) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aStatus); - } +interface nsIRequest : nsISupports { - public int Suspend() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress()); - } + static const char[] IID_STR = NS_IREQUEST_IID_STR; + static const nsIID IID = NS_IREQUEST_IID; - public int Resume() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress()); - } - - public int GetLoadGroup(int /*long*/[] aLoadGroup) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aLoadGroup); - } - - public int SetLoadGroup(int /*long*/ aLoadGroup) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aLoadGroup); - } - - public int GetLoadFlags(int /*long*/[] aLoadFlags) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aLoadFlags); - } +extern(System): + nsresult GetName(nsACString * aName); + nsresult IsPending(PRBool *_retval); + nsresult GetStatus(nsresult *aStatus); + nsresult Cancel(nsresult aStatus); + nsresult Suspend(); + nsresult Resume(); + nsresult GetLoadGroup(nsILoadGroup *aLoadGroup); + nsresult SetLoadGroup(nsILoadGroup aLoadGroup); + nsresult GetLoadFlags(nsLoadFlags *aLoadFlags); + nsresult SetLoadFlags(nsLoadFlags aLoadFlags); - public int SetLoadFlags(int aLoadFlags) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), aLoadFlags); - } - - public static final int LOAD_NORMAL = 0; - - public static final int LOAD_BACKGROUND = 1; - - public static final int INHIBIT_CACHING = 128; + enum { LOAD_NORMAL = 0U }; + enum { LOAD_BACKGROUND = 1U }; + enum { INHIBIT_CACHING = 128U }; + enum { INHIBIT_PERSISTENT_CACHING = 256U }; + enum { LOAD_BYPASS_CACHE = 512U }; + enum { LOAD_FROM_CACHE = 1024U }; + enum { VALIDATE_ALWAYS = 2048U }; + enum { VALIDATE_NEVER = 4096U }; + enum { VALIDATE_ONCE_PER_SESSION = 8192U }; - public static final int INHIBIT_PERSISTENT_CACHING = 256; - - public static final int LOAD_BYPASS_CACHE = 512; - - public static final int LOAD_FROM_CACHE = 1024; +} - public static final int VALIDATE_ALWAYS = 2048; - - public static final int VALIDATE_NEVER = 4096; - - public static final int VALIDATE_ONCE_PER_SESSION = 8192; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIRequestObserver.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,25 @@ +module dwt.internal.mozilla.nsIRequestObserver; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIRequest; + +const char[] NS_IREQUESTOBSERVER_IID_STR = "fd91e2e0-1481-11d3-9333-00104ba0fd40"; + +const nsIID NS_IREQUESTOBSERVER_IID= + {0xfd91e2e0, 0x1481, 0x11d3, + [ 0x93, 0x33, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40 ]}; + +interface nsIRequestObserver : nsISupports { + + static const char[] IID_STR = NS_IREQUESTOBSERVER_IID_STR; + static const nsIID IID = NS_IREQUESTOBSERVER_IID; + +extern(System): + nsresult OnStartRequest(nsIRequest aRequest, nsISupports aContext); + nsresult OnStopRequest(nsIRequest aRequest, nsISupports aContext, nsresult aStatusCode); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsISHEntry.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,73 @@ +module dwt.internal.mozilla.nsISHEntry; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIHistoryEntry; +import dwt.internal.mozilla.nsIContentViewer; +import dwt.internal.mozilla.nsIURI; +import dwt.internal.mozilla.nsIInputStream; +import dwt.internal.mozilla.nsIDocShellTreeItem; +import dwt.internal.mozilla.nsISupportsArray; +import dwt.internal.mozilla.nsStringAPI; + +const char[] NS_ISHENTRY_IID_STR = "542a98b9-2889-4922-aaf4-02b6056f4136"; + +const nsIID NS_ISHENTRY_IID= + {0x542a98b9, 0x2889, 0x4922, + [ 0xaa, 0xf4, 0x02, 0xb6, 0x05, 0x6f, 0x41, 0x36 ]}; + +interface nsISHEntry : nsIHistoryEntry { + + static const char[] IID_STR = NS_ISHENTRY_IID_STR; + static const nsIID IID = NS_ISHENTRY_IID; + +extern(System): + nsresult SetURI(nsIURI aURI); + nsresult GetReferrerURI(nsIURI *aReferrerURI); + nsresult SetReferrerURI(nsIURI aReferrerURI); + nsresult GetContentViewer(nsIContentViewer *aContentViewer); + nsresult SetContentViewer(nsIContentViewer aContentViewer); + nsresult GetSticky(PRBool *aSticky); + nsresult SetSticky(PRBool aSticky); + nsresult GetWindowState(nsISupports *aWindowState); + nsresult SetWindowState(nsISupports aWindowState); + nsresult GetViewerBounds(nsRect * bounds); + nsresult SetViewerBounds(nsRect * bounds); + nsresult AddChildShell(nsIDocShellTreeItem shell); + nsresult ChildShellAt(PRInt32 index, nsIDocShellTreeItem *_retval); + nsresult ClearChildShells(); + nsresult GetRefreshURIList(nsISupportsArray *aRefreshURIList); + nsresult SetRefreshURIList(nsISupportsArray aRefreshURIList); + nsresult SyncPresentationState(); + nsresult SetTitle(nsAString * aTitle); + nsresult GetPostData(nsIInputStream *aPostData); + nsresult SetPostData(nsIInputStream aPostData); + nsresult GetLayoutHistoryState(nsILayoutHistoryState *aLayoutHistoryState); + nsresult SetLayoutHistoryState(nsILayoutHistoryState aLayoutHistoryState); + nsresult GetParent(nsISHEntry *aParent); + nsresult SetParent(nsISHEntry aParent); + nsresult GetLoadType(PRUint32 *aLoadType); + nsresult SetLoadType(PRUint32 aLoadType); + nsresult GetID(PRUint32 *aID); + nsresult SetID(PRUint32 aID); + nsresult GetPageIdentifier(PRUint32 *aPageIdentifier); + nsresult SetPageIdentifier(PRUint32 aPageIdentifier); + nsresult GetCacheKey(nsISupports *aCacheKey); + nsresult SetCacheKey(nsISupports aCacheKey); + nsresult GetSaveLayoutStateFlag(PRBool *aSaveLayoutStateFlag); + nsresult SetSaveLayoutStateFlag(PRBool aSaveLayoutStateFlag); + nsresult GetExpirationStatus(PRBool *aExpirationStatus); + nsresult SetExpirationStatus(PRBool aExpirationStatus); + nsresult GetContentType(nsACString * aContentType); + nsresult SetContentType(nsACString * aContentType); + nsresult SetScrollPosition(PRInt32 x, PRInt32 y); + nsresult GetScrollPosition(PRInt32 *x, PRInt32 *y); + nsresult Create(nsIURI URI, nsAString * title, nsIInputStream inputStream, nsILayoutHistoryState layoutHistoryState, nsISupports cacheKey, nsACString * contentType); + nsresult Clone(nsISHEntry *_retval); + nsresult SetIsSubFrame(PRBool aFlag); + nsresult GetAnyContentViewer(nsISHEntry *ownerEntry, nsIContentViewer *_retval); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsISHistory.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,34 @@ +module dwt.internal.mozilla.nsISHistory; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIHistoryEntry; +import dwt.internal.mozilla.nsISHistoryListener; +import dwt.internal.mozilla.nsISimpleEnumerator; + +const char[] NS_ISHISTORY_IID_STR = "7294fe9b-14d8-11d5-9882-00c04fa02f40"; + +const nsIID NS_ISHISTORY_IID= + {0x7294fe9b, 0x14d8, 0x11d5, + [ 0x98, 0x82, 0x00, 0xc0, 0x4f, 0xa0, 0x2f, 0x40 ]}; + +interface nsISHistory : nsISupports { + + static const char[] IID_STR = NS_ISHISTORY_IID_STR; + static const nsIID IID = NS_ISHISTORY_IID; + +extern(System): + nsresult GetCount(PRInt32 *aCount); + nsresult GetIndex(PRInt32 *aIndex); + nsresult GetMaxLength(PRInt32 *aMaxLength); + nsresult SetMaxLength(PRInt32 aMaxLength); + nsresult GetEntryAtIndex(PRInt32 index, PRBool modifyIndex, nsIHistoryEntry *_retval); + nsresult PurgeHistory(PRInt32 numEntries); + nsresult AddSHistoryListener(nsISHistoryListener aListener); + nsresult RemoveSHistoryListener(nsISHistoryListener aListener); + nsresult GetSHistoryEnumerator(nsISimpleEnumerator *aSHistoryEnumerator); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsISHistoryListener.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,29 @@ +module dwt.internal.mozilla.nsISHistoryListener; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIURI; + +const char[] NS_ISHISTORYLISTENER_IID_STR = "3b07f591-e8e1-11d4-9882-00c04fa02f40"; + +const nsIID NS_ISHISTORYLISTENER_IID= + {0x3b07f591, 0xe8e1, 0x11d4, + [ 0x98, 0x82, 0x00, 0xc0, 0x4f, 0xa0, 0x2f, 0x40 ]}; + +interface nsISHistoryListener : nsISupports { + + static const char[] IID_STR = NS_ISHISTORYLISTENER_IID_STR; + static const nsIID IID = NS_ISHISTORYLISTENER_IID; + +extern(System): + nsresult OnHistoryNewEntry(nsIURI aNewURI); + nsresult OnHistoryGoBack(nsIURI aBackURI, PRBool *_retval); + nsresult OnHistoryGoForward(nsIURI aForwardURI, PRBool *_retval); + nsresult OnHistoryReload(nsIURI aReloadURI, PRUint32 aReloadFlags, PRBool *_retval); + nsresult OnHistoryGotoIndex(PRInt32 aIndex, nsIURI aGotoURI, PRBool *_retval); + nsresult OnHistoryPurge(PRInt32 aNumEntries, PRBool *_retval); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsISecureBrowserUI.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,27 @@ +module dwt.internal.mozilla.nsISecureBrowserUI; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIDOMWindow; +import dwt.internal.mozilla.nsStringAPI; + +const char[] NS_ISECUREBROWSERUI_IID_STR = "081e31e0-a144-11d3-8c7c-00609792278c"; + +const nsIID NS_ISECUREBROWSERUI_IID= + {0x081e31e0, 0xa144, 0x11d3, + [ 0x8c, 0x7c, 0x00, 0x60, 0x97, 0x92, 0x27, 0x8c ]}; + +interface nsISecureBrowserUI : nsISupports { + + static const char[] IID_STR = NS_ISECUREBROWSERUI_IID_STR; + static const nsIID IID = NS_ISECUREBROWSERUI_IID; + +extern(System): + nsresult Init(nsIDOMWindow window); + nsresult GetState(PRUint32 *aState); + nsresult GetTooltipText(nsAString * aTooltipText); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsISelection.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,43 @@ +module dwt.internal.mozilla.nsISelection; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIDOMNode; +import dwt.internal.mozilla.nsIDOMRange; + +const char[] NS_ISELECTION_IID_STR = "b2c7ed59-8634-4352-9e37-5484c8b6e4e1"; + +const nsIID NS_ISELECTION_IID= + {0xb2c7ed59, 0x8634, 0x4352, + [ 0x9e, 0x37, 0x54, 0x84, 0xc8, 0xb6, 0xe4, 0xe1 ]}; + +interface nsISelection : nsISupports { + + static const char[] IID_STR = NS_ISELECTION_IID_STR; + static const nsIID IID = NS_ISELECTION_IID; + +extern(System): + nsresult GetAnchorNode(nsIDOMNode *aAnchorNode); + nsresult GetAnchorOffset(PRInt32 *aAnchorOffset); + nsresult GetFocusNode(nsIDOMNode *aFocusNode); + nsresult GetFocusOffset(PRInt32 *aFocusOffset); + nsresult GetIsCollapsed(PRBool *aIsCollapsed); + nsresult GetRangeCount(PRInt32 *aRangeCount); + nsresult GetRangeAt(PRInt32 index, nsIDOMRange *_retval); + nsresult Collapse(nsIDOMNode parentNode, PRInt32 offset); + nsresult Extend(nsIDOMNode parentNode, PRInt32 offset); + nsresult CollapseToStart(); + nsresult CollapseToEnd(); + nsresult ContainsNode(nsIDOMNode node, PRBool entirelyContained, PRBool *_retval); + nsresult SelectAllChildren(nsIDOMNode parentNode); + nsresult AddRange(nsIDOMRange range); + nsresult RemoveRange(nsIDOMRange range); + nsresult RemoveAllRanges(); + nsresult DeleteFromDocument(); + nsresult SelectionLanguageChange(PRBool langRTL); + nsresult ToString(PRUnichar **_retval); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsISerializable.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,26 @@ +module dwt.internal.mozilla.nsISerializable; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIObjectInputStream; +import dwt.internal.mozilla.nsIObjectOutputStream; + +const char[] NS_ISERIALIZABLE_IID_STR = "91cca981-c26d-44a8-bebe-d9ed4891503a"; + +const nsIID NS_ISERIALIZABLE_IID= + {0x91cca981, 0xc26d, 0x44a8, + [ 0xbe, 0xbe, 0xd9, 0xed, 0x48, 0x91, 0x50, 0x3a ]}; + +interface nsISerializable : nsISupports { + + static const char[] IID_STR = NS_ISERIALIZABLE_IID_STR; + static const nsIID IID = NS_ISERIALIZABLE_IID; + +extern(System): + nsresult Read(nsIObjectInputStream aInputStream); + nsresult Write(nsIObjectOutputStream aOutputStream); + +} +
--- a/dwt/internal/mozilla/nsIServiceManager.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIServiceManager.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,61 +1,24 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIServiceManager; -import dwt.dwthelper.utils; - -public class nsIServiceManager extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 4; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public static final String NS_ISERVICEMANAGER_IID_STR = - "8bb35ed9-e332-462d-9155-4a002ab5c958"; +const char[] NS_ISERVICEMANAGER_IID_STR = "8bb35ed9-e332-462d-9155-4a002ab5c958"; +const nsIID NS_ISERVICEMANAGER_IID= + {0x8bb35ed9, 0xe332, 0x462d, + [ 0x91, 0x55, 0x4a, 0x00, 0x2a, 0xb5, 0xc9, 0x58 ]}; - public static final nsID NS_ISERVICEMANAGER_IID = - new nsID(NS_ISERVICEMANAGER_IID_STR); - - public nsIServiceManager(int /*long*/ address) { - super(address); - } +interface nsIServiceManager : nsISupports { - public int GetService(nsID aClass, nsID aIID, int /*long*/[] result) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aClass, aIID, result); - } - - public int GetServiceByContractID(byte[] aContractID, nsID aIID, int /*long*/[] result) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aContractID, aIID, result); - } + static const char[] IID_STR = NS_ISERVICEMANAGER_IID_STR; + static const nsIID IID = NS_ISERVICEMANAGER_IID; - public int IsServiceInstantiated(nsID aClass, nsID aIID, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aClass, aIID, _retval); - } +extern(System): + nsresult GetService(nsCID * aClass, nsIID * aIID, void * *result); + nsresult GetServiceByContractID(char *aContractID, nsIID * aIID, void * *result); + nsresult IsServiceInstantiated(nsCID * aClass, nsIID * aIID, PRBool *_retval); + nsresult IsServiceInstantiatedByContractID(char *aContractID, nsIID * aIID, PRBool *_retval); - public int IsServiceInstantiatedByContractID(byte[] aContractID, nsID aIID, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aContractID, aIID, _retval); - } } +
--- a/dwt/internal/mozilla/nsISimpleEnumerator.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsISimpleEnumerator.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,53 +1,23 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsISimpleEnumerator; -import dwt.dwthelper.utils; - -public class nsISimpleEnumerator extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 2; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public static final String NS_ISIMPLEENUMERATOR_IID_STR = - "d1899240-f9d2-11d2-bdd6-000064657374"; +const char[] NS_ISIMPLEENUMERATOR_IID_STR = "d1899240-f9d2-11d2-bdd6-000064657374"; - public static final nsID NS_ISIMPLEENUMERATOR_IID = - new nsID(NS_ISIMPLEENUMERATOR_IID_STR); +const nsIID NS_ISIMPLEENUMERATOR_IID= + {0xd1899240, 0xf9d2, 0x11d2, + [ 0xbd, 0xd6, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74 ]}; - public nsISimpleEnumerator(int /*long*/ address) { - super(address); - } +interface nsISimpleEnumerator : nsISupports { + + static const char[] IID_STR = NS_ISIMPLEENUMERATOR_IID_STR; + static const nsIID IID = NS_ISIMPLEENUMERATOR_IID; - public int HasMoreElements(int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), _retval); - } +extern(System): + nsresult HasMoreElements(PRBool *_retval); + nsresult GetNext(nsISupports *_retval); - public int GetNext(int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), _retval); - } } +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIStreamListener.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,26 @@ +module dwt.internal.mozilla.nsIStreamListener; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsIRequestObserver; +import dwt.internal.mozilla.nsIRequest; +import dwt.internal.mozilla.nsIInputStream; + +const char[] NS_ISTREAMLISTENER_IID_STR = "1a637020-1482-11d3-9333-00104ba0fd40"; + +const nsIID NS_ISTREAMLISTENER_IID= + {0x1a637020, 0x1482, 0x11d3, + [ 0x93, 0x33, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40 ]}; + +interface nsIStreamListener : nsIRequestObserver { + + static const char[] IID_STR = NS_ISTREAMLISTENER_IID_STR; + static const nsIID IID = NS_ISTREAMLISTENER_IID; + +extern(System): + nsresult OnDataAvailable(nsIRequest aRequest, nsISupports aContext, nsIInputStream aInputStream, PRUint32 aOffset, PRUint32 aCount); + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIStringEnumerator.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,50 @@ +module dwt.internal.mozilla.nsIStringEnumerator; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsStringAPI; + +/****************************************************************************** + +******************************************************************************/ + +const char[] NS_ISTRINGENUMERATOR_IID_STR = "50d3ef6c-9380-4f06-9fb2-95488f7d141c"; + +const nsIID NS_ISTRINGENUMERATOR_IID= + {0x50d3ef6c, 0x9380, 0x4f06, + [ 0x9f, 0xb2, 0x95, 0x48, 0x8f, 0x7d, 0x14, 0x1c ]}; + +interface nsIStringEnumerator : nsISupports { + + static const char[] IID_STR = NS_ISTRINGENUMERATOR_IID_STR; + static const nsIID IID = NS_ISTRINGENUMERATOR_IID; + +extern(System): + nsresult HasMore(PRBool *_retval); + nsresult GetNext(nsAString * _retval); + +} + +/****************************************************************************** + +******************************************************************************/ + +const char[] NS_IUTF8STRINGENUMERATOR_IID_STR = "9bdf1010-3695-4907-95ed-83d0410ec307"; + +const nsIID NS_IUTF8STRINGENUMERATOR_IID= + {0x9bdf1010, 0x3695, 0x4907, + [ 0x95, 0xed, 0x83, 0xd0, 0x41, 0x0e, 0xc3, 0x07 ]}; + +interface nsIUTF8StringEnumerator : nsISupports { + + static const char[] IID_STR = NS_IUTF8STRINGENUMERATOR_IID_STR; + static const nsIID IID = NS_IUTF8STRINGENUMERATOR_IID; + +extern(System): + nsresult HasMore(PRBool *_retval); + nsresult GetNext(nsACString * _retval); + +} +
--- a/dwt/internal/mozilla/nsISupports.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsISupports.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,63 +1,30 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2005 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsISupports; -import dwt.dwthelper.utils; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; -public class nsISupports { - - static final int LAST_METHOD_ID = 2; +const char[] NS_ISUPPORTS_IID_STR = "00000000-0000-0000-c000-000000000046"; - public static final String NS_ISUPPORTS_IID_STR = - "00000000-0000-0000-c000-000000000046"; +const nsIID NS_ISUPPORTS_IID= + { 0x00000000, 0x0000, 0x0000, + [ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 ] }; - public static final nsID NS_ISUPPORTS_IID = - new nsID(NS_ISUPPORTS_IID_STR); - - int /*long*/ address; +interface IUnknown +{ + static const char[] IID_STR = NS_ISUPPORTS_IID_STR; + static const nsIID IID = NS_ISUPPORTS_IID; - public nsISupports(int /*long*/ address) { - this.address = address; - } +extern(System): + nsresult QueryInterface( nsIID* uuid, void **result); - public int /*long*/ getAddress() { - return this.address; - } + nsrefcnt AddRef(); + nsrefcnt Release(); +} - public int QueryInterface(nsID uuid, int /*long*/[] result) { - return XPCOM.VtblCall(0, getAddress(), uuid, result); - } +// WHY WE USE COM's IUnknown for XPCOM: +// +// The IUnknown interface is special-cased in D and is specifically designed to be +// compatible with MS COM. XPCOM's nsISupports interface is the exact equivalent +// of IUnknown so we alias it here to take advantage of D's COM support. -JJR - public int AddRef() { - return XPCOM.VtblCall(1, getAddress()); - } - - public int Release() { - return XPCOM.VtblCall(2, getAddress()); - } -} +alias IUnknown nsISupports; \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsISupportsArray.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,48 @@ +module dwt.internal.mozilla.nsISupportsArray; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +import dwt.internal.mozilla.nsICollection; + +typedef PRBool function(nsISupports, void*) nsISupportsArrayEnumFunc; + +const char[] NS_ISUPPORTSARRAY_IID_STR = "791eafa0-b9e6-11d1-8031-006008159b5a"; + +const nsIID NS_ISUPPORTSARRAY_IID= + {0x791eafa0, 0xb9e6, 0x11d1, + [ 0x80, 0x31, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a ]}; + +interface nsISupportsArray : nsICollection { + + static const char[] IID_STR = NS_ISUPPORTSARRAY_IID_STR; + static const nsIID IID = NS_ISUPPORTSARRAY_IID; + +extern(System): + PRBool Equals(nsISupportsArray other); + nsISupports ElementAt(PRUint32 aIndex); + PRInt32 IndexOf(nsISupports aPossibleElement); + PRInt32 IndexOfStartingAt(nsISupports aPossibleElement, PRUint32 aStartIndex); + PRInt32 LastIndexOf(nsISupports aPossibleElement); + nsresult GetIndexOf(nsISupports aPossibleElement, PRInt32 *_retval); + nsresult GetIndexOfStartingAt(nsISupports aPossibleElement, PRUint32 aStartIndex, PRInt32 *_retval); + nsresult GetLastIndexOf(nsISupports aPossibleElement, PRInt32 *_retval); + PRBool InsertElementAt(nsISupports aElement, PRUint32 aIndex); + PRBool ReplaceElementAt(nsISupports aElement, PRUint32 aIndex); + PRBool RemoveElementAt(PRUint32 aIndex); + PRBool RemoveLastElement(nsISupports aElement); + nsresult DeleteLastElement(nsISupports aElement); + nsresult DeleteElementAt(PRUint32 aIndex); + PRBool AppendElements(nsISupportsArray aElements); + nsresult Compact(); + PRBool EnumerateForwards(nsISupportsArrayEnumFunc aFunc, void * aData); + PRBool EnumerateBackwards(nsISupportsArrayEnumFunc aFunc, void * aData); + nsresult Clone(nsISupportsArray *_retval); + PRBool MoveElement(PRInt32 aFrom, PRInt32 aTo); + PRBool InsertElementsAt(nsISupportsArray aOther, PRUint32 aIndex); + PRBool RemoveElementsAt(PRUint32 aIndex, PRUint32 aCount); + PRBool SizeTo(PRInt32 aSize); + +} +
--- a/dwt/internal/mozilla/nsISupportsWeakReference.d Fri Jan 16 12:19:08 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2005 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ -module dwt.internal.mozilla.nsISupportsWeakReference; - -import dwt.dwthelper.utils; - -public class nsISupportsWeakReference extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 1; - - public static final String NS_ISUPPORTSWEAKREFERENCE_IID_STR = - "9188bc86-f92e-11d2-81ef-0060083a0bcf"; - - public static final nsID NS_ISUPPORTSWEAKREFERENCE_IID = - new nsID(NS_ISUPPORTSWEAKREFERENCE_IID_STR); - - public nsISupportsWeakReference(int /*long*/ address) { - super(address); - } - - public int GetWeakReference(int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), _retval); - } -}
--- a/dwt/internal/mozilla/nsITooltipListener.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsITooltipListener.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,53 +1,23 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2004, 2005 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsITooltipListener; -import dwt.dwthelper.utils; - -public class nsITooltipListener extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 2; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public static final String NS_ITOOLTIPLISTENER_IID_STR = - "44b78386-1dd2-11b2-9ad2-e4eee2ca1916"; +const char[] NS_ITOOLTIPLISTENER_IID_STR = "44b78386-1dd2-11b2-9ad2-e4eee2ca1916"; - public static final nsID NS_ITOOLTIPLISTENER_IID = - new nsID(NS_ITOOLTIPLISTENER_IID_STR); +const nsIID NS_ITOOLTIPLISTENER_IID= + {0x44b78386, 0x1dd2, 0x11b2, + [ 0x9a, 0xd2, 0xe4, 0xee, 0xe2, 0xca, 0x19, 0x16 ]}; - public nsITooltipListener(int /*long*/ address) { - super(address); - } +interface nsITooltipListener : nsISupports { + + static const char[] IID_STR = NS_ITOOLTIPLISTENER_IID_STR; + static const nsIID IID = NS_ITOOLTIPLISTENER_IID; - public int OnShowTooltip(int aXCoords, int aYCoords, char[] aTipText) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aXCoords, aYCoords, aTipText); - } +extern(System): + nsresult OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, PRUnichar *aTipText); + nsresult OnHideTooltip(); - public int OnHideTooltip() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress()); - } } +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsITraceRefcnt.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,25 @@ +module dwt.internal.mozilla.nsITraceRefcnt; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; + +const char[] NS_ITRACEREFCNT_IID_STR = "273dc92f-0fe6-4545-96a9-21be77828039"; + +const nsIID NS_ITRACEREFCNT_IID= + {0x273dc92f, 0x0fe6, 0x4545, + [ 0x96, 0xa9, 0x21, 0xbe, 0x77, 0x82, 0x80, 0x39 ]}; + +interface nsITraceRefcnt : nsISupports { + static const char[] IID_STR = NS_ITRACEREFCNT_IID_STR; + static const nsIID IID = NS_ITRACEREFCNT_IID; + +extern(System): + nsresult LogAddRef(void * aPtr, nsrefcnt aNewRefcnt, char *aTypeName, PRUint32 aInstanceSize); + nsresult LogRelease(void * aPtr, nsrefcnt aNewRefcnt, char *aTypeName); + nsresult LogCtor(void * aPtr, char *aTypeName, PRUint32 aInstanceSize); + nsresult LogDtor(void * aPtr, char *aTypeName, PRUint32 aInstanceSize); + nsresult LogAddCOMPtr(void * aPtr, nsISupports aObject); + nsresult LogReleaseCOMPtr(void * aPtr, nsISupports aObject); +} +
--- a/dwt/internal/mozilla/nsITransfer.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsITransfer.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,49 +1,31 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsITransfer; -import dwt.dwthelper.utils; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; -public class nsITransfer extends nsIWebProgressListener2 { +import dwt.internal.mozilla.prtime; - static final int LAST_METHOD_ID = nsIWebProgressListener2.LAST_METHOD_ID + 1; +import dwt.internal.mozilla.nsIWebProgressListener2; +import dwt.internal.mozilla.nsIURI; +import dwt.internal.mozilla.nsICancelable; +import dwt.internal.mozilla.nsIMIMEInfo; +import dwt.internal.mozilla.nsILocalFile; +import dwt.internal.mozilla.nsStringAPI; - public static final String NS_ITRANSFER_IID_STR = - "23c51569-e9a1-4a92-adeb-3723db82ef7c"; +const char[] NS_ITRANSFER_IID_STR = "23c51569-e9a1-4a92-adeb-3723db82ef7c"; - public static final nsID NS_ITRANSFER_IID = - new nsID(NS_ITRANSFER_IID_STR); +const nsIID NS_ITRANSFER_IID= + {0x23c51569, 0xe9a1, 0x4a92, + [ 0xad, 0xeb, 0x37, 0x23, 0xdb, 0x82, 0xef, 0x7c ]}; + +interface nsITransfer : nsIWebProgressListener2 { - public nsITransfer(int /*long*/ address) { - super(address); - } + static const char[] IID_STR = NS_ITRANSFER_IID_STR; + static const nsIID IID = NS_ITRANSFER_IID; - public int Init(int /*long*/ aSource, int /*long*/ aTarget, int /*long*/ aDisplayName, int /*long*/ aMIMEInfo, long startTime, int /*long*/ aTempFile, int /*long*/ aCancelable) { - return XPCOM.VtblCall(nsIWebProgressListener2.LAST_METHOD_ID + 1, getAddress(), aSource, aTarget, aDisplayName, aMIMEInfo, startTime, aTempFile, aCancelable); - } +extern(System): + nsresult Init(nsIURI aSource, nsIURI aTarget, nsAString * aDisplayName, nsIMIMEInfo aMIMEInfo, PRTime startTime, nsILocalFile aTempFile, nsICancelable aCancelable); + } +
--- a/dwt/internal/mozilla/nsIURI.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIURI.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,149 +1,48 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIURI; -import dwt.dwthelper.utils; - -public class nsIURI extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 26; - - public static final String NS_IURI_IID_STR = - "07a22cc0-0ce5-11d3-9331-00104ba0fd40"; - - public static final nsID NS_IURI_IID = - new nsID(NS_IURI_IID_STR); +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsStringAPI; - public nsIURI(int /*long*/ address) { - super(address); - } - - public int GetSpec(int /*long*/ aSpec) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aSpec); - } - - public int SetSpec(int /*long*/ aSpec) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aSpec); - } - - public int GetPrePath(int /*long*/ aPrePath) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aPrePath); - } +const char[] NS_IURI_IID_STR = "07a22cc0-0ce5-11d3-9331-00104ba0fd40"; - public int GetScheme(int /*long*/ aScheme) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aScheme); - } - - public int SetScheme(int /*long*/ aScheme) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aScheme); - } - - public int GetUserPass(int /*long*/ aUserPass) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aUserPass); - } - - public int SetUserPass(int /*long*/ aUserPass) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aUserPass); - } +const nsIID NS_IURI_IID= + {0x07a22cc0, 0x0ce5, 0x11d3, + [ 0x93, 0x31, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40 ]}; - public int GetUsername(int /*long*/ aUsername) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aUsername); - } - - public int SetUsername(int /*long*/ aUsername) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aUsername); - } +interface nsIURI : nsISupports { - public int GetPassword(int /*long*/ aPassword) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), aPassword); - } - - public int SetPassword(int /*long*/ aPassword) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 11, getAddress(), aPassword); - } + static const char[] IID_STR = NS_IURI_IID_STR; + static const nsIID IID = NS_IURI_IID; - public int GetHostPort(int /*long*/ aHostPort) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 12, getAddress(), aHostPort); - } - - public int SetHostPort(int /*long*/ aHostPort) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 13, getAddress(), aHostPort); - } - - public int GetHost(int /*long*/ aHost) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 14, getAddress(), aHost); - } - - public int SetHost(int /*long*/ aHost) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 15, getAddress(), aHost); - } - - public int GetPort(int[] aPort) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 16, getAddress(), aPort); - } - - public int SetPort(int aPort) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 17, getAddress(), aPort); - } - - public int GetPath(int /*long*/ aPath) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 18, getAddress(), aPath); - } +extern(System): + nsresult GetSpec(nsACString * aSpec); + nsresult SetSpec(nsACString * aSpec); + nsresult GetPrePath(nsACString * aPrePath); + nsresult GetScheme(nsACString * aScheme); + nsresult SetScheme(nsACString * aScheme); + nsresult GetUserPass(nsACString * aUserPass); + nsresult SetUserPass(nsACString * aUserPass); + nsresult GetUsername(nsACString * aUsername); + nsresult SetUsername(nsACString * aUsername); + nsresult GetPassword(nsACString * aPassword); + nsresult SetPassword(nsACString * aPassword); + nsresult GetHostPort(nsACString * aHostPort); + nsresult SetHostPort(nsACString * aHostPort); + nsresult GetHost(nsACString * aHost); + nsresult SetHost(nsACString * aHost); + nsresult GetPort(PRInt32 *aPort); + nsresult SetPort(PRInt32 aPort); + nsresult GetPath(nsACString * aPath); + nsresult SetPath(nsACString * aPath); + nsresult Equals(nsIURI other, PRBool *_retval); + nsresult SchemeIs(char *scheme, PRBool *_retval); + nsresult Clone(nsIURI *_retval); + nsresult Resolve(nsACString * relativePath, nsACString * _retval); + nsresult GetAsciiSpec(nsACString * aAsciiSpec); + nsresult GetAsciiHost(nsACString * aAsciiHost); + nsresult GetOriginCharset(nsACString * aOriginCharset); - public int SetPath(int /*long*/ aPath) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 19, getAddress(), aPath); - } - - public int Equals(int /*long*/ other, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 20, getAddress(), other, _retval); - } - - public int SchemeIs(byte[] scheme, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 21, getAddress(), scheme, _retval); - } - - public int Clone(int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 22, getAddress(), _retval); - } +} - public int Resolve(int /*long*/ relativePath, int /*long*/ _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 23, getAddress(), relativePath, _retval); - } - - public int GetAsciiSpec(int /*long*/ aAsciiSpec) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 24, getAddress(), aAsciiSpec); - } - - public int GetAsciiHost(int /*long*/ aAsciiHost) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 25, getAddress(), aAsciiHost); - } - - public int GetOriginCharset(int /*long*/ aOriginCharset) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 26, getAddress(), aOriginCharset); - } -}
--- a/dwt/internal/mozilla/nsIURIContentListener.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIURIContentListener.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,77 +1,33 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIURIContentListener; -import dwt.dwthelper.utils; - -public class nsIURIContentListener extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 8; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public static final String NS_IURICONTENTLISTENER_IID_STR = - "94928ab3-8b63-11d3-989d-001083010e9b"; - - public static final nsID NS_IURICONTENTLISTENER_IID = - new nsID(NS_IURICONTENTLISTENER_IID_STR); +import dwt.internal.mozilla.nsIRequest; +import dwt.internal.mozilla.nsIStreamListener; +import dwt.internal.mozilla.nsIURI; - public nsIURIContentListener(int /*long*/ address) { - super(address); - } +const char[] NS_IURICONTENTLISTENER_IID_STR = "94928ab3-8b63-11d3-989d-001083010e9b"; - public int OnStartURIOpen(int /*long*/ aURI, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aURI, _retval); - } +const nsIID NS_IURICONTENTLISTENER_IID= + {0x94928ab3, 0x8b63, 0x11d3, + [ 0x98, 0x9d, 0x00, 0x10, 0x83, 0x01, 0x0e, 0x9b ]}; - public int DoContent(byte[] aContentType, int aIsContentPreferred, int /*long*/ aRequest, int /*long*/[] aContentHandler, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aContentType, aIsContentPreferred, aRequest, aContentHandler, _retval); - } +interface nsIURIContentListener : nsISupports { - public int IsPreferred(byte[] aContentType, int /*long*/[] aDesiredContentType, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aContentType, aDesiredContentType, _retval); - } - - public int CanHandleContent(byte[] aContentType, int aIsContentPreferred, int /*long*/[] aDesiredContentType, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aContentType, aIsContentPreferred, aDesiredContentType, _retval); - } - - public int GetLoadCookie(int /*long*/[] aLoadCookie) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aLoadCookie); - } + static const char[] IID_STR = NS_IURICONTENTLISTENER_IID_STR; + static const nsIID IID = NS_IURICONTENTLISTENER_IID; - public int SetLoadCookie(int /*long*/ aLoadCookie) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aLoadCookie); - } +extern(System): + nsresult OnStartURIOpen(nsIURI aURI, PRBool *_retval); + nsresult DoContent(char *aContentType, PRBool aIsContentPreferred, nsIRequest aRequest, nsIStreamListener *aContentHandler, PRBool *_retval); + nsresult IsPreferred(char *aContentType, char **aDesiredContentType, PRBool *_retval); + nsresult CanHandleContent(char *aContentType, PRBool aIsContentPreferred, char **aDesiredContentType, PRBool *_retval); + nsresult GetLoadCookie(nsISupports *aLoadCookie); + nsresult SetLoadCookie(nsISupports aLoadCookie); + nsresult GetParentContentListener(nsIURIContentListener *aParentContentListener); + nsresult SetParentContentListener(nsIURIContentListener aParentContentListener); - public int GetParentContentListener(int /*long*/[] aParentContentListener) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aParentContentListener); - } +} - public int SetParentContentListener(int /*long*/ aParentContentListener) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aParentContentListener); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsIURL.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,40 @@ +module dwt.internal.mozilla.nsIURL; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsIURI; +import dwt.internal.mozilla.nsStringAPI; + +const char[] NS_IURL_IID_STR = "d6116970-8034-11d3-9399-00104ba0fd40"; + +const nsIID NS_IURL_IID= + {0xd6116970, 0x8034, 0x11d3, + [ 0x93, 0x99, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40 ]}; + +interface nsIURL : nsIURI { + + static const char[] IID_STR = NS_IURL_IID_STR; + static const nsIID IID = NS_IURL_IID; + +extern(System): + nsresult GetFilePath(nsACString * aFilePath); + nsresult SetFilePath(nsACString * aFilePath); + nsresult GetParam(nsACString * aParam); + nsresult SetParam(nsACString * aParam); + nsresult GetQuery(nsACString * aQuery); + nsresult SetQuery(nsACString * aQuery); + nsresult GetRef(nsACString * aRef); + nsresult SetRef(nsACString * aRef); + nsresult GetDirectory(nsACString * aDirectory); + nsresult SetDirectory(nsACString * aDirectory); + nsresult GetFileName(nsACString * aFileName); + nsresult SetFileName(nsACString * aFileName); + nsresult GetFileBaseName(nsACString * aFileBaseName); + nsresult SetFileBaseName(nsACString * aFileBaseName); + nsresult GetFileExtension(nsACString * aFileExtension); + nsresult SetFileExtension(nsACString * aFileExtension); + nsresult GetCommonBaseSpec(nsIURI aURIToCompare, nsACString * _retval); + nsresult GetRelativeSpec(nsIURI aURIToCompare, nsACString * _retval); + +} +
--- a/dwt/internal/mozilla/nsIWeakReference.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIWeakReference.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,49 +1,46 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2005 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIWeakReference; -import dwt.dwthelper.utils; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; -public class nsIWeakReference extends nsISupports { +/****************************************************************************** + +******************************************************************************/ + +const char[] NS_IWEAKREFERENCE_IID_STR = "9188bc85-f92e-11d2-81ef-0060083a0bcf"; - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 1; +const nsIID NS_IWEAKREFERENCE_IID= + {0x9188bc85, 0xf92e, 0x11d2, + [ 0x81, 0xef, 0x00, 0x60, 0x08, 0x3a, 0x0b, 0xcf ]}; + +interface nsIWeakReference : nsISupports { - public static final String NS_IWEAKREFERENCE_IID_STR = - "9188bc85-f92e-11d2-81ef-0060083a0bcf"; + static const char[] IID_STR = NS_IWEAKREFERENCE_IID_STR; + static const nsIID IID = NS_IWEAKREFERENCE_IID; + +extern(System): + nsresult QueryReferent(nsIID * uuid, void * *result); - public static final nsID NS_IWEAKREFERENCE_IID = - new nsID(NS_IWEAKREFERENCE_IID_STR); +} + +/****************************************************************************** + +******************************************************************************/ + +const char[] NS_ISUPPORTSWEAKREFERENCE_IID_STR = "9188bc86-f92e-11d2-81ef-0060083a0bcf"; - public nsIWeakReference(int /*long*/ address) { - super(address); - } +const nsIID NS_ISUPPORTSWEAKREFERENCE_IID= + {0x9188bc86, 0xf92e, 0x11d2, + [ 0x81, 0xef, 0x00, 0x60, 0x08, 0x3a, 0x0b, 0xcf ]}; + +interface nsISupportsWeakReference : nsISupports { - public int QueryReferent(nsID uuid, int /*long*/[] result) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), uuid, result); - } + static const char[] IID_STR = NS_ISUPPORTSWEAKREFERENCE_IID_STR; + static const nsIID IID = NS_ISUPPORTSWEAKREFERENCE_IID; + +extern(System): + nsresult GetWeakReference(nsIWeakReference *_retval); + } +
--- a/dwt/internal/mozilla/nsIWebBrowser.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIWebBrowser.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,73 +1,33 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2005 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIWebBrowser; -import dwt.dwthelper.utils; - -public class nsIWebBrowser extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 7; - - public static final String NS_IWEBBROWSER_IID_STR = - "69e5df00-7b8b-11d3-af61-00a024ffc08c"; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public static final nsID NS_IWEBBROWSER_IID = - new nsID(NS_IWEBBROWSER_IID_STR); +import dwt.internal.mozilla.nsIWebBrowserChrome; +import dwt.internal.mozilla.nsIURIContentListener; +import dwt.internal.mozilla.nsIDOMWindow; +import dwt.internal.mozilla.nsIWeakReference; - public nsIWebBrowser(int /*long*/ address) { - super(address); - } +const char[] NS_IWEBBROWSER_IID_STR = "69e5df00-7b8b-11d3-af61-00a024ffc08c"; - public int AddWebBrowserListener(int /*long*/ aListener, nsID aIID) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aListener, aIID); - } +const nsIID NS_IWEBBROWSER_IID= + {0x69e5df00, 0x7b8b, 0x11d3, + [ 0xaf, 0x61, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c ]}; - public int RemoveWebBrowserListener(int /*long*/ aListener, nsID aIID) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aListener, aIID); - } +interface nsIWebBrowser : nsISupports { - public int GetContainerWindow(int /*long*/[] aContainerWindow) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aContainerWindow); - } - - public int SetContainerWindow(int /*long*/ aContainerWindow) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aContainerWindow); - } + static const char[] IID_STR = NS_IWEBBROWSER_IID_STR; + static const nsIID IID = NS_IWEBBROWSER_IID; - public int GetParentURIContentListener(int /*long*/[] aParentURIContentListener) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aParentURIContentListener); - } +extern(System): + nsresult AddWebBrowserListener(nsIWeakReference aListener, nsIID * aIID); + nsresult RemoveWebBrowserListener(nsIWeakReference aListener, nsIID * aIID); + nsresult GetContainerWindow(nsIWebBrowserChrome *aContainerWindow); + nsresult SetContainerWindow(nsIWebBrowserChrome aContainerWindow); + nsresult GetParentURIContentListener(nsIURIContentListener *aParentURIContentListener); + nsresult SetParentURIContentListener(nsIURIContentListener aParentURIContentListener); + nsresult GetContentDOMWindow(nsIDOMWindow *aContentDOMWindow); - public int SetParentURIContentListener(int /*long*/ aParentURIContentListener) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aParentURIContentListener); - } +} - public int GetContentDOMWindow(int /*long*/[] aContentDOMWindow) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aContentDOMWindow); - } -}
--- a/dwt/internal/mozilla/nsIWebBrowserChrome.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIWebBrowserChrome.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,139 +1,63 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIWebBrowserChrome; -import dwt.dwthelper.utils; - -public class nsIWebBrowserChrome extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 10; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public static final String NS_IWEBBROWSERCHROME_IID_STR = - "ba434c60-9d52-11d3-afb0-00a024ffc08c"; - - public static final nsID NS_IWEBBROWSERCHROME_IID = - new nsID(NS_IWEBBROWSERCHROME_IID_STR); +import dwt.internal.mozilla.nsIWebBrowser; - public nsIWebBrowserChrome(int /*long*/ address) { - super(address); - } - - public static final int STATUS_SCRIPT = 1; +const char[] NS_IWEBBROWSERCHROME_IID_STR = "ba434c60-9d52-11d3-afb0-00a024ffc08c"; - public static final int STATUS_SCRIPT_DEFAULT = 2; - - public static final int STATUS_LINK = 3; - - public int SetStatus(int statusType, char[] status) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), statusType, status); - } +const nsIID NS_IWEBBROWSERCHROME_IID= + {0xba434c60, 0x9d52, 0x11d3, + [ 0xaf, 0xb0, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c ]}; - public int GetWebBrowser(int /*long*/[] aWebBrowser) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aWebBrowser); - } +interface nsIWebBrowserChrome : nsISupports { - public int SetWebBrowser(int /*long*/ aWebBrowser) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aWebBrowser); - } - - public static final int CHROME_DEFAULT = 1; - - public static final int CHROME_WINDOW_BORDERS = 2; - - public static final int CHROME_WINDOW_CLOSE = 4; + static const char[] IID_STR = NS_IWEBBROWSERCHROME_IID_STR; + static const nsIID IID = NS_IWEBBROWSERCHROME_IID; - public static final int CHROME_WINDOW_RESIZE = 8; - - public static final int CHROME_MENUBAR = 16; - - public static final int CHROME_TOOLBAR = 32; +extern(System): + enum { STATUS_SCRIPT = 1U }; + enum { STATUS_SCRIPT_DEFAULT = 2U }; + enum { STATUS_LINK = 3U }; - public static final int CHROME_LOCATIONBAR = 64; - - public static final int CHROME_STATUSBAR = 128; - - public static final int CHROME_PERSONAL_TOOLBAR = 256; - - public static final int CHROME_SCROLLBARS = 512; + nsresult SetStatus(PRUint32 statusType, PRUnichar *status); + nsresult GetWebBrowser(nsIWebBrowser *aWebBrowser); + nsresult SetWebBrowser(nsIWebBrowser aWebBrowser); - public static final int CHROME_TITLEBAR = 1024; - - public static final int CHROME_EXTRA = 2048; - - public static final int CHROME_WITH_SIZE = 4096; - - public static final int CHROME_WITH_POSITION = 8192; - - public static final int CHROME_WINDOW_MIN = 16384; - - public static final int CHROME_WINDOW_POPUP = 32768; - - public static final int CHROME_WINDOW_RAISED = 33554432; - - public static final int CHROME_WINDOW_LOWERED = 67108864; - - public static final int CHROME_CENTER_SCREEN = 134217728; - - public static final int CHROME_DEPENDENT = 268435456; - - public static final int CHROME_MODAL = 536870912; - - public static final int CHROME_OPENAS_DIALOG = 1073741824; - - public static final int CHROME_OPENAS_CHROME = -2147483648; - - public static final int CHROME_ALL = 4094; + enum { CHROME_DEFAULT = 1U }; + enum { CHROME_WINDOW_BORDERS = 2U }; + enum { CHROME_WINDOW_CLOSE = 4U }; + enum { CHROME_WINDOW_RESIZE = 8U }; + enum { CHROME_MENUBAR = 16U }; + enum { CHROME_TOOLBAR = 32U }; + enum { CHROME_LOCATIONBAR = 64U }; + enum { CHROME_STATUSBAR = 128U }; + enum { CHROME_PERSONAL_TOOLBAR = 256U }; + enum { CHROME_SCROLLBARS = 512U }; + enum { CHROME_TITLEBAR = 1024U }; + enum { CHROME_EXTRA = 2048U }; + enum { CHROME_WITH_SIZE = 4096U }; + enum { CHROME_WITH_POSITION = 8192U }; + enum { CHROME_WINDOW_MIN = 16384U }; + enum { CHROME_WINDOW_POPUP = 32768U }; + enum { CHROME_WINDOW_RAISED = 33554432U }; + enum { CHROME_WINDOW_LOWERED = 67108864U }; + enum { CHROME_CENTER_SCREEN = 134217728U }; + enum { CHROME_DEPENDENT = 268435456U }; + enum { CHROME_MODAL = 536870912U }; + enum { CHROME_OPENAS_DIALOG = 1073741824U }; + enum { CHROME_OPENAS_CHROME = 2147483648U }; + enum { CHROME_ALL = 4094U }; - public int GetChromeFlags(int[] aChromeFlags) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aChromeFlags); - } - - public int SetChromeFlags(int aChromeFlags) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aChromeFlags); - } - - public int DestroyBrowserWindow() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress()); - } + nsresult GetChromeFlags(PRUint32 *aChromeFlags); + nsresult SetChromeFlags(PRUint32 aChromeFlags); + nsresult DestroyBrowserWindow(); + nsresult SizeBrowserTo(PRInt32 aCX, PRInt32 aCY); + nsresult ShowAsModal(); + nsresult IsWindowModal(PRBool *_retval); + nsresult ExitModalEventLoop(nsresult aStatus); - public int SizeBrowserTo(int aCX, int aCY) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aCX, aCY); - } - - public int ShowAsModal() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress()); - } +} - public int IsWindowModal(int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), _retval); - } - - public int ExitModalEventLoop(int aStatus) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), aStatus); - } -}
--- a/dwt/internal/mozilla/nsIWebBrowserChromeFocus.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIWebBrowserChromeFocus.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,53 +1,23 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2005 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIWebBrowserChromeFocus; -import dwt.dwthelper.utils; - -public class nsIWebBrowserChromeFocus extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 2; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public static final String NS_IWEBBROWSERCHROMEFOCUS_IID_STR = - "d2206418-1dd1-11b2-8e55-acddcd2bcfb8"; +const char[] NS_IWEBBROWSERCHROMEFOCUS_IID_STR = "d2206418-1dd1-11b2-8e55-acddcd2bcfb8"; - public static final nsID NS_IWEBBROWSERCHROMEFOCUS_IID = - new nsID(NS_IWEBBROWSERCHROMEFOCUS_IID_STR); +const nsIID NS_IWEBBROWSERCHROMEFOCUS_IID= + {0xd2206418, 0x1dd1, 0x11b2, + [ 0x8e, 0x55, 0xac, 0xdd, 0xcd, 0x2b, 0xcf, 0xb8 ]}; - public nsIWebBrowserChromeFocus(int /*long*/ address) { - super(address); - } +interface nsIWebBrowserChromeFocus : nsISupports { + + static const char[] IID_STR = NS_IWEBBROWSERCHROMEFOCUS_IID_STR; + static const nsIID IID = NS_IWEBBROWSERCHROMEFOCUS_IID; - public int FocusNextElement() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress()); - } +extern(System): + nsresult FocusNextElement(); + nsresult FocusPrevElement(); - public int FocusPrevElement() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress()); - } } +
--- a/dwt/internal/mozilla/nsIWebBrowserFocus.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIWebBrowserFocus.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,77 +1,31 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2005 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIWebBrowserFocus; -import dwt.dwthelper.utils; - -public class nsIWebBrowserFocus extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 8; - - public static final String NS_IWEBBROWSERFOCUS_IID_STR = - "9c5d3c58-1dd1-11b2-a1c9-f3699284657a"; - - public static final nsID NS_IWEBBROWSERFOCUS_IID = - new nsID(NS_IWEBBROWSERFOCUS_IID_STR); +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIDOMWindow; +import dwt.internal.mozilla.nsIDOMElement; - public nsIWebBrowserFocus(int /*long*/ address) { - super(address); - } +const char[] NS_IWEBBROWSERFOCUS_IID_STR = "9c5d3c58-1dd1-11b2-a1c9-f3699284657a"; - public int Activate() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress()); - } +const nsIID NS_IWEBBROWSERFOCUS_IID= + {0x9c5d3c58, 0x1dd1, 0x11b2, + [ 0xa1, 0xc9, 0xf3, 0x69, 0x92, 0x84, 0x65, 0x7a ]}; - public int Deactivate() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress()); - } +interface nsIWebBrowserFocus : nsISupports { - public int SetFocusAtFirstElement() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress()); - } - - public int SetFocusAtLastElement() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress()); - } - - public int GetFocusedWindow(int /*long*/[] aFocusedWindow) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aFocusedWindow); - } + static const char[] IID_STR = NS_IWEBBROWSERFOCUS_IID_STR; + static const nsIID IID = NS_IWEBBROWSERFOCUS_IID; - public int SetFocusedWindow(int /*long*/ aFocusedWindow) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aFocusedWindow); - } +extern(System): + nsresult Activate(); + nsresult Deactivate(); + nsresult SetFocusAtFirstElement(); + nsresult SetFocusAtLastElement(); + nsresult GetFocusedWindow(nsIDOMWindow *aFocusedWindow); + nsresult SetFocusedWindow(nsIDOMWindow aFocusedWindow); + nsresult GetFocusedElement(nsIDOMElement *aFocusedElement); + nsresult SetFocusedElement(nsIDOMElement aFocusedElement); - public int GetFocusedElement(int /*long*/[] aFocusedElement) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aFocusedElement); - } +} - public int SetFocusedElement(int /*long*/ aFocusedElement) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aFocusedElement); - } -}
--- a/dwt/internal/mozilla/nsIWebNavigation.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIWebNavigation.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,121 +1,59 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIWebNavigation; -import dwt.dwthelper.utils; - -public class nsIWebNavigation extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 13; - - public static final String NS_IWEBNAVIGATION_IID_STR = - "f5d9e7b0-d930-11d3-b057-00a024ffc08c"; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public static final nsID NS_IWEBNAVIGATION_IID = - new nsID(NS_IWEBNAVIGATION_IID_STR); +import dwt.internal.mozilla.nsIDOMDocument; +import dwt.internal.mozilla.nsIInputStream; +import dwt.internal.mozilla.nsISHistory; +import dwt.internal.mozilla.nsIURI; - public nsIWebNavigation(int /*long*/ address) { - super(address); - } - - public int GetCanGoBack(int[] aCanGoBack) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aCanGoBack); - } +const char[] NS_IWEBNAVIGATION_IID_STR = "f5d9e7b0-d930-11d3-b057-00a024ffc08c"; - public int GetCanGoForward(int[] aCanGoForward) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aCanGoForward); - } +const nsIID NS_IWEBNAVIGATION_IID= + {0xf5d9e7b0, 0xd930, 0x11d3, + [ 0xb0, 0x57, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c ]}; - public int GoBack() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress()); - } - - public int GoForward() { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress()); - } +interface nsIWebNavigation : nsISupports { - public int GotoIndex(int index) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), index); - } - - public static final int LOAD_FLAGS_MASK = 65535; + static const char[] IID_STR = NS_IWEBNAVIGATION_IID_STR; + static const nsIID IID = NS_IWEBNAVIGATION_IID; - public static final int LOAD_FLAGS_NONE = 0; - - public static final int LOAD_FLAGS_IS_REFRESH = 16; - - public static final int LOAD_FLAGS_IS_LINK = 32; - - public static final int LOAD_FLAGS_BYPASS_HISTORY = 64; +extern(System): + nsresult GetCanGoBack(PRBool *aCanGoBack); + nsresult GetCanGoForward(PRBool *aCanGoForward); + nsresult GoBack(); + nsresult GoForward(); + nsresult GotoIndex(PRInt32 index); - public static final int LOAD_FLAGS_REPLACE_HISTORY = 128; - - public static final int LOAD_FLAGS_BYPASS_CACHE = 256; - - public static final int LOAD_FLAGS_BYPASS_PROXY = 512; - - public static final int LOAD_FLAGS_CHARSET_CHANGE = 1024; - - public int LoadURI(char[] uri, int loadFlags, int /*long*/ referrer, int /*long*/ postData, int /*long*/ headers) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), uri, loadFlags, referrer, postData, headers); - } - - public int Reload(int reloadFlags) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), reloadFlags); - } - - public static final int STOP_NETWORK = 1; - - public static final int STOP_CONTENT = 2; - - public static final int STOP_ALL = 3; + enum { LOAD_FLAGS_MASK = 65535U }; + enum { LOAD_FLAGS_NONE = 0U }; + enum { LOAD_FLAGS_IS_REFRESH = 16U }; + enum { LOAD_FLAGS_IS_LINK = 32U }; + enum { LOAD_FLAGS_BYPASS_HISTORY = 64U }; + enum { LOAD_FLAGS_REPLACE_HISTORY = 128U }; + enum { LOAD_FLAGS_BYPASS_CACHE = 256U }; + enum { LOAD_FLAGS_BYPASS_PROXY = 512U }; + enum { LOAD_FLAGS_CHARSET_CHANGE = 1024U }; + enum { LOAD_FLAGS_STOP_CONTENT = 2048U }; + enum { LOAD_FLAGS_FROM_EXTERNAL = 4096U }; + enum { LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP = 8192U }; + enum { LOAD_FLAGS_FIRST_LOAD = 16384U }; - public int Stop(int stopFlags) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), stopFlags); - } + nsresult LoadURI(PRUnichar *aURI, PRUint32 aLoadFlags, nsIURI aReferrer, nsIInputStream aPostData, nsIInputStream aHeaders); + nsresult Reload(PRUint32 aReloadFlags); - public int GetDocument(int /*long*/[] aDocument) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aDocument); - } - - public int GetCurrentURI(int /*long*/[] aCurrentURI) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), aCurrentURI); - } + enum { STOP_NETWORK = 1U }; + enum { STOP_CONTENT = 2U }; + enum { STOP_ALL = 3U }; - public int GetReferringURI(int /*long*/[] aReferringURI) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 11, getAddress(), aReferringURI); - } + nsresult Stop(PRUint32 aStopFlags); + nsresult GetDocument(nsIDOMDocument *aDocument); + nsresult GetCurrentURI(nsIURI *aCurrentURI); + nsresult GetReferringURI(nsIURI *aReferringURI); + nsresult GetSessionHistory(nsISHistory *aSessionHistory); + nsresult SetSessionHistory(nsISHistory aSessionHistory); - public int GetSessionHistory(int /*long*/[] aSessionHistory) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 12, getAddress(), aSessionHistory); - } +} - public int SetSessionHistory(int /*long*/ aSessionHistory) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 13, getAddress(), aSessionHistory); - } -}
--- a/dwt/internal/mozilla/nsIWebNavigationInfo.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIWebNavigationInfo.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,57 +1,29 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2005 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIWebNavigationInfo; -import dwt.dwthelper.utils; - -public class nsIWebNavigationInfo extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 1; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; +import dwt.internal.mozilla.nsIWebNavigation; +import dwt.internal.mozilla.nsStringAPI; - public static final String NS_IWEBNAVIGATIONINFO_IID_STR = - "62a93afb-93a1-465c-84c8-0432264229de"; +const char[] NS_IWEBNAVIGATIONINFO_IID_STR = "62a93afb-93a1-465c-84c8-0432264229de"; - public static final nsID NS_IWEBNAVIGATIONINFO_IID = - new nsID(NS_IWEBNAVIGATIONINFO_IID_STR); +const nsIID NS_IWEBNAVIGATIONINFO_IID= + {0x62a93afb, 0x93a1, 0x465c, + [ 0x84, 0xc8, 0x04, 0x32, 0x26, 0x42, 0x29, 0xde ]}; + +interface nsIWebNavigationInfo : nsISupports { - public nsIWebNavigationInfo(int /*long*/ address) { - super(address); - } - - public static final int UNSUPPORTED = 0; - - public static final int IMAGE = 1; + static const char[] IID_STR = NS_IWEBNAVIGATIONINFO_IID_STR; + static const nsIID IID = NS_IWEBNAVIGATIONINFO_IID; - public static final int PLUGIN = 2; - - public static final int OTHER = 32768; +extern(System): + enum { UNSUPPORTED = 0U }; + enum { IMAGE = 1U }; + enum { PLUGIN = 2U }; + enum { OTHER = 32768U }; - public int IsTypeSupported(int /*long*/ aType, int /*long*/ aWebNav, int[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aType, aWebNav, _retval); - } + nsresult IsTypeSupported(nsACString * aType, nsIWebNavigation aWebNav, PRUint32 *_retval); + } +
--- a/dwt/internal/mozilla/nsIWebProgress.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIWebProgress.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,81 +1,39 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIWebProgress; -import dwt.dwthelper.utils; - -public class nsIWebProgress extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 4; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public static final String NS_IWEBPROGRESS_IID_STR = - "570f39d0-efd0-11d3-b093-00a024ffc08c"; +import dwt.internal.mozilla.nsIDOMWindow; +import dwt.internal.mozilla.nsIWebProgressListener; - public static final nsID NS_IWEBPROGRESS_IID = - new nsID(NS_IWEBPROGRESS_IID_STR); +const char[] NS_IWEBPROGRESS_IID_STR = "570f39d0-efd0-11d3-b093-00a024ffc08c"; - public nsIWebProgress(int /*long*/ address) { - super(address); - } - - public static final int NOTIFY_STATE_REQUEST = 1; +const nsIID NS_IWEBPROGRESS_IID= + {0x570f39d0, 0xefd0, 0x11d3, + [ 0xb0, 0x93, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c ]}; - public static final int NOTIFY_STATE_DOCUMENT = 2; - - public static final int NOTIFY_STATE_NETWORK = 4; +interface nsIWebProgress : nsISupports { - public static final int NOTIFY_STATE_WINDOW = 8; - - public static final int NOTIFY_STATE_ALL = 15; + static const char[] IID_STR = NS_IWEBPROGRESS_IID_STR; + static const nsIID IID = NS_IWEBPROGRESS_IID; - public static final int NOTIFY_PROGRESS = 16; - - public static final int NOTIFY_STATUS = 32; - - public static final int NOTIFY_SECURITY = 64; - - public static final int NOTIFY_LOCATION = 128; - - public static final int NOTIFY_ALL = 255; +extern(System): + enum { NOTIFY_STATE_REQUEST = 1U }; + enum { NOTIFY_STATE_DOCUMENT = 2U }; + enum { NOTIFY_STATE_NETWORK = 4U }; + enum { NOTIFY_STATE_WINDOW = 8U }; + enum { NOTIFY_STATE_ALL = 15U }; + enum { NOTIFY_PROGRESS = 16U }; + enum { NOTIFY_STATUS = 32U }; + enum { NOTIFY_SECURITY = 64U }; + enum { NOTIFY_LOCATION = 128U }; + enum { NOTIFY_ALL = 255U }; - public int AddProgressListener(int /*long*/ listener, int aNotifyMask) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), listener, aNotifyMask); - } - - public int RemoveProgressListener(int /*long*/ listener) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), listener); - } + nsresult AddProgressListener(nsIWebProgressListener aListener, PRUint32 aNotifyMask); + nsresult RemoveProgressListener(nsIWebProgressListener aListener); + nsresult GetDOMWindow(nsIDOMWindow *aDOMWindow); + nsresult GetIsLoadingDocument(PRBool *aIsLoadingDocument); - public int GetDOMWindow(int /*long*/[] aDOMWindow) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aDOMWindow); - } +} - public int GetIsLoadingDocument(int[] aIsLoadingDocument) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aIsLoadingDocument); - } -}
--- a/dwt/internal/mozilla/nsIWebProgressListener.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIWebProgressListener.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,95 +1,47 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2005 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIWebProgressListener; -import dwt.dwthelper.utils; - -public class nsIWebProgressListener extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 5; +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public static final String NS_IWEBPROGRESSLISTENER_IID_STR = - "570f39d1-efd0-11d3-b093-00a024ffc08c"; - - public static final nsID NS_IWEBPROGRESSLISTENER_IID = - new nsID(NS_IWEBPROGRESSLISTENER_IID_STR); - - public nsIWebProgressListener(int /*long*/ address) { - super(address); - } +import dwt.internal.mozilla.nsIWebProgress; +import dwt.internal.mozilla.nsIRequest; +import dwt.internal.mozilla.nsIURI; - public static final int STATE_START = 1; - - public static final int STATE_REDIRECTING = 2; - - public static final int STATE_TRANSFERRING = 4; - - public static final int STATE_NEGOTIATING = 8; +const char[] NS_IWEBPROGRESSLISTENER_IID_STR = "570f39d1-efd0-11d3-b093-00a024ffc08c"; - public static final int STATE_STOP = 16; - - public static final int STATE_IS_REQUEST = 65536; +const nsIID NS_IWEBPROGRESSLISTENER_IID= + {0x570f39d1, 0xefd0, 0x11d3, + [ 0xb0, 0x93, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c ]}; - public static final int STATE_IS_DOCUMENT = 131072; +interface nsIWebProgressListener : nsISupports { - public static final int STATE_IS_NETWORK = 262144; + static const char[] IID_STR = NS_IWEBPROGRESSLISTENER_IID_STR; + static const nsIID IID = NS_IWEBPROGRESSLISTENER_IID; - public static final int STATE_IS_WINDOW = 524288; - - public static final int STATE_IS_INSECURE = 4; - - public static final int STATE_IS_BROKEN = 1; - - public static final int STATE_IS_SECURE = 2; - - public static final int STATE_SECURE_HIGH = 262144; - - public static final int STATE_SECURE_MED = 65536; - - public static final int STATE_SECURE_LOW = 131072; +extern(System): + enum { STATE_START = 1U }; + enum { STATE_REDIRECTING = 2U }; + enum { STATE_TRANSFERRING = 4U }; + enum { STATE_NEGOTIATING = 8U }; + enum { STATE_STOP = 16U }; + enum { STATE_IS_REQUEST = 65536U }; + enum { STATE_IS_DOCUMENT = 131072U }; + enum { STATE_IS_NETWORK = 262144U }; + enum { STATE_IS_WINDOW = 524288U }; + enum { STATE_RESTORING = 16777216U }; + enum { STATE_IS_INSECURE = 4U }; + enum { STATE_IS_BROKEN = 1U }; + enum { STATE_IS_SECURE = 2U }; + enum { STATE_SECURE_HIGH = 262144U }; + enum { STATE_SECURE_MED = 65536U }; + enum { STATE_SECURE_LOW = 131072U }; - public int OnStateChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int aStateFlags, int aStatus) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aWebProgress, aRequest, aStateFlags, aStatus); - } - - public int OnProgressChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int aCurSelfProgress, int aMaxSelfProgress, int aCurTotalProgress, int aMaxTotalProgress) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress); - } + nsresult OnStateChange(nsIWebProgress aWebProgress, nsIRequest aRequest, PRUint32 aStateFlags, nsresult aStatus); + nsresult OnProgressChange(nsIWebProgress aWebProgress, nsIRequest aRequest, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress); + nsresult OnLocationChange(nsIWebProgress aWebProgress, nsIRequest aRequest, nsIURI aLocation); + nsresult OnStatusChange(nsIWebProgress aWebProgress, nsIRequest aRequest, nsresult aStatus, PRUnichar *aMessage); + nsresult OnSecurityChange(nsIWebProgress aWebProgress, nsIRequest aRequest, PRUint32 aState); - public int OnLocationChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ location) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aWebProgress, aRequest, location); - } +} - public int OnStatusChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int aStatus, char[] aMessage) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aWebProgress, aRequest, aStatus, aMessage); - } - - public int OnSecurityChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int state) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aWebProgress, aRequest, state); - } -}
--- a/dwt/internal/mozilla/nsIWebProgressListener2.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIWebProgressListener2.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,49 +1,25 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIWebProgressListener2; -import dwt.dwthelper.utils; - -public class nsIWebProgressListener2 extends nsIWebProgressListener { +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; - static final int LAST_METHOD_ID = nsIWebProgressListener.LAST_METHOD_ID + 1; +import dwt.internal.mozilla.nsIWebProgressListener; +import dwt.internal.mozilla.nsIWebProgress; +import dwt.internal.mozilla.nsIRequest; - public static final String NS_IWEBPROGRESSLISTENER2_IID_STR = - "3f24610d-1e1f-4151-9d2e-239884742324"; +const char[] NS_IWEBPROGRESSLISTENER2_IID_STR = "3f24610d-1e1f-4151-9d2e-239884742324"; - public static final nsID NS_IWEBPROGRESSLISTENER2_IID = - new nsID(NS_IWEBPROGRESSLISTENER2_IID_STR); +const nsIID NS_IWEBPROGRESSLISTENER2_IID= + {0x3f24610d, 0x1e1f, 0x4151, + [ 0x9d, 0x2e, 0x23, 0x98, 0x84, 0x74, 0x23, 0x24 ]}; + +interface nsIWebProgressListener2 : nsIWebProgressListener { - public nsIWebProgressListener2(int /*long*/ address) { - super(address); - } + static const char[] IID_STR = NS_IWEBPROGRESSLISTENER2_IID_STR; + static const nsIID IID = NS_IWEBPROGRESSLISTENER2_IID; - public int OnProgressChange64(int /*long*/ aWebProgress, int /*long*/ aRequest, long aCurSelfProgress, long aMaxSelfProgress, long aCurTotalProgress, long aMaxTotalProgress) { - return XPCOM.VtblCall(nsIWebProgressListener.LAST_METHOD_ID + 1, getAddress(), aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress); - } +extern(System): + nsresult OnProgressChange64(nsIWebProgress aWebProgress, nsIRequest aRequest, PRInt64 aCurSelfProgress, PRInt64 aMaxSelfProgress, PRInt64 aCurTotalProgress, PRInt64 aMaxTotalProgress); + } +
--- a/dwt/internal/mozilla/nsIWindowCreator.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIWindowCreator.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,49 +1,24 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2005 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIWindowCreator; -import dwt.dwthelper.utils; - -public class nsIWindowCreator extends nsISupports { +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 1; +import dwt.internal.mozilla.nsIWebBrowserChrome; - public static final String NS_IWINDOWCREATOR_IID_STR = - "30465632-a777-44cc-90f9-8145475ef999"; +const char[] NS_IWINDOWCREATOR_IID_STR = "30465632-a777-44cc-90f9-8145475ef999"; - public static final nsID NS_IWINDOWCREATOR_IID = - new nsID(NS_IWINDOWCREATOR_IID_STR); +const nsIID NS_IWINDOWCREATOR_IID= + {0x30465632, 0xa777, 0x44cc, + [ 0x90, 0xf9, 0x81, 0x45, 0x47, 0x5e, 0xf9, 0x99 ]}; + +interface nsIWindowCreator : nsISupports { - public nsIWindowCreator(int /*long*/ address) { - super(address); - } + static const char[] IID_STR = NS_IWINDOWCREATOR_IID_STR; + static const nsIID IID = NS_IWINDOWCREATOR_IID; - public int CreateChromeWindow(int /*long*/ parent, int chromeFlags, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), parent, chromeFlags, _retval); - } +extern(System): + nsresult CreateChromeWindow(nsIWebBrowserChrome parent, PRUint32 chromeFlags, nsIWebBrowserChrome *_retval); + } +
--- a/dwt/internal/mozilla/nsIWindowCreator2.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIWindowCreator2.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,51 +1,26 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2008 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIWindowCreator2; -import dwt.dwthelper.utils; - -public class nsIWindowCreator2 extends nsIWindowCreator { +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; - static final int LAST_METHOD_ID = nsIWindowCreator.LAST_METHOD_ID + 1; +import dwt.internal.mozilla.nsIWindowCreator; +import dwt.internal.mozilla.nsIURI; +import dwt.internal.mozilla.nsIWebBrowserChrome; - public static final String NS_IWINDOWCREATOR2_IID_STR = - "f673ec81-a4b0-11d6-964b-eb5a2bf216fc"; +const char[] NS_IWINDOWCREATOR2_IID_STR = "f673ec81-a4b0-11d6-964b-eb5a2bf216fc"; - public static final nsID NS_IWINDOWCREATOR2_IID = - new nsID(NS_IWINDOWCREATOR2_IID_STR); +const nsIID NS_IWINDOWCREATOR2_IID= + {0xf673ec81, 0xa4b0, 0x11d6, + [ 0x96, 0x4b, 0xeb, 0x5a, 0x2b, 0xf2, 0x16, 0xfc ]}; - public nsIWindowCreator2(int /*long*/ address) { - super(address); - } +interface nsIWindowCreator2 : nsIWindowCreator { - public static final int PARENT_IS_LOADING_OR_RUNNING_TIMEOUT = 1; + static const char[] IID_STR = NS_IWINDOWCREATOR2_IID_STR; + static const nsIID IID = NS_IWINDOWCREATOR2_IID; - public int CreateChromeWindow2(int /*long*/ parent, int chromeFlags, int contextFlags, int /*long*/ uri, int[] cancel, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsIWindowCreator.LAST_METHOD_ID + 1, getAddress(), parent, chromeFlags, contextFlags, uri, cancel, _retval); - } +extern(System): + enum { PARENT_IS_LOADING_OR_RUNNING_TIMEOUT = 1U }; + nsresult CreateChromeWindow2(nsIWebBrowserChrome parent, PRUint32 chromeFlags, PRUint32 contextFlags, nsIURI uri, PRBool *cancel, nsIWebBrowserChrome *_retval); + } +
--- a/dwt/internal/mozilla/nsIWindowWatcher.d Fri Jan 16 12:19:08 2009 +0100 +++ b/dwt/internal/mozilla/nsIWindowWatcher.d Fri Jan 16 12:49:08 2009 +0100 @@ -1,89 +1,40 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by Netscape are Copyright (C) 1998-1999 - * Netscape Communications Corporation. All Rights Reserved. - * - * Contributor(s): - * - * IBM - * - Binding to permit interfacing between Mozilla and DWT - * - Copyright (C) 2003, 2005 IBM Corp. All Rights Reserved. - * - * ***** END LICENSE BLOCK ***** */ module dwt.internal.mozilla.nsIWindowWatcher; -import dwt.dwthelper.utils; - -public class nsIWindowWatcher extends nsISupports { - - static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 11; - - public static final String NS_IWINDOWWATCHER_IID_STR = - "002286a8-494b-43b3-8ddd-49e3fc50622b"; - - public static final nsID NS_IWINDOWWATCHER_IID = - new nsID(NS_IWINDOWWATCHER_IID_STR); +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.nsID; +import dwt.internal.mozilla.nsISupports; - public nsIWindowWatcher(int /*long*/ address) { - super(address); - } - - public int OpenWindow(int /*long*/ aParent, byte[] aUrl, byte[] aName, byte[] aFeatures, int /*long*/ aArguments, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aParent, aUrl, aName, aFeatures, aArguments, _retval); - } +import dwt.internal.mozilla.nsIDOMWindow; +import dwt.internal.mozilla.nsIObserver; +import dwt.internal.mozilla.nsIPrompt; +import dwt.internal.mozilla.nsIAuthPrompt; +import dwt.internal.mozilla.nsISimpleEnumerator; +import dwt.internal.mozilla.nsIWebBrowserChrome; +import dwt.internal.mozilla.nsIWindowCreator; - public int RegisterNotification(int /*long*/ aObserver) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), aObserver); - } +const char[] NS_IWINDOWWATCHER_IID_STR = "002286a8-494b-43b3-8ddd-49e3fc50622b"; - public int UnregisterNotification(int /*long*/ aObserver) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aObserver); - } +const nsIID NS_IWINDOWWATCHER_IID= + {0x002286a8, 0x494b, 0x43b3, + [ 0x8d, 0xdd, 0x49, 0xe3, 0xfc, 0x50, 0x62, 0x2b ]}; - public int GetWindowEnumerator(int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), _retval); - } - - public int GetNewPrompter(int /*long*/ aParent, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress(), aParent, _retval); - } +interface nsIWindowWatcher : nsISupports { - public int GetNewAuthPrompter(int /*long*/ aParent, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress(), aParent, _retval); - } - - public int SetWindowCreator(int /*long*/ creator) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), creator); - } + static const char[] IID_STR = NS_IWINDOWWATCHER_IID_STR; + static const nsIID IID = NS_IWINDOWWATCHER_IID; - public int GetChromeForWindow(int /*long*/ aWindow, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aWindow, _retval); - } - - public int GetWindowByName(char[] aTargetName, int /*long*/ aCurrentWindow, int /*long*/[] _retval) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aTargetName, aCurrentWindow, _retval); - } +extern(System): + nsresult OpenWindow(nsIDOMWindow aParent, char *aUrl, char *aName, char *aFeatures, nsISupports aArguments, nsIDOMWindow *_retval); + nsresult RegisterNotification(nsIObserver aObserver); + nsresult UnregisterNotification(nsIObserver aObserver); + nsresult GetWindowEnumerator(nsISimpleEnumerator *_retval); + nsresult GetNewPrompter(nsIDOMWindow aParent, nsIPrompt *_retval); + nsresult GetNewAuthPrompter(nsIDOMWindow aParent, nsIAuthPrompt *_retval); + nsresult SetWindowCreator(nsIWindowCreator creator); + nsresult GetChromeForWindow(nsIDOMWindow aWindow, nsIWebBrowserChrome *_retval); + nsresult GetWindowByName(PRUnichar *aTargetName, nsIDOMWindow aCurrentWindow, nsIDOMWindow *_retval); + nsresult GetActiveWindow(nsIDOMWindow *aActiveWindow); + nsresult SetActiveWindow(nsIDOMWindow aActiveWindow); - public int GetActiveWindow(int /*long*/[] aActiveWindow) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), aActiveWindow); - } +} - public int SetActiveWindow(int /*long*/ aActiveWindow) { - return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 11, getAddress(), aActiveWindow); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/nsStringAPI.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,191 @@ +module dwt.internal.mozilla.nsStringAPI; + +import Utf = tango.text.convert.Utf; +import dwt.internal.mozilla.Common; + +extern (System): + +/****************************************************************************** + +******************************************************************************/ + +enum +{ + NS_STRING_CONTAINER_INIT_DEPEND = 2, + NS_STRING_CONTAINER_INIT_ADOPT = 4, + NS_STRING_CONTAINER_INIT_SUBSTRING = 8, +} + +nsresult NS_StringContainerInit ( nsStringContainer *aContainer ); +nsresult NS_StringContainerInit2( nsStringContainer *aContainer, PRUnichar *aData, PRUint32 aDataLength, PRUint32 aFlags ); +void NS_StringContainerFinish(nsStringContainer *aContainer); +PRUint32 NS_StringGetData(nsAString *aStr, PRUnichar **aData, PRBool *aTerminated); +PRUint32 NS_StringGetMutableData(nsAString *aStr, PRUint32 aDataLength, PRUnichar **aData); +PRUnichar * NS_StringCloneData(nsAString *aStr); +nsresult NS_StringSetData(nsAString *aStr, PRUnichar *aData, PRUint32 aDataLength); +nsresult NS_StringSetDataRange( nsAString *aStr, PRUint32 aCutOffset, PRUint32 aCutLength, PRUnichar *aData, PRUint32 aDataLength ); +nsresult NS_StringCopy(nsAString *aDestStr, nsAString *aSrcStr); + +/****************************************************************************** + +******************************************************************************/ + +enum +{ + NS_CSTRING_CONTAINER_INIT_DEPEND = 2, + NS_CSTRING_CONTAINER_INIT_ADOPT = 4, + NS_CSTRING_CONTAINER_INIT_SUBSTRING = 8, +} + +nsresult NS_CStringContainerInit( nsCStringContainer *aContainer ); +nsresult NS_CStringContainerInit2( nsCStringContainer *aContainer, char *aData, PRUint32 aDataLength, PRUint32 aFlags ); +void NS_CStringContainerFinish( nsCStringContainer *aContainer ); +PRUint32 NS_CStringGetData( nsACString *aStr, char **aData, PRBool *aTerminated ); +PRUint32 NS_CStringGetMutableData( nsACString *aStr, PRUint32 aDataLength, char **aData ); +char * NS_CStringCloneData( nsACString *aStr); +nsresult NS_CStringSetData( nsACString *aStr, char *aData, PRUint32 aDataLength ); +nsresult NS_CStringSetDataRange( nsACString *aStr, PRUint32 aCutOffset, + PRUint32 aCutLength, char *aData, PRUint32 aDataLength ); +nsresult NS_CStringCopy( nsACString *aDestStr, nsACString *aSrcStr ); + +/****************************************************************************** + +******************************************************************************/ + +enum nsCStringEncoding +{ + NS_CSTRING_ENCODING_ASCII, + NS_CSTRING_ENCODING_UTF8, + NS_CSTRING_ENCODING_NATIVE_FILESYSTEM, +} + +nsresult NS_CStringToUTF16( nsACString *aSource, int aSrcEncoding, nsAString *aDest ); +nsresult NS_UTF16ToCString( nsAString *aSource, int aDestEncoding, nsACString *aDest ); + +/****************************************************************************** + +******************************************************************************/ + +alias nsAString nsAString_external; +alias nsACString nsACString_external; + +//alias nsAString nsEmbedString; +//alias nsACString nsEmbedCString; + +struct nsAString +{ + + static nsAString opCall(wchar[] s) + { + nsAString result; + NS_StringSetData(&result, cast(PRUnichar*)s, uint.max); + return result; + } + + static wchar[] toString16( nsAString* str ) + { + wchar* buffer = null; + PRBool terminated; + uint len = NS_StringGetData(str, &buffer, &terminated); + return buffer[0 .. len].dup; + } + + static char[] toString( nsAString* str ) + { + return Utf.toString( nsAString.toString16( str ) ); + } + + private: + void *v; +} + +struct nsACString +{ +/+ + static nsACString opCall(char[] s) + { + nsACString result; + NS_CStringSetData(&result, cast(char*)s, uint.max); + return result; + } ++/ + private: + void *v; +} + +/****************************************************************************** + +******************************************************************************/ + +struct nsStringContainer// : public nsAString +{ +private: + void* v; + void* d1; + uint d2; + void* d3; +} + +struct nsCStringContainer// : public nsACString +{ +private: + void* v; + void* d1; + uint d2; + void* d3; +} + +/****************************************************************************** + +******************************************************************************/ + +// import mozilla.xpcom.nsDebug; + +alias nsString_external nsString; +alias nsCString_external nsCString; +alias nsDependentString_external nsDependentString; +alias nsDependentCString_external nsDependentCString; +alias NS_ConvertASCIItoUTF16_external NS_ConvertASCIItoUTF16; +alias NS_ConvertUTF8toUTF16_external NS_ConvertUTF8toUTF16; +alias NS_ConvertUTF16toUTF8_external NS_ConvertUTF16toUTF8; +alias NS_LossyConvertUTF16toASCII_external NS_LossyConvertUTF16toASCII; +alias nsGetterCopies_external nsGetterCopies; +alias nsCGetterCopies_external nsCGetterCopies; +alias nsDependentSubstring_external nsDependentSubstring; +alias nsDependentCSubstring_external nsDependentCSubstring; + +struct nsString_external{} +struct nsCString_external{} +struct nsDependentString_external{} +struct nsDependentCString_external{} +struct NS_ConvertASCIItoUTF16_external{} +struct NS_ConvertUTF8toUTF16_external{} +struct NS_ConvertUTF16toUTF8_external{} +struct NS_LossyConvertUTF16toASCII_external{} + +/****************************************************************************** + +******************************************************************************/ + +struct nsGetterCopies_external +{ + private: + alias PRUnichar char_type; + nsString_external *mString; + char_type *mData; +} + +struct nsCGetterCopies_external +{ + private: + alias char char_type; + nsCString_external *mString; + char_type *mData; +} + +/****************************************************************************** + +******************************************************************************/ + +struct nsDependentSubstring_external{} +struct nsDependentCSubstring_external{}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/prinrval.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,60 @@ +module dwt.internal.mozilla.prinrval; + +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape Portable Runtime (NSPR). + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +import dwt.internal.mozilla.Common; + +extern (System): + +alias PRUint32 PRIntervalTime; + +const PR_INTERVAL_MIN = 1000U; +const PR_INTERVAL_MAX = 100000U; +const PR_INTERVAL_NO_WAIT = 0U; +const PR_INTERVAL_NO_TIMEOUT = 0xffffffffU; + +version(NON_XPCOM_GLUE) +{ + PRIntervalTime PR_IntervalNow(); + PRUint32 PR_TicksPerSecond(); + PRIntervalTime PR_SecondsToInterval(PRUint32 seconds); + PRIntervalTime PR_MillisecondsToInterval(PRUint32 milli); + PRIntervalTime PR_MicrosecondsToInterval(PRUint32 micro); + PRUint32 PR_IntervalToSeconds(PRIntervalTime ticks); + PRUint32 PR_IntervalToMilliseconds(PRIntervalTime ticks); + PRUint32 PR_IntervalToMicroseconds(PRIntervalTime ticks); +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/prio.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,517 @@ +module dwt.internal.mozilla.prio; + +import dwt.internal.mozilla.Common; +import dwt.internal.mozilla.prtime; +import dwt.internal.mozilla.prinrval; + +extern (System): + +alias PRIntn PRDescIdentity; +alias void PRFilePrivate; + +struct PRFileDesc +{ + PRIOMethods *methods; + PRFilePrivate *secret; + PRFileDesc *lower; + PRFileDesc *higher; + void function(PRFileDesc *fd)dtor; + PRDescIdentity identity; +} + +enum PRTransmitFileFlags +{ + PR_TRANSMITFILE_KEEP_OPEN, + PR_TRANSMITFILE_CLOSE_SOCKET, +} + +const PR_AF_INET = 2; +const PR_AF_LOCAL = 1; +const PR_INADDR_LOOPBACK = 0x7f000001; +const PR_AF_UNSPEC = 0; + +union _N2 +{ + PRUint8 [16]_S6_u8; + PRUint16 [8]_S6_u16; + PRUint32 [4]_S6_u32; + PRUint64 [2]_S6_u64; +} + +struct PRIPv6Addr +{ + struct _N2{ + union + { + PRUint8 [16]_S6_u8; + PRUint16 [8]_S6_u16; + PRUint32 [4]_S6_u32; + PRUint64 [2]_S6_u64; + } + } + _N2 _S6_un; +} + +struct _N3 +{ + PRUint16 family; + char [14]data; +} + +struct _N4 +{ + PRUint16 family; + PRUint16 port; + PRUint32 ip; + char [8]pad; +} + +struct _N5 +{ + PRUint16 family; + PRUint16 port; + PRUint32 flowinfo; + PRIPv6Addr ip; + PRUint32 scope_id; +} + +union PRNetAddr +{ + struct _N3 + { + PRUint16 family; + char [14]data; + } + _N3 raw; + struct _N4 + { + PRUint16 family; + PRUint16 port; + PRUint32 ip; + char [8]pad; + } + _N4 inet; + struct _N5 + { + PRUint16 family; + PRUint16 port; + PRUint32 flowinfo; + PRIPv6Addr ip; + PRUint32 scope_id; + } + _N5 ipv6; +} + +enum PRSockOption +{ + PR_SockOpt_Nonblocking, + PR_SockOpt_Linger, + PR_SockOpt_Reuseaddr, + PR_SockOpt_Keepalive, + PR_SockOpt_RecvBufferSize, + PR_SockOpt_SendBufferSize, + PR_SockOpt_IpTimeToLive, + PR_SockOpt_IpTypeOfService, + PR_SockOpt_AddMember, + PR_SockOpt_DropMember, + PR_SockOpt_McastInterface, + PR_SockOpt_McastTimeToLive, + PR_SockOpt_McastLoopback, + PR_SockOpt_NoDelay, + PR_SockOpt_MaxSegment, + PR_SockOpt_Broadcast, + PR_SockOpt_Last, +} + +struct PRLinger +{ + PRBool polarity; + PRIntervalTime linger; +} + +struct PRMcastRequest +{ + PRNetAddr mcaddr; + PRNetAddr ifaddr; +} + +union _N6 +{ + PRUintn ip_ttl; + PRUintn mcast_ttl; + PRUintn tos; + PRBool non_blocking; + PRBool reuse_addr; + PRBool keep_alive; + PRBool mcast_loopback; + PRBool no_delay; + PRBool broadcast; + PRSize max_segment; + PRSize recv_buffer_size; + PRSize send_buffer_size; + PRLinger linger; + PRMcastRequest add_member; + PRMcastRequest drop_member; + PRNetAddr mcast_if; +} + +struct PRSocketOptionData +{ + int option; + union _N6 + { + PRUintn ip_ttl; + PRUintn mcast_ttl; + PRUintn tos; + PRBool non_blocking; + PRBool reuse_addr; + PRBool keep_alive; + PRBool mcast_loopback; + PRBool no_delay; + PRBool broadcast; + PRSize max_segment; + PRSize recv_buffer_size; + PRSize send_buffer_size; + PRLinger linger; + PRMcastRequest add_member; + PRMcastRequest drop_member; + PRNetAddr mcast_if; + } + _N6 value; +} + +struct PRIOVec +{ + char *iov_base; + int iov_len; +} + +enum PRDescType +{ + PR_DESC_FILE = 1, + PR_DESC_SOCKET_TCP, + PR_DESC_SOCKET_UDP, + PR_DESC_LAYERED, + PR_DESC_PIPE, +} + +enum PRSeekWhence +{ + PR_SEEK_SET, + PR_SEEK_CUR, + PR_SEEK_END, +} + +version(NON_XPCOM_GLUE){ + int PR_GetDescType(PRFileDesc *file); +} + +alias PRStatus function(PRFileDesc *fd)PRCloseFN; +alias PRInt32 function(PRFileDesc *fd, void *buf, PRInt32 amount)PRReadFN; +alias PRInt32 function(PRFileDesc *fd, void *buf, PRInt32 amount)PRWriteFN; +alias PRInt32 function(PRFileDesc *fd)PRAvailableFN; +alias PRInt64 function(PRFileDesc *fd)PRAvailable64FN; +alias PRStatus function(PRFileDesc *fd)PRFsyncFN; +alias PROffset32 function(PRFileDesc *fd, PROffset32 offset, int how)PRSeekFN; +alias PROffset64 function(PRFileDesc *fd, PROffset64 offset, int how)PRSeek64FN; +alias PRStatus function(PRFileDesc *fd, PRFileInfo *info)PRFileInfoFN; +alias PRStatus function(PRFileDesc *fd, PRFileInfo64 *info)PRFileInfo64FN; +alias PRInt32 function(PRFileDesc *fd, PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout)PRWritevFN; +alias PRStatus function(PRFileDesc *fd, PRNetAddr *addr, PRIntervalTime timeout)PRConnectFN; +alias PRFileDesc * function(PRFileDesc *fd, PRNetAddr *addr, PRIntervalTime timeout)PRAcceptFN; +alias PRStatus function(PRFileDesc *fd, PRNetAddr *addr)PRBindFN; +alias PRStatus function(PRFileDesc *fd, PRIntn backlog)PRListenFN; +alias PRStatus function(PRFileDesc *fd, PRIntn how)PRShutdownFN; +alias PRInt32 function(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout)PRRecvFN; +alias PRInt32 function(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout)PRSendFN; +alias PRInt32 function(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRNetAddr *addr, PRIntervalTime timeout)PRRecvfromFN; +alias PRInt32 function(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRNetAddr *addr, PRIntervalTime timeout)PRSendtoFN; +alias PRInt16 function(PRFileDesc *fd, PRInt16 in_flags, PRInt16 *out_flags)PRPollFN; +alias PRInt32 function(PRFileDesc *sd, PRFileDesc **nd, PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime t)PRAcceptreadFN; +alias PRInt32 function(PRFileDesc *sd, PRFileDesc *fd, void *headers, PRInt32 hlen, int flags, PRIntervalTime t)PRTransmitfileFN; +alias PRStatus function(PRFileDesc *fd, PRNetAddr *addr)PRGetsocknameFN; +alias PRStatus function(PRFileDesc *fd, PRNetAddr *addr)PRGetpeernameFN; +alias PRStatus function(PRFileDesc *fd, PRSocketOptionData *data)PRGetsocketoptionFN; +alias PRStatus function(PRFileDesc *fd, PRSocketOptionData *data)PRSetsocketoptionFN; +alias PRInt32 function(PRFileDesc *networkSocket, PRSendFileData *sendData, int flags, PRIntervalTime timeout)PRSendfileFN; +alias PRStatus function(PRFileDesc *fd, PRInt16 out_flags)PRConnectcontinueFN; +alias PRIntn function(PRFileDesc *fd)PRReservedFN; + +struct PRIOMethods +{ + int file_type; + PRCloseFN close; + PRReadFN read; + PRWriteFN write; + PRAvailableFN available; + PRAvailable64FN available64; + PRFsyncFN fsync; + PRSeekFN seek; + PRSeek64FN seek64; + PRFileInfoFN fileInfo; + PRFileInfo64FN fileInfo64; + PRWritevFN writev; + PRConnectFN connect; + PRAcceptFN accept; + PRBindFN bind; + PRListenFN listen; + PRShutdownFN shutdown; + PRRecvFN recv; + PRSendFN send; + PRRecvfromFN recvfrom; + PRSendtoFN sendto; + PRPollFN poll; + PRAcceptreadFN acceptread; + PRTransmitfileFN transmitfile; + PRGetsocknameFN getsockname; + PRGetpeernameFN getpeername; + PRReservedFN reserved_fn_6; + PRReservedFN reserved_fn_5; + PRGetsocketoptionFN getsocketoption; + PRSetsocketoptionFN setsocketoption; + PRSendfileFN sendfile; + PRConnectcontinueFN connectcontinue; + PRReservedFN reserved_fn_3; + PRReservedFN reserved_fn_2; + PRReservedFN reserved_fn_1; + PRReservedFN reserved_fn_0; +} + +enum PRSpecialFD +{ + PR_StandardInput, + PR_StandardOutput, + PR_StandardError, +} + +version(NON_XPCOM_GLUE) +{ + PRFileDesc * PR_GetSpecialFD(int id); + PRDescIdentity PR_GetUniqueIdentity(char *layer_name); + char * PR_GetNameForIdentity(PRDescIdentity ident); + PRDescIdentity PR_GetLayersIdentity(PRFileDesc *fd); + PRFileDesc * PR_GetIdentitiesLayer(PRFileDesc *fd_stack, PRDescIdentity id); + PRIOMethods * PR_GetDefaultIOMethods(); + PRFileDesc * PR_CreateIOLayerStub(PRDescIdentity ident, PRIOMethods *methods); + PRFileDesc * PR_CreateIOLayer(PRFileDesc *fd); + PRStatus PR_PushIOLayer(PRFileDesc *fd_stack, PRDescIdentity id, PRFileDesc *layer); + PRFileDesc * PR_PopIOLayer(PRFileDesc *fd_stack, PRDescIdentity id); +} + +const PR_RDONLY = 0x01; +const PR_WRONLY = 0x02; +const PR_RDWR = 0x04; +const PR_CREATE_FILE = 0x08; +const PR_APPEND = 0x10; +const PR_TRUNCATE = 0x20; +const PR_SYNC = 0x40; +const PR_EXCL = 0x80; + +version(NON_XPCOM_GLUE) { + PRFileDesc * PR_Open(char *name, PRIntn flags, PRIntn mode); +} + +const PR_IRWXU = 00700; +const PR_IRUSR = 00400; +const PR_IWUSR = 00200; +const PR_IXUSR = 00100; +const PR_IRWXG = 00070; +const PR_IRGRP = 00040; +const PR_IWGRP = 00020; +const PR_IXGRP = 00010; +const PR_IRWXO = 00007; +const PR_IROTH = 00004; +const PR_IWOTH = 00002; +const PR_IXOTH = 00001; + +version(NON_XPCOM_GLUE) +{ + PRFileDesc * PR_OpenFile(char *name, PRIntn flags, PRIntn mode); + PRStatus PR_Close(PRFileDesc *fd); + PRInt32 PR_Read(PRFileDesc *fd, void *buf, PRInt32 amount); + PRInt32 PR_Write(PRFileDesc *fd, void *buf, PRInt32 amount); +} + +const PR_MAX_IOVECTOR_SIZE = 16; + +version(NON_XPCOM_GLUE) +{ + PRInt32 PR_Writev(PRFileDesc *fd, PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout); + PRStatus PR_Delete(char *name); +} + +enum PRFileType +{ + PR_FILE_FILE = 1, + PR_FILE_DIRECTORY, + PR_FILE_OTHER, +} + +struct PRFileInfo +{ + int type; + PROffset32 size; + PRTime creationTime; + PRTime modifyTime; +} + +struct PRFileInfo64 +{ + int type; + PROffset64 size; + PRTime creationTime; + PRTime modifyTime; +} + +version (NON_XPCOM_GLUE) +{ + PRStatus PR_GetFileInfo(char *fn, PRFileInfo *info); + PRStatus PR_GetFileInfo64(char *fn, PRFileInfo64 *info); + PRStatus PR_GetOpenFileInfo(PRFileDesc *fd, PRFileInfo *info); + PRStatus PR_GetOpenFileInfo64(PRFileDesc *fd, PRFileInfo64 *info); + PRStatus PR_Rename(char *from, char *to); +} + +enum PRAccessHow +{ + PR_ACCESS_EXISTS = 1, + PR_ACCESS_WRITE_OK, + PR_ACCESS_READ_OK, +} + +version(NON_XPCOM_GLUE) +{ + PRStatus PR_Access(char *name, int how); + PROffset32 PR_Seek(PRFileDesc *fd, PROffset32 offset, int whence); + PROffset64 PR_Seek64(PRFileDesc *fd, PROffset64 offset, int whence); + PRInt32 PR_Available(PRFileDesc *fd); + PRInt64 PR_Available64(PRFileDesc *fd); + PRStatus PR_Sync(PRFileDesc *fd); +} + +struct PRDirEntry +{ + char *name; +} + +alias void PRDir; + +version(NON_XPCOM_GLUE) { + PRDir * PR_OpenDir(char *name); +} + +enum PRDirFlags +{ + PR_SKIP_NONE, + PR_SKIP_DOT, + PR_SKIP_DOT_DOT, + PR_SKIP_BOTH, + PR_SKIP_HIDDEN, +} + +version(NON_XPCOM_GLUE) +{ + PRDirEntry * PR_ReadDir(PRDir *dir, int flags); + PRStatus PR_CloseDir(PRDir *dir); + PRStatus PR_MkDir(char *name, PRIntn mode); + PRStatus PR_MakeDir(char *name, PRIntn mode); + PRStatus PR_RmDir(char *name); + PRFileDesc * PR_NewUDPSocket(); + PRFileDesc * PR_NewTCPSocket(); + PRFileDesc * PR_OpenUDPSocket(PRIntn af); + PRFileDesc * PR_OpenTCPSocket(PRIntn af); + PRStatus PR_Connect(PRFileDesc *fd, PRNetAddr *addr, PRIntervalTime timeout); + PRStatus PR_ConnectContinue(PRFileDesc *fd, PRInt16 out_flags); + PRStatus PR_GetConnectStatus(PRPollDesc *pd); + PRFileDesc * PR_Accept(PRFileDesc *fd, PRNetAddr *addr, PRIntervalTime timeout); + PRStatus PR_Bind(PRFileDesc *fd, PRNetAddr *addr); + PRStatus PR_Listen(PRFileDesc *fd, PRIntn backlog); +} + +enum PRShutdownHow +{ + PR_SHUTDOWN_RCV, + PR_SHUTDOWN_SEND, + PR_SHUTDOWN_BOTH, +} + +version(NON_XPCOM_GLUE) { + PRStatus PR_Shutdown(PRFileDesc *fd, int how); +} + +const PR_MSG_PEEK = 0x2; + +version(NON_XPCOM_GLUE) +{ + PRInt32 PR_Recv(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout); + PRInt32 PR_Send(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout); + PRInt32 PR_RecvFrom(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRNetAddr *addr, PRIntervalTime timeout); + PRInt32 PR_SendTo(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRNetAddr *addr, PRIntervalTime timeout); + PRInt32 PR_TransmitFile(PRFileDesc *networkSocket, PRFileDesc *sourceFile, void *headers, PRInt32 hlen, int flags, PRIntervalTime timeout); +} + +struct PRSendFileData +{ + PRFileDesc *fd; + PRUint32 file_offset; + PRSize file_nbytes; + void *header; + PRInt32 hlen; + void *trailer; + PRInt32 tlen; +} + +version(NON_XPCOM_GLUE) +{ + PRInt32 PR_SendFile(PRFileDesc *networkSocket, PRSendFileData *sendData, int flags, PRIntervalTime timeout); + PRInt32 PR_AcceptRead(PRFileDesc *listenSock, PRFileDesc **acceptedSock, PRNetAddr **peerAddr, void *buf, PRInt32 amount, PRIntervalTime timeout); + PRStatus PR_NewTCPSocketPair(PRFileDesc **fds); + PRStatus PR_GetSockName(PRFileDesc *fd, PRNetAddr *addr); + PRStatus PR_GetPeerName(PRFileDesc *fd, PRNetAddr *addr); + PRStatus PR_GetSocketOption(PRFileDesc *fd, PRSocketOptionData *data); + PRStatus PR_SetSocketOption(PRFileDesc *fd, PRSocketOptionData *data); + PRStatus PR_SetFDInheritable(PRFileDesc *fd, PRBool inheritable); + PRFileDesc * PR_GetInheritedFD(char *name); +} + +enum PRFileMapProtect +{ + PR_PROT_READONLY, + PR_PROT_READWRITE, + PR_PROT_WRITECOPY, +} + +alias void PRFileMap; + +version(NON_XPCOM_GLUE) +{ + PRFileMap * PR_CreateFileMap(PRFileDesc *fd, PRInt64 size, int prot); + PRInt32 PR_GetMemMapAlignment(); + void * PR_MemMap(PRFileMap *fmap, PROffset64 offset, PRUint32 len); + PRStatus PR_MemUnmap(void *addr, PRUint32 len); + PRStatus PR_CloseFileMap(PRFileMap *fmap); + PRStatus PR_CreatePipe(PRFileDesc **readPipe, PRFileDesc **writePipe); +} + +struct PRPollDesc +{ + PRFileDesc *fd; + PRInt16 in_flags; + PRInt16 out_flags; +} + +const PR_POLL_READ = 0x1; +const PR_POLL_WRITE = 0x2; +const PR_POLL_EXCEPT = 0x4; +const PR_POLL_ERR = 0x8; +const PR_POLL_NVAL = 0x10; +const PR_POLL_HUP = 0x20; + +version(NON_XPCOM_GLUE) +{ + PRInt32 PR_Poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout); + PRFileDesc * PR_NewPollableEvent(); + PRStatus PR_DestroyPollableEvent(PRFileDesc *event); + PRStatus PR_SetPollableEvent(PRFileDesc *event); + PRStatus PR_WaitForPollableEvent(PRFileDesc *event); +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/prlink.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,134 @@ +module dwt.internal.mozilla.prlink; +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape Portable Runtime (NSPR). + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +import dwt.internal.mozilla.Common; + +struct PRStaticLinkTable +{ + char *name; + void function()fp; +} + +extern (System): + +PRStatus PR_SetLibraryPath(char *path); + +char * PR_GetLibraryPath(); +char * PR_GetLibraryName(char *dir, char *lib); +void PR_FreeLibraryName(char *mem); + +alias void PRLibrary; + +PRLibrary * PR_LoadLibrary(char *name); + +enum PRLibSpecType +{ + PR_LibSpec_Pathname, + PR_LibSpec_MacNamedFragment, + PR_LibSpec_MacIndexedFragment, +} + +alias void FSSpec; + +struct _N3 +{ + FSSpec *fsspec; + char *name; +} + +struct _N4 +{ + FSSpec *fsspec; + PRUint32 index; +} + +union _N2 +{ + char *pathname; + struct _N3 + { + FSSpec *fsspec; + char *name; + } + _N3 mac_named_fragment; + struct _N4 + { + FSSpec *fsspec; + PRUint32 index; + } + _N4 mac_indexed_fragment; +} + +struct PRLibSpec +{ + int type; + union _N2 + { + char *pathname; + struct _N3 + { + FSSpec *fsspec; + char *name; + } + _N3 mac_named_fragment; + struct _N4 + { + FSSpec *fsspec; + PRUint32 index; + } + _N4 mac_indexed_fragment; + } + _N2 value; +} + +const PR_LD_LAZY = 0x1; +const PR_LD_NOW = 0x2; +const PR_LD_GLOBAL = 0x4; +const PR_LD_LOCAL = 0x8; + +PRLibrary * PR_LoadLibraryWithFlags(PRLibSpec libSpec, PRIntn flags); +PRStatus PR_UnloadLibrary(PRLibrary *lib); +void * PR_FindSymbol(PRLibrary *lib, char *name); + +alias void function()PRFuncPtr; + +PRFuncPtr PR_FindFunctionSymbol(PRLibrary *lib, char *name); +void * PR_FindSymbolAndLibrary(char *name, PRLibrary **lib); +PRFuncPtr PR_FindFunctionSymbolAndLibrary(char *name, PRLibrary **lib); +PRLibrary * PR_LoadStaticLibrary(char *name, PRStaticLinkTable *table); +char * PR_GetLibraryFilePathname(char *name, PRFuncPtr addr);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/mozilla/prtime.d Fri Jan 16 12:49:08 2009 +0100 @@ -0,0 +1,87 @@ +module dwt.internal.mozilla.prtime; + +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape Portable Runtime (NSPR). + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +import dwt.internal.mozilla.Common; + +const PR_MSEC_PER_SEC = 1000U; +const PR_USEC_PER_SEC = 1000000U; +const PR_NSEC_PER_SEC = 1000000000U; +const PR_USEC_PER_MSEC = 1000U; +const PR_NSEC_PER_MSEC = 1000000U; + +extern (System): + +alias PRInt64 PRTime; + +struct PRTimeParameters +{ + PRInt32 tp_gmt_offset; + PRInt32 tp_dst_offset; +} + +struct PRExplodedTime +{ + PRInt32 tm_usec; + PRInt32 tm_sec; + PRInt32 tm_min; + PRInt32 tm_hour; + PRInt32 tm_mday; + PRInt32 tm_month; + PRInt16 tm_year; + PRInt8 tm_wday; + PRInt16 tm_yday; + PRTimeParameters tm_params; +} + +alias PRTimeParameters function(PRExplodedTime *gmt)PRTimeParamFn; + +version(NON_XPCOM_GLUE) +{ + PRTime PR_Now(); + void PR_ExplodeTime(PRTime usecs, PRTimeParamFn params, PRExplodedTime *exploded); + PRTime PR_ImplodeTime(PRExplodedTime *exploded); + void PR_NormalizeTime(PRExplodedTime *exploded, PRTimeParamFn params); + + PRTimeParameters PR_LocalTimeParameters(PRExplodedTime *gmt); + PRTimeParameters PR_GMTParameters(PRExplodedTime *gmt); + PRTimeParameters PR_USPacificTimeParameters(PRExplodedTime *gmt); + + PRStatus PR_ParseTimeString(char *string, PRBool default_to_gmt, PRTime *result); + PRUint32 PR_FormatTime(char *buf, int buflen, char *fmt, PRExplodedTime *tm); + PRUint32 PR_FormatTimeUSEnglish(char *buf, PRUint32 bufSize, char *format, PRExplodedTime *tm); +} \ No newline at end of file