diff dwt/browser/HelperAppLauncherDialogFactory.d @ 352:a3c5f744d03f

Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
author John Reimer <terminal.node@gmail.com>
date Tue, 04 Nov 2008 21:20:45 -0800
parents 9a4d7706df52
children
line wrap: on
line diff
--- a/dwt/browser/HelperAppLauncherDialogFactory.d	Mon Nov 03 23:35:30 2008 +0100
+++ b/dwt/browser/HelperAppLauncherDialogFactory.d	Tue Nov 04 21:20:45 2008 -0800
@@ -14,23 +14,22 @@
 
 import dwt.dwthelper.utils;
 
-//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;
 
 import dwt.browser.HelperAppLauncherDialog;
+import dwt.browser.HelperAppLauncherDialog_1_9;
 
 class HelperAppLauncherDialogFactory : nsIFactory {
-    //XPCOMObject supports;
-    //XPCOMObject factory;
     int refCount = 0;
+    bool isPre_1_9 = true;
+
 
 this () {
-//    createCOMInterfaces ();
 }
 
 extern(System)
@@ -42,8 +41,6 @@
 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 (*riid == nsISupports.IID) {
         *ppvObject = cast(void*)cast(nsISupports)this;
@@ -63,7 +60,7 @@
 extern(System)
 nsrefcnt Release () {
     refCount--;
-    //if (refCount is 0) disposeCOMInterfaces ();
+    if (refCount is 0) return 0;
     return refCount;
 }
 
@@ -71,15 +68,26 @@
 
 extern(System)
 nsresult CreateInstance (nsISupports aOuter, nsID* iid, void** result) { 
-     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;
+    if (isPre_1_9) {
+        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 rv;
 }
 
 extern(System)