|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef nsDirectoryService_h___ |
|
7 #define nsDirectoryService_h___ |
|
8 |
|
9 #include "nsIDirectoryService.h" |
|
10 #include "nsInterfaceHashtable.h" |
|
11 #include "nsIFile.h" |
|
12 #include "nsIAtom.h" |
|
13 #include "nsTArray.h" |
|
14 #include "mozilla/Attributes.h" |
|
15 |
|
16 #define NS_XPCOM_INIT_CURRENT_PROCESS_DIR "MozBinD" // Can be used to set NS_XPCOM_CURRENT_PROCESS_DIR |
|
17 // CANNOT be used to GET a location |
|
18 #define NS_DIRECTORY_SERVICE_CID {0xf00152d0,0xb40b,0x11d3,{0x8c, 0x9c, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}} |
|
19 |
|
20 class nsDirectoryService MOZ_FINAL : public nsIDirectoryService, |
|
21 public nsIProperties, |
|
22 public nsIDirectoryServiceProvider2 |
|
23 { |
|
24 public: |
|
25 |
|
26 // nsISupports interface |
|
27 NS_DECL_THREADSAFE_ISUPPORTS |
|
28 |
|
29 NS_DECL_NSIPROPERTIES |
|
30 |
|
31 NS_DECL_NSIDIRECTORYSERVICE |
|
32 |
|
33 NS_DECL_NSIDIRECTORYSERVICEPROVIDER |
|
34 |
|
35 NS_DECL_NSIDIRECTORYSERVICEPROVIDER2 |
|
36 |
|
37 nsDirectoryService(); |
|
38 ~nsDirectoryService(); |
|
39 |
|
40 static void RealInit(); |
|
41 void RegisterCategoryProviders(); |
|
42 |
|
43 static nsresult |
|
44 Create(nsISupports *aOuter, REFNSIID aIID, void **aResult); |
|
45 |
|
46 static nsDirectoryService* gService; |
|
47 |
|
48 private: |
|
49 nsresult GetCurrentProcessDirectory(nsIFile** aFile); |
|
50 |
|
51 nsInterfaceHashtable<nsCStringHashKey, nsIFile> mHashtable; |
|
52 nsTArray<nsCOMPtr<nsIDirectoryServiceProvider> > mProviders; |
|
53 |
|
54 public: |
|
55 |
|
56 #define DIR_ATOM(name_, value_) static nsIAtom* name_; |
|
57 #include "nsDirectoryServiceAtomList.h" |
|
58 #undef DIR_ATOM |
|
59 |
|
60 }; |
|
61 |
|
62 |
|
63 #endif |
|
64 |