diff dwt/browser/Download.d @ 125:5583f8eeee6c

Synced mozilla with dwt-linux
author Jacob Carlborg <doob@me.com>
date Fri, 16 Jan 2009 12:49:08 +0100
parents d8635bb48c7c
children
line wrap: on
line diff
--- 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;
 }
 }