michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "mozilla/ModuleUtils.h" michael@0: #include "mozilla/Preferences.h" michael@0: #include "nsPrefBranch.h" michael@0: #include "prefapi.h" michael@0: michael@0: using namespace mozilla; michael@0: michael@0: NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(Preferences, michael@0: Preferences::GetInstanceForService) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrefLocalizedString, Init) michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(nsRelativeFilePref) michael@0: michael@0: static NS_DEFINE_CID(kPrefServiceCID, NS_PREFSERVICE_CID); michael@0: static NS_DEFINE_CID(kPrefLocalizedStringCID, NS_PREFLOCALIZEDSTRING_CID); michael@0: static NS_DEFINE_CID(kRelativeFilePrefCID, NS_RELATIVEFILEPREF_CID); michael@0: michael@0: static mozilla::Module::CIDEntry kPrefCIDs[] = { michael@0: { &kPrefServiceCID, true, nullptr, PreferencesConstructor }, michael@0: { &kPrefLocalizedStringCID, false, nullptr, nsPrefLocalizedStringConstructor }, michael@0: { &kRelativeFilePrefCID, false, nullptr, nsRelativeFilePrefConstructor }, michael@0: { nullptr } michael@0: }; michael@0: michael@0: static mozilla::Module::ContractIDEntry kPrefContracts[] = { michael@0: { NS_PREFSERVICE_CONTRACTID, &kPrefServiceCID }, michael@0: { NS_PREFLOCALIZEDSTRING_CONTRACTID, &kPrefLocalizedStringCID }, michael@0: { NS_RELATIVEFILEPREF_CONTRACTID, &kRelativeFilePrefCID }, michael@0: // compatibility for extension that uses old service michael@0: { "@mozilla.org/preferences;1", &kPrefServiceCID }, michael@0: { nullptr } michael@0: }; michael@0: michael@0: static void michael@0: UnloadPrefsModule() michael@0: { michael@0: Preferences::Shutdown(); michael@0: } michael@0: michael@0: static const mozilla::Module kPrefModule = { michael@0: mozilla::Module::kVersion, michael@0: kPrefCIDs, michael@0: kPrefContracts, michael@0: nullptr, michael@0: nullptr, michael@0: nullptr, michael@0: UnloadPrefsModule michael@0: }; michael@0: michael@0: NSMODULE_DEFN(nsPrefModule) = &kPrefModule;