1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsDirectoryService_h___
8 #define nsDirectoryService_h___
10 #include "nsIDirectoryService.h"
11 #include "nsInterfaceHashtable.h"
13 #include "nsDirectoryServiceDefs.h"
15 #include "mozilla/Attributes.h"
16 #include "mozilla/StaticPtr.h"
18 #define NS_DIRECTORY_SERVICE_CID \
20 0xf00152d0, 0xb40b, 0x11d3, { \
21 0x8c, 0x9c, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74 \
25 class nsDirectoryService final
: public nsIDirectoryService
,
27 public nsIDirectoryServiceProvider2
{
29 NS_DECL_THREADSAFE_ISUPPORTS
33 NS_DECL_NSIDIRECTORYSERVICE
35 NS_DECL_NSIDIRECTORYSERVICEPROVIDER
37 NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
41 static void RealInit();
42 void RegisterCategoryProviders();
44 static nsresult
Create(REFNSIID aIID
, void** aResult
);
46 static mozilla::StaticRefPtr
<nsDirectoryService
> gService
;
48 void SetCurrentProcessDirectory(nsIFile
* aFile
) { mXCurProcD
= aFile
; }
49 nsresult
GetCurrentProcessDirectory(nsIFile
**);
52 ~nsDirectoryService();
53 nsCOMPtr
<nsIFile
> mXCurProcD
;
55 nsInterfaceHashtable
<nsCStringHashKey
, nsIFile
> mHashtable
;
56 nsTArray
<nsCOMPtr
<nsIDirectoryServiceProvider
>> mProviders
;