1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
---|
2 | /* ***** BEGIN LICENSE BLOCK *****
|
---|
3 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
---|
4 | *
|
---|
5 | * The contents of this file are subject to the Mozilla Public License Version
|
---|
6 | * 1.1 (the "License"); you may not use this file except in compliance with
|
---|
7 | * the License. You may obtain a copy of the License at
|
---|
8 | * http://www.mozilla.org/MPL/
|
---|
9 | *
|
---|
10 | * Software distributed under the License is distributed on an "AS IS" basis,
|
---|
11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
---|
12 | * for the specific language governing rights and limitations under the
|
---|
13 | * License.
|
---|
14 | *
|
---|
15 | * The Original Code is mozilla.org code.
|
---|
16 | *
|
---|
17 | * The Initial Developer of the Original Code is
|
---|
18 | * Netscape Communications Corporation.
|
---|
19 | * Portions created by the Initial Developer are Copyright (C) 1998
|
---|
20 | * the Initial Developer. All Rights Reserved.
|
---|
21 | *
|
---|
22 | * Contributor(s):
|
---|
23 | *
|
---|
24 | * Alternatively, the contents of this file may be used under the terms of
|
---|
25 | * either of the GNU General Public License Version 2 or later (the "GPL"),
|
---|
26 | * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
---|
27 | * in which case the provisions of the GPL or the LGPL are applicable instead
|
---|
28 | * of those above. If you wish to allow use of your version of this file only
|
---|
29 | * under the terms of either the GPL or the LGPL, and not to allow others to
|
---|
30 | * use your version of this file under the terms of the MPL, indicate your
|
---|
31 | * decision by deleting the provisions above and replace them with the notice
|
---|
32 | * and other provisions required by the GPL or the LGPL. If you do not delete
|
---|
33 | * the provisions above, a recipient may use your version of this file under
|
---|
34 | * the terms of any one of the MPL, the GPL or the LGPL.
|
---|
35 | *
|
---|
36 | * ***** END LICENSE BLOCK ***** */
|
---|
37 |
|
---|
38 | #ifndef nsXPCOM_h__
|
---|
39 | #define nsXPCOM_h__
|
---|
40 |
|
---|
41 | #include "nscore.h"
|
---|
42 | #include "nsXPCOMCID.h"
|
---|
43 |
|
---|
44 | #ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
|
---|
45 | #define NS_InitXPCOM2 VBoxNsxpNS_InitXPCOM2
|
---|
46 | #define NS_ShutdownXPCOM VBoxNsxpNS_ShutdownXPCOM
|
---|
47 | #define NS_NewNativeLocalFile VBoxNsxpNS_NewNativeLocalFile
|
---|
48 | #define NS_GetServiceManager VBoxNsxpNS_GetServiceManager
|
---|
49 | #define NS_GetComponentManager VBoxNsxpNS_GetComponentManager
|
---|
50 | #define NS_GetComponentRegistrar VBoxNsxpNS_GetComponentRegistrar
|
---|
51 | #define NS_GetDebug VBoxNsxpNS_GetDebug
|
---|
52 | #define NS_GetMemoryManager VBoxNsxpNS_GetMemoryManager
|
---|
53 | #define NS_GetTraceRefcnt VBoxNsxpNS_GetTraceRefcnt
|
---|
54 | #define NS_NewLocalFile VBoxNsxpNS_NewLocalFile
|
---|
55 | #endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
|
---|
56 |
|
---|
57 | class nsAString;
|
---|
58 | class nsACString;
|
---|
59 |
|
---|
60 | class nsIComponentManager;
|
---|
61 | class nsIComponentRegistrar;
|
---|
62 | class nsIServiceManager;
|
---|
63 | class nsIFile;
|
---|
64 | class nsILocalFile;
|
---|
65 | class nsIDirectoryServiceProvider;
|
---|
66 | class nsIMemory;
|
---|
67 | class nsIDebug;
|
---|
68 | class nsITraceRefcnt;
|
---|
69 |
|
---|
70 | #ifdef VBOX
|
---|
71 | /**
|
---|
72 | * Checks whether XPCOM was initialized by a call to NS_InitXPCOM2().
|
---|
73 | */
|
---|
74 | extern "C" NS_COM PRBool
|
---|
75 | NS_IsXPCOMInitialized(void);
|
---|
76 | #endif
|
---|
77 |
|
---|
78 | /**
|
---|
79 | * Initialises XPCOM. You must call this method before proceeding
|
---|
80 | * to use xpcom. The one exception is that you may call
|
---|
81 | * NS_NewLocalFile to create a nsIFile.
|
---|
82 | *
|
---|
83 | * @status FROZEN
|
---|
84 | *
|
---|
85 | * @note Use <CODE>NS_NewLocalFile</CODE> or <CODE>NS_NewNativeLocalFile</CODE>
|
---|
86 | * to create the file object you supply as the bin directory path in this
|
---|
87 | * call. The function may be safely called before the rest of XPCOM or
|
---|
88 | * embedding has been initialised.
|
---|
89 | *
|
---|
90 | * @param result The service manager. You may pass null.
|
---|
91 | *
|
---|
92 | * @param binDirectory The directory containing the component
|
---|
93 | * registry and runtime libraries;
|
---|
94 | * or use <CODE>nsnull</CODE> to use the working
|
---|
95 | * directory.
|
---|
96 | *
|
---|
97 | * @param appFileLocationProvider The object to be used by Gecko that specifies
|
---|
98 | * to Gecko where to find profiles, the component
|
---|
99 | * registry preferences and so on; or use
|
---|
100 | * <CODE>nsnull</CODE> for the default behaviour.
|
---|
101 | *
|
---|
102 | * @see NS_NewLocalFile
|
---|
103 | * @see nsILocalFile
|
---|
104 | * @see nsIDirectoryServiceProvider
|
---|
105 | *
|
---|
106 | * @return NS_OK for success;
|
---|
107 | * NS_ERROR_NOT_INITIALIZED if static globals were not initialied, which
|
---|
108 | * can happen if XPCOM is reloaded, but did not completly shutdown.
|
---|
109 | * other error codes indicate a failure during initialisation.
|
---|
110 | *
|
---|
111 | */
|
---|
112 | extern "C" NS_COM nsresult
|
---|
113 | NS_InitXPCOM2(nsIServiceManager* *result,
|
---|
114 | nsIFile* binDirectory,
|
---|
115 | nsIDirectoryServiceProvider* appFileLocationProvider);
|
---|
116 | /**
|
---|
117 | * Shutdown XPCOM. You must call this method after you are finished
|
---|
118 | * using xpcom.
|
---|
119 | *
|
---|
120 | * @status FROZEN
|
---|
121 | *
|
---|
122 | * @param servMgr The service manager which was returned by NS_InitXPCOM2.
|
---|
123 | * This will release servMgr. You may pass null.
|
---|
124 | *
|
---|
125 | * @return NS_OK for success;
|
---|
126 | * other error codes indicate a failure during initialisation.
|
---|
127 | *
|
---|
128 | */
|
---|
129 | extern "C" NS_COM nsresult
|
---|
130 | NS_ShutdownXPCOM(nsIServiceManager* servMgr);
|
---|
131 |
|
---|
132 |
|
---|
133 | /**
|
---|
134 | * Public Method to access to the service manager.
|
---|
135 | *
|
---|
136 | * @status FROZEN
|
---|
137 | * @param result Interface pointer to the service manager
|
---|
138 | *
|
---|
139 | * @return NS_OK for success;
|
---|
140 | * other error codes indicate a failure during initialisation.
|
---|
141 | *
|
---|
142 | */
|
---|
143 | extern "C" NS_COM nsresult
|
---|
144 | NS_GetServiceManager(nsIServiceManager* *result);
|
---|
145 |
|
---|
146 | /**
|
---|
147 | * Public Method to access to the component manager.
|
---|
148 | *
|
---|
149 | * @status FROZEN
|
---|
150 | * @param result Interface pointer to the service
|
---|
151 | *
|
---|
152 | * @return NS_OK for success;
|
---|
153 | * other error codes indicate a failure during initialisation.
|
---|
154 | *
|
---|
155 | */
|
---|
156 | extern "C" NS_COM nsresult
|
---|
157 | NS_GetComponentManager(nsIComponentManager* *result);
|
---|
158 |
|
---|
159 | /**
|
---|
160 | * Public Method to access to the component registration manager.
|
---|
161 | *
|
---|
162 | * @status FROZEN
|
---|
163 | * @param result Interface pointer to the service
|
---|
164 | *
|
---|
165 | * @return NS_OK for success;
|
---|
166 | * other error codes indicate a failure during initialisation.
|
---|
167 | *
|
---|
168 | */
|
---|
169 | extern "C" NS_COM nsresult
|
---|
170 | NS_GetComponentRegistrar(nsIComponentRegistrar* *result);
|
---|
171 |
|
---|
172 | /**
|
---|
173 | * Public Method to create an instance of a nsILocalFile. This function
|
---|
174 | * may be called prior to NS_InitXPCOM2.
|
---|
175 | *
|
---|
176 | * @status FROZEN
|
---|
177 | *
|
---|
178 | * @param path
|
---|
179 | * A string which specifies a full file path to a
|
---|
180 | * location. Relative paths will be treated as an
|
---|
181 | * error (NS_ERROR_FILE_UNRECOGNIZED_PATH).
|
---|
182 | * |NS_NewNativeLocalFile|'s path must be in the
|
---|
183 | * filesystem charset.
|
---|
184 | * @param followLinks
|
---|
185 | * This attribute will determine if the nsLocalFile will auto
|
---|
186 | * resolve symbolic links. By default, this value will be false
|
---|
187 | * on all non unix systems. On unix, this attribute is effectively
|
---|
188 | * a noop.
|
---|
189 | * @param result Interface pointer to a new instance of an nsILocalFile
|
---|
190 | *
|
---|
191 | * @return NS_OK for success;
|
---|
192 | * other error codes indicate a failure.
|
---|
193 | */
|
---|
194 |
|
---|
195 | extern "C" NS_COM nsresult
|
---|
196 | NS_NewLocalFile(const nsAString &path,
|
---|
197 | PRBool followLinks,
|
---|
198 | nsILocalFile* *result);
|
---|
199 |
|
---|
200 | extern "C" NS_COM nsresult
|
---|
201 | NS_NewNativeLocalFile(const nsACString &path,
|
---|
202 | PRBool followLinks,
|
---|
203 | nsILocalFile* *result);
|
---|
204 |
|
---|
205 |
|
---|
206 | extern "C" NS_COM nsresult
|
---|
207 | NS_GetDebug(nsIDebug* *result);
|
---|
208 |
|
---|
209 | extern "C" NS_COM nsresult
|
---|
210 | NS_GetTraceRefcnt(nsITraceRefcnt* *result);
|
---|
211 |
|
---|
212 | #endif
|
---|