Mercurial > projects > dwt-linux
annotate dwt/browser/PromptService2Factory.d @ 341:942da4b6558a
Ongoing fixup for compile
author | John Reimer <terminal.node@gmail.com> |
---|---|
date | Sun, 26 Oct 2008 21:19:51 -0700 |
parents | bfe1c57259e3 |
children | 9a4d7706df52 |
rev | line source |
---|---|
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
1 /******************************************************************************* |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2003, 2008 IBM Corporation and others. |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
3 * All rights reserved. This program and the accompanying materials |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
4 * are made available under the terms of the Eclipse Public License v1.0 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
5 * which accompanies this distribution, and is available at |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
6 * http://www.eclipse.org/legal/epl-v10.html |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
7 * |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
8 * Contributors: |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
9 * IBM Corporation - initial API and implementation |
302
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
10 * Port to the D programming language: |
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
11 * John Reimer <terminal.node@gmail.com> |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
12 *******************************************************************************/ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
13 module dwt.browser.PromptService2Factory; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
14 |
302
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
15 //import dwt.dwthelper.utils; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
302
diff
changeset
|
16 import dwt.internal.mozilla.Common; |
302
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
17 //import dwt.internal.C; |
341
942da4b6558a
Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents:
302
diff
changeset
|
18 import XPCOM = dwt.internal.mozilla.XPCOM; |
302
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
19 //import dwt.internal.mozilla.XPCOMObject; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
20 import dwt.internal.mozilla.nsID; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
21 import dwt.internal.mozilla.nsIFactory; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
22 import dwt.internal.mozilla.nsISupports; |
302
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
23 import dwt.browser.PromptService2; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
24 |
302
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
25 class PromptService2Factory : nsIFactory { |
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
26 // XPCOMObject supports; |
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
27 // XPCOMObject factory; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
28 int refCount = 0; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
29 |
302
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
30 this () { |
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
31 // createCOMInterfaces (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
32 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
33 |
302
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
34 nsrefcnt AddRef () { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
35 refCount++; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
36 return refCount; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
37 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
38 |
302
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
39 nsresult QueryInterface (nsID* riid, void** ppvObject) { |
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
40 if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE; |
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
41 //nsID guid = new nsID (); |
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
42 //XPCOM.memmove (guid, riid, nsID.sizeof); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
43 |
302
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
44 if (*riid == nsISupports.IID) { |
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
45 *ppvObject = cast(void*)cast(nsISupports)this; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
46 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
47 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
48 } |
302
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
49 if (*riid == nsIFactory.IID) { |
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
50 *ppvObject = cast(void*)cast(nsIFactory)this; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
51 AddRef (); |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
52 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
53 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
54 |
302
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
55 *ppvObject = null; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
56 return XPCOM.NS_ERROR_NO_INTERFACE; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
57 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
58 |
302
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
59 nsrefcnt Release () { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
60 refCount--; |
302
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
61 //if (refCount is null) disposeCOMInterfaces (); |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
62 return refCount; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
63 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
64 |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
65 /* nsIFactory */ |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
66 |
302
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
67 nsresult CreateInstance (nsISupports aOuter, nsIID* iid, void** result) { |
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
68 if (result is null) |
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
69 return XPCOM.NS_ERROR_INVALID_ARG; |
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
70 auto promptService = new PromptService2; |
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
71 nsresult rv = promptService.QueryInterface( iid, result ); |
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
72 if (XPCOM.NS_FAILED(rv)) { |
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
73 *result = null; |
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
74 delete promptService; |
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
75 } |
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
76 return rv; |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
77 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
78 |
302
bfe1c57259e3
More browser code ported
John Reimer<terminal.node@gmail.com>
parents:
278
diff
changeset
|
79 nsresult LockFactory (PRBool lock) { |
278
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
80 return XPCOM.NS_OK; |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
81 } |
93409d9838c5
Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff
changeset
|
82 } |