Bumping manifests a=b2g-bump
[gecko.git] / modules / libpref / nsPrefsFactory.cpp
blob35a9885b9633658527f5b70f3177ed37a160d5c0
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"
9 #include "prefapi.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 },
26 { nullptr }
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 },
35 { nullptr }
38 static void
39 UnloadPrefsModule()
41 Preferences::Shutdown();
44 static const mozilla::Module kPrefModule = {
45 mozilla::Module::kVersion,
46 kPrefCIDs,
47 kPrefContracts,
48 nullptr,
49 nullptr,
50 nullptr,
51 UnloadPrefsModule
54 NSMODULE_DEFN(nsPrefModule) = &kPrefModule;