Mercurial > projects > dwt-linux
comparison 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 |
comparison
equal
deleted
inserted
replaced
351:f1bb3949939b | 352:a3c5f744d03f |
---|---|
12 *******************************************************************************/ | 12 *******************************************************************************/ |
13 module dwt.browser.HelperAppLauncherDialogFactory; | 13 module dwt.browser.HelperAppLauncherDialogFactory; |
14 | 14 |
15 import dwt.dwthelper.utils; | 15 import dwt.dwthelper.utils; |
16 | 16 |
17 //import dwt.internal.C; | |
18 import XPCOM = dwt.internal.mozilla.XPCOM; | 17 import XPCOM = dwt.internal.mozilla.XPCOM; |
19 //import dwt.internal.mozilla.XPCOMObject; | 18 |
20 import dwt.internal.mozilla.Common; | 19 import dwt.internal.mozilla.Common; |
21 import dwt.internal.mozilla.nsID; | 20 import dwt.internal.mozilla.nsID; |
22 import dwt.internal.mozilla.nsIFactory; | 21 import dwt.internal.mozilla.nsIFactory; |
23 import dwt.internal.mozilla.nsISupports; | 22 import dwt.internal.mozilla.nsISupports; |
24 | 23 |
25 import dwt.browser.HelperAppLauncherDialog; | 24 import dwt.browser.HelperAppLauncherDialog; |
25 import dwt.browser.HelperAppLauncherDialog_1_9; | |
26 | 26 |
27 class HelperAppLauncherDialogFactory : nsIFactory { | 27 class HelperAppLauncherDialogFactory : nsIFactory { |
28 //XPCOMObject supports; | |
29 //XPCOMObject factory; | |
30 int refCount = 0; | 28 int refCount = 0; |
29 bool isPre_1_9 = true; | |
30 | |
31 | 31 |
32 this () { | 32 this () { |
33 // createCOMInterfaces (); | |
34 } | 33 } |
35 | 34 |
36 extern(System) | 35 extern(System) |
37 nsrefcnt AddRef () { | 36 nsrefcnt AddRef () { |
38 refCount++; | 37 refCount++; |
40 } | 39 } |
41 | 40 |
42 extern(System) | 41 extern(System) |
43 nsresult QueryInterface (nsID* riid, void** ppvObject) { | 42 nsresult QueryInterface (nsID* riid, void** ppvObject) { |
44 if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; | 43 if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; |
45 //nsID guid = new nsID (); | |
46 //XPCOM.memmove (guid, riid, nsID.sizeof); | |
47 | 44 |
48 if (*riid == nsISupports.IID) { | 45 if (*riid == nsISupports.IID) { |
49 *ppvObject = cast(void*)cast(nsISupports)this; | 46 *ppvObject = cast(void*)cast(nsISupports)this; |
50 AddRef (); | 47 AddRef (); |
51 return XPCOM.NS_OK; | 48 return XPCOM.NS_OK; |
61 } | 58 } |
62 | 59 |
63 extern(System) | 60 extern(System) |
64 nsrefcnt Release () { | 61 nsrefcnt Release () { |
65 refCount--; | 62 refCount--; |
66 //if (refCount is 0) disposeCOMInterfaces (); | 63 if (refCount is 0) return 0; |
67 return refCount; | 64 return refCount; |
68 } | 65 } |
69 | 66 |
70 /* nsIFactory */ | 67 /* nsIFactory */ |
71 | 68 |
72 extern(System) | 69 extern(System) |
73 nsresult CreateInstance (nsISupports aOuter, nsID* iid, void** result) { | 70 nsresult CreateInstance (nsISupports aOuter, nsID* iid, void** result) { |
74 if (result is null) | 71 if (isPre_1_9) { |
75 return XPCOM.NS_ERROR_INVALID_ARG; | 72 if (result is null) |
76 auto helperAppLauncherDialog = new HelperAppLauncherDialog; | 73 return XPCOM.NS_ERROR_INVALID_ARG; |
77 nsresult rv = helperAppLauncherDialog.QueryInterface( iid, result ); | 74 auto helperAppLauncherDialog = new HelperAppLauncherDialog; |
78 if (XPCOM.NS_FAILED(rv)) { | 75 nsresult rv = helperAppLauncherDialog.QueryInterface( iid, result ); |
79 *result = null; | 76 if (XPCOM.NS_FAILED(rv)) { |
80 delete helperAppLauncherDialog; | 77 *result = null; |
78 delete helperAppLauncherDialog; | |
79 } else { | |
80 if (result is null) | |
81 return XPCOM.NS_ERROR_INVALID_ARG; | |
82 auto helperAppLauncherDialog19 = new HelperAppLauncherDialog_1_9; | |
83 rv = helperAppLauncherDialog19.QueryInterface( iid, result ); | |
84 if (XPCOM.NS_FAILED(rv)) { | |
85 *result = null; | |
86 delete helperAppLauncherDialog19; | |
87 } | |
88 return rv; | |
89 } | |
81 } | 90 } |
82 return rv; | |
83 } | 91 } |
84 | 92 |
85 extern(System) | 93 extern(System) |
86 nsresult LockFactory (PRBool lock) { | 94 nsresult LockFactory (PRBool lock) { |
87 return XPCOM.NS_OK; | 95 return XPCOM.NS_OK; |