Mercurial > projects > dwt-linux
comparison dwt/internal/mozilla/XPCOM.d @ 298:eec6ddb07873
More xpcom/mozilla port
author | John Reimer<terminal.node@gmail.com> |
---|---|
date | Sun, 10 Aug 2008 22:25:43 -0700 |
parents | |
children | 3f4a5c7d138f |
comparison
equal
deleted
inserted
replaced
297:2f204a4aebc6 | 298:eec6ddb07873 |
---|---|
1 /* ***** BEGIN LICENSE BLOCK ***** | |
2 * Version: MPL 1.1 | |
3 * | |
4 * The contents of this file are subject to the Mozilla Public License Version | |
5 * 1.1 (the "License"); you may not use this file except in compliance with | |
6 * the License. You may obtain a copy of the License at | |
7 * http://www.mozilla.org/MPL/ | |
8 * | |
9 * Software distributed under the License is distributed on an "AS IS" basis, | |
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |
11 * for the specific language governing rights and limitations under the | |
12 * License. | |
13 * | |
14 * The Original Code is Mozilla Communicator client code, released March 31, 1998. | |
15 * | |
16 * The Initial Developer of the Original Code is | |
17 * Netscape Communications Corporation. | |
18 * Portions created by Netscape are Copyright (C) 1998-1999 | |
19 * Netscape Communications Corporation. All Rights Reserved. | |
20 * | |
21 * Contributor(s): | |
22 * | |
23 * IBM | |
24 * - Binding to permit interfacing between Mozilla and DWT | |
25 * - Copyright (C) 2003, 2006 IBM Corp. All Rights Reserved. | |
26 * Port to the D programming language: | |
27 * John Reimer <terminal.node@gmail.com> | |
28 *******************************************************************************/ | |
29 module dwt.internal.mozilla.XPCOM; | |
30 | |
31 import dwt.dwthelper.utils; | |
32 | |
33 //import dwt.internal.C; | |
34 | |
35 public class XPCOM { | |
36 public static final String MOZILLA_FIVE_HOME = "MOZILLA_FIVE_HOME"; //$NON-NLS-1$ | |
37 public static final String MOZILLA_PLUGIN_PATH = "MOZ_PLUGIN_PATH"; //$NON-NLS-1$ | |
38 public static final String CONTENT_MAYBETEXT = "application/x-vnd.mozilla.maybe-text"; //$NON-NLS-1$ | |
39 public static final String CONTENT_MULTIPART = "multipart/x-mixed-replace"; //$NON-NLS-1$ | |
40 public static final String DOMEVENT_FOCUS = "focus"; //$NON-NLS-1$ | |
41 public static final String DOMEVENT_UNLOAD = "unload"; //$NON-NLS-1$ | |
42 public static final String DOMEVENT_MOUSEDOWN = "mousedown"; //$NON-NLS-1$ | |
43 public static final String DOMEVENT_MOUSEUP = "mouseup"; //$NON-NLS-1$ | |
44 public static final String DOMEVENT_MOUSEMOVE = "mousemove"; //$NON-NLS-1$ | |
45 public static final String DOMEVENT_MOUSEDRAG = "draggesture"; //$NON-NLS-1$ | |
46 public static final String DOMEVENT_MOUSEWHEEL = "DOMMouseScroll"; //$NON-NLS-1$ | |
47 public static final String DOMEVENT_MOUSEOVER = "mouseover"; //$NON-NLS-1$ | |
48 public static final String DOMEVENT_MOUSEOUT = "mouseout"; //$NON-NLS-1$ | |
49 public static final String DOMEVENT_KEYUP = "keyup"; //$NON-NLS-1$ | |
50 public static final String DOMEVENT_KEYDOWN = "keydown"; //$NON-NLS-1$ | |
51 public static final String DOMEVENT_KEYPRESS = "keypress"; //$NON-NLS-1$ | |
52 | |
53 /* CID constants */ | |
54 public static final nsID NS_APPSHELL_CID = new nsID("2d96b3df-c051-11d1-a827-0040959a28c9"); //$NON-NLS-1$ | |
55 public static final nsID NS_CATEGORYMANAGER_CID = new nsID("16d222a6-1dd2-11b2-b693-f38b02c021b2"); //$NON-NLS-1$ | |
56 public static final nsID NS_DOWNLOAD_CID = new nsID("e3fa9D0a-1dd1-11b2-bdef-8c720b597445"); //$NON-NLS-1$ | |
57 public static final nsID NS_FILEPICKER_CID = new nsID("54ae32f8-1dd2-11b2-a209-df7c505370f8"); //$NON-NLS-1$ | |
58 public static final nsID NS_HELPERAPPLAUNCHERDIALOG_CID = new nsID("f68578eb-6ec2-4169-ae19-8c6243f0abe1"); //$NON-NLS-1$ | |
59 public static final nsID NS_INPUTSTREAMCHANNEL_CID = new nsID("6ddb050c-0d04-11d4-986e-00c04fa0cf4a"); //$NON-NLS-1$ | |
60 public static final nsID NS_IOSERVICE_CID = new nsID("9ac9e770-18bc-11d3-9337-00104ba0fd40"); //$NON-NLS-1$ | |
61 public static final nsID NS_LOADGROUP_CID = new nsID("e1c61582-2a84-11d3-8cce-0060b0fc14a3"); //$NON-NLS-1$ | |
62 public static final nsID NS_PROMPTSERVICE_CID = new nsID("a2112d6a-0e28-421f-b46a-25c0b308cbd0"); //$NON-NLS-1$ | |
63 | |
64 public static final String NS_CONTEXTSTACK_CONTRACTID = "@mozilla.org/js/xpc/ContextStack;1"; //$NON-NLS-1$ | |
65 public static final String NS_COOKIEMANAGER_CONTRACTID = "@mozilla.org/cookiemanager;1"; //$NON-NLS-1$ | |
66 public static final String NS_DIRECTORYSERVICE_CONTRACTID = "@mozilla.org/file/directory_service;1"; //$NON-NLS-1$ | |
67 public static final String NS_DOMSERIALIZER_CONTRACTID = "@mozilla.org/xmlextras/xmlserializer;1"; //$NON-NLS-1$ | |
68 public static final String NS_DOWNLOAD_CONTRACTID = "@mozilla.org/download;1"; //$NON-NLS-1$ | |
69 public static final String NS_FILEPICKER_CONTRACTID = "@mozilla.org/filepicker;1"; //$NON-NLS-1$ | |
70 public static final String NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID = "@mozilla.org/helperapplauncherdialog;1"; //$NON-NLS-1$ | |
71 public static final String NS_MEMORY_CONTRACTID = "@mozilla.org/xpcom/memory-service;1"; //$NON-NLS-1$ | |
72 public static final String NS_OBSERVER_CONTRACTID = "@mozilla.org/observer-service;1"; //$NON-NLS-1$ | |
73 public static final String NS_PREFLOCALIZEDSTRING_CONTRACTID = "@mozilla.org/pref-localizedstring;1"; //$NON-NLS-1$ | |
74 public static final String NS_PREFSERVICE_CONTRACTID = "@mozilla.org/preferences-service;1"; //$NON-NLS-1$ | |
75 public static final String NS_PROMPTSERVICE_CONTRACTID = "@mozilla.org/embedcomp/prompt-service;1"; //$NON-NLS-1$ | |
76 public static final String NS_TRANSFER_CONTRACTID = "@mozilla.org/transfer;1"; //$NON-NLS-1$ | |
77 public static final String NS_WEBNAVIGATIONINFO_CONTRACTID = "@mozilla.org/webnavigation-info;1"; //$NON-NLS-1$ | |
78 public static final String NS_WINDOWWATCHER_CONTRACTID = "@mozilla.org/embedcomp/window-watcher;1"; //$NON-NLS-1$ | |
79 | |
80 /* directory service constants */ | |
81 public static final String NS_APP_APPLICATION_REGISTRY_DIR = "AppRegD"; //$NON-NLS-1$ | |
82 public static final String NS_APP_CACHE_PARENT_DIR = "cachePDir"; //$NON-NLS-1$ | |
83 public static final String NS_APP_HISTORY_50_FILE = "UHist"; //$NON-NLS-1$ | |
84 public static final String NS_APP_LOCALSTORE_50_FILE = "LclSt"; //$NON-NLS-1$ | |
85 public static final String NS_APP_PLUGINS_DIR_LIST = "APluginsDL"; //$NON-NLS-1$ | |
86 public static final String NS_APP_PREF_DEFAULTS_50_DIR = "PrfDef"; //$NON-NLS-1$ | |
87 public static final String NS_APP_PREFS_50_DIR = "PrefD"; //$NON-NLS-1$ | |
88 public static final String NS_APP_PREFS_50_FILE = "PrefF"; //$NON-NLS-1$ | |
89 public static final String NS_APP_USER_CHROME_DIR = "UChrm"; //$NON-NLS-1$ | |
90 public static final String NS_APP_USER_MIMETYPES_50_FILE = "UMimTyp"; //$NON-NLS-1$ | |
91 public static final String NS_APP_USER_PROFILE_50_DIR = "ProfD"; //$NON-NLS-1$ | |
92 public static final String NS_GRE_COMPONENT_DIR = "GreComsD"; //$NON-NLS-1$ | |
93 public static final String NS_GRE_DIR = "GreD"; //$NON-NLS-1$ | |
94 public static final String NS_OS_CURRENT_PROCESS_DIR = "CurProcD"; //$NON-NLS-1$ | |
95 public static final String NS_OS_HOME_DIR = "Home"; //$NON-NLS-1$ | |
96 public static final String NS_OS_TEMP_DIR = "TmpD"; //$NON-NLS-1$ | |
97 public static final String NS_XPCOM_COMPONENT_DIR = "ComsD"; //$NON-NLS-1$ | |
98 public static final String NS_XPCOM_CURRENT_PROCESS_DIR = "XCurProcD"; //$NON-NLS-1$ | |
99 public static final String NS_XPCOM_INIT_CURRENT_PROCESS_DIR = "MozBinD"; //$NON-NLS-1$ | |
100 | |
101 /* XPCOM constants */ | |
102 public static final int NS_OK = 0; | |
103 public static final int NS_COMFALSE = 1; | |
104 public static final int NS_BINDING_ABORTED = 0x804B0002; | |
105 public static final int NS_ERROR_BASE = 0xc1f30000; | |
106 public static final int NS_ERROR_NOT_INITIALIZED = NS_ERROR_BASE + 1; | |
107 public static final int NS_ERROR_ALREADY_INITIALIZED = NS_ERROR_BASE + 2; | |
108 public static final int NS_ERROR_NOT_IMPLEMENTED = 0x80004001; | |
109 public static final int NS_NOINTERFACE = 0x80004002; | |
110 public static final int NS_ERROR_NO_INTERFACE = NS_NOINTERFACE; | |
111 public static final int NS_ERROR_INVALID_POINTER = 0x80004003; | |
112 public static final int NS_ERROR_NULL_POINTER = NS_ERROR_INVALID_POINTER; | |
113 public static final int NS_ERROR_ABORT = 0x80004004; | |
114 public static final int NS_ERROR_FAILURE = 0x80004005; | |
115 public static final int NS_ERROR_UNEXPECTED = 0x8000ffff; | |
116 public static final int NS_ERROR_OUT_OF_MEMORY = 0x8007000e; | |
117 public static final int NS_ERROR_ILLEGAL_VALUE = 0x80070057; | |
118 public static final int NS_ERROR_INVALID_ARG = NS_ERROR_ILLEGAL_VALUE; | |
119 public static final int NS_ERROR_NO_AGGREGATION = 0x80040110; | |
120 public static final int NS_ERROR_NOT_AVAILABLE = 0x80040111; | |
121 public static final int NS_ERROR_FACTORY_NOT_REGISTERED = 0x80040154; | |
122 public static final int NS_ERROR_FACTORY_REGISTER_AGAIN = 0x80040155; | |
123 public static final int NS_ERROR_FACTORY_NOT_LOADED = 0x800401f8; | |
124 public static final int NS_ERROR_FACTORY_NO_SIGNATURE_SUPPORT = NS_ERROR_BASE + 0x101; | |
125 public static final int NS_ERROR_FACTORY_EXISTS = NS_ERROR_BASE + 0x100; | |
126 public static final int NS_ERROR_HTMLPARSER_UNRESOLVEDDTD = 0x804e03f3; | |
127 public static final int NS_ERROR_FILE_NOT_FOUND = 0x80520012; | |
128 public static final int NS_ERROR_FILE_UNRECOGNIZED_PATH = 0x80520001; | |
129 | |
130 public static final nsresult NS_FAILED( nsresult result ) { | |
131 return result & 0x80000000; | |
132 } | |
133 | |
134 public static final nsresult NS_SUCCEEDED( nsresult result ) { | |
135 return !(result & 0x80000000); | |
136 } | |
137 | |
138 public static final PRUint32 strlen_PRUnichar ( PRUnichar* str ) | |
139 { | |
140 PRUint32 len = 0; | |
141 if (str !is null) | |
142 while (*(str++) != 0) len++; | |
143 ret len; | |
144 } | |
145 | |
146 //public static final native void memmove(nsID dest, int /*long*/ src, int nbytes); | |
147 //public static final native void memmove(int /*long*/ dest, nsID src, int nbytes); | |
148 public static final native int NS_GetComponentManager(int /*long*/[] result); | |
149 public static final native int NS_GetServiceManager(int /*long*/[] result); | |
150 public static final native int NS_InitXPCOM2(int /*long*/ result, int /*long*/ binDirectory, int /*long*/ appFileLocationProvider); | |
151 public static final native int NS_NewLocalFile(int /*long*/ path, int followLinks, int /*long*/[] result); | |
152 //public static final native int strlen_PRUnichar(int /*long*/ s); | |
153 //public static final native int /*long*/ nsEmbedCString_new(); | |
154 //public static final native int /*long*/ nsEmbedCString_new(byte[] aString, int length); | |
155 //public static final native int /*long*/ nsEmbedCString_new(int aString, int length); | |
156 //public static final native void nsEmbedCString_delete(int /*long*/ ptr); | |
157 //public static final native int nsEmbedCString_Length(int /*long*/ ptr); | |
158 //public static final native int /*long*/ nsEmbedCString_get(int /*long*/ ptr); | |
159 //public static final native void nsID_delete(int /*long*/ ptr); | |
160 //public static final native int /*long*/ nsID_new(); | |
161 //public static final native int nsID_Equals(int /*long*/ ptr, int /*long*/ other); | |
162 //public static final native int /*long*/ nsEmbedString_new(); | |
163 //public static final native int /*long*/ nsEmbedString_new(char[] aString); | |
164 //public static final native void nsEmbedString_delete(int /*long*/ ptr); | |
165 //public static final native int nsEmbedString_Length(int /*long*/ ptr); | |
166 //public static final native int /*long*/ nsEmbedString_get(int /*long*/ ptr); | |
167 public static final native int XPCOMGlueStartup(byte[] place); | |
168 public static final native int XPCOMGlueShutdown(); | |
169 } |