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/. */
6 #include "mozilla/ModuleUtils.h"
7 #include "mozilla/Preferences.h"
8 #include "nsPrefBranch.h"
11 using namespace mozilla
;
13 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(Preferences
,
14 Preferences::GetInstanceForService
)
15 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrefLocalizedString
, Init
)
16 NS_GENERIC_FACTORY_CONSTRUCTOR(nsRelativeFilePref
)
18 static NS_DEFINE_CID(kPrefServiceCID
, NS_PREFSERVICE_CID
);
19 static NS_DEFINE_CID(kPrefLocalizedStringCID
, NS_PREFLOCALIZEDSTRING_CID
);
20 static NS_DEFINE_CID(kRelativeFilePrefCID
, NS_RELATIVEFILEPREF_CID
);
22 static mozilla::Module::CIDEntry kPrefCIDs
[] = {
23 { &kPrefServiceCID
, true, nullptr, PreferencesConstructor
},
24 { &kPrefLocalizedStringCID
, false, nullptr, nsPrefLocalizedStringConstructor
},
25 { &kRelativeFilePrefCID
, false, nullptr, nsRelativeFilePrefConstructor
},
29 static mozilla::Module::ContractIDEntry kPrefContracts
[] = {
30 { NS_PREFSERVICE_CONTRACTID
, &kPrefServiceCID
},
31 { NS_PREFLOCALIZEDSTRING_CONTRACTID
, &kPrefLocalizedStringCID
},
32 { NS_RELATIVEFILEPREF_CONTRACTID
, &kRelativeFilePrefCID
},
33 // compatibility for extension that uses old service
34 { "@mozilla.org/preferences;1", &kPrefServiceCID
},
41 Preferences::Shutdown();
44 static const mozilla::Module kPrefModule
= {
45 mozilla::Module::kVersion
,
54 NSMODULE_DEFN(nsPrefModule
) = &kPrefModule
;