annotate dwt/browser/DownloadFactory.d @ 345:5abc6f7f7a95

Fixups
author John Reimer <terminal.node@gmail.com>
date Tue, 28 Oct 2008 22:07:01 -0700
parents 942da4b6558a
children 9a4d7706df52
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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, 2007 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
93409d9838c5 Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
10 *******************************************************************************/
93409d9838c5 Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
11 module dwt.browser.DownloadFactory;
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 import dwt.dwthelper.utils;
93409d9838c5 Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
14
341
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
15 //import dwt.internal.C;
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
16 import XPCOM = dwt.internal.mozilla.XPCOM;
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
17 import dwt.internal.mozilla.Common;
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
18 //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
19 import dwt.internal.mozilla.nsID;
93409d9838c5 Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
20 import dwt.internal.mozilla.nsIFactory;
93409d9838c5 Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
21 import dwt.internal.mozilla.nsISupports;
93409d9838c5 Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
22
345
John Reimer <terminal.node@gmail.com>
parents: 341
diff changeset
23 import dwt.browser.Download;
John Reimer <terminal.node@gmail.com>
parents: 341
diff changeset
24
341
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
25 class DownloadFactory : nsIFactory {
286
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
26 int refCount = 0;
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
27
341
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
28 this () {}
286
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
29
341
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
30 nsrefcnt AddRef () {
286
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
31 refCount++;
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
32 return refCount;
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
33 }
278
93409d9838c5 Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
34
341
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
35 nsresult QueryInterface (nsID* riid, void** ppvObject) {
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
36 if (riid is null || ppvObject is null) return XPCOM.NS_ERROR_NO_INTERFACE;
286
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
37
341
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
38 if (*riid == nsISupports.IID) {
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
39 *ppvObject = cast(void*)cast(nsISupports)this;
286
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
40 AddRef ();
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
41 return XPCOM.NS_OK;
278
93409d9838c5 Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
42 }
341
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
43 if (*riid == nsIFactory.IID) {
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
44 *ppvObject = cast(void*)cast(nsIFactory)this;
286
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
45 AddRef ();
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
46 return XPCOM.NS_OK;
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
47 }
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
48
341
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
49 *ppvObject = null;
286
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
50 return XPCOM.NS_ERROR_NO_INTERFACE;
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
51 }
278
93409d9838c5 Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
52
341
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
53 nsrefcnt Release () {
286
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
54 refCount--;
341
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
55 //if (refCount is 0) disposeCOMInterfaces ();
286
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
56 return refCount;
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
57 }
278
93409d9838c5 Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
58
93409d9838c5 Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
59 /* nsIFactory */
93409d9838c5 Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
60
341
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
61 nsresult CreateInstance (nsISupports aOuter, nsID* iid, void** result) {
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
62 if (result is null)
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
63 return XPCOM.NS_ERROR_INVALID_ARG;
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
64 auto download = new Download();
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
65 nsresult rv = download.QueryInterface( iid, result );
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
66 if (XPCOM.NS_FAILED(rv)) {
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
67 *result = null;
345
John Reimer <terminal.node@gmail.com>
parents: 341
diff changeset
68 delete download;
341
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
69 }
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
70 return rv;
286
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
71 }
278
93409d9838c5 Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
72
341
942da4b6558a Ongoing fixup for compile
John Reimer <terminal.node@gmail.com>
parents: 286
diff changeset
73 nsresult LockFactory (int lock) {
286
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
74 return XPCOM.NS_OK;
278
93409d9838c5 Commit more browser/xpcom updates, including still uncoverted source.
John Reimer<terminal.node@gmail.com>
parents:
diff changeset
75 }
286
44258e0b6687 More fixes for xpcom
John Reimer<terminal.node@gmail.com>
parents: 278
diff changeset
76 }